Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCLVisualizer crash #6000

Closed
AliAmin110 opened this issue Apr 7, 2024 · 9 comments
Closed

PCLVisualizer crash #6000

AliAmin110 opened this issue Apr 7, 2024 · 9 comments

Comments

@AliAmin110
Copy link

AliAmin110 commented Apr 7, 2024

I wrote this code

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/pcl_visualizer.h>

int main(int argc, char** argv) {
    // Load point cloud data
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::PointXYZ point;
    point.x = 0;
    point.y = 0;
    point.z = 0;
    cloud->points.push_back(point);

    // Initialize visualization
    pcl::visualization::PCLVisualizer::Ptr viewer(new pcl::visualization::PCLVisualizer("Point Cloud Viewer"));

    // Set background color to black
    viewer->setBackgroundColor(0, 0, 0);

    // Add point cloud to viewer
    viewer->addPointCloud(cloud, "cloud");

    // Set camera position
    viewer->initCameraParameters();
    viewer->setCameraPosition(0, 0, 0, 0, 0, 1, 0, -1, 0);

    // Display viewer
    while (!viewer->wasStopped()) {
        viewer->spinOnce(100);
    }

    return 0;
}

project properties is this :
windows10
visual studio 2019
PCL 1.14.0
vtk-9.3
release x64
the program crashes at addPointCloud when i run it.
Untitled
what should i do?

@AliAmin110 AliAmin110 added the status: triage Labels incomplete label Apr 7, 2024
@mvieth
Copy link
Member

mvieth commented Apr 7, 2024

@AliAmin110 Do you use CMake for building? If yes, please show your CMakeLists.txt. Also, how did you install PCL? Is it possible that there are other (older) PCL and/or VTK installations on your computer?

@mvieth mvieth added kind: bug Type of issue module: visualization and removed status: triage Labels incomplete labels Apr 7, 2024
@AliAmin110
Copy link
Author

AliAmin110 commented Apr 8, 2024

@mvieth thanks for replying.
no i didnt use CMake for building. only installed PCL-1.14.0-AllInOne-msvc2022-win64.exe and added below properties to visual studio
1
2

@mvieth
Copy link
Member

mvieth commented Apr 8, 2024

@AliAmin110 I can't reproduce the problem. Is it possible that you have multiple installations of PCL or VTK? Or did you previously have other versions of PCL or VTK installed, which may not be completely removed?

@AliAmin110
Copy link
Author

@mvieth no i checked it again and i have only PCL-1.14.0 installed on my pc. is there any way to check the PCL or VTK version?
there is a point , i can run a simple plot without any problem but visualizion has error. the function addPointCloud crashes!

@mvieth
Copy link
Member

mvieth commented Apr 8, 2024

PCL defines the preprocessor symbols PCL_VERSION and PCL_VERSION_PRETTY, VTK defines VTK_VERSION and VTK_VERSION_NUMBER (see also https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion/)

I found an issue which seems to be related: #4278 although that concerned updatePointCloud and was already fixed.

@larshg Maybe there is an vertices->SetNumberOfCells(nr_points); missing here: https://github.com/PointCloudLibrary/pcl/blob/master/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp#L366 ?

@AliAmin110
Copy link
Author

AliAmin110 commented Apr 9, 2024

@mvieth I checked both versions and the result is this
PCL version

@larshg
Copy link
Contributor

larshg commented Apr 9, 2024

I can't reproduce it:
image

Works as expected.

@AliAmin110 can you please show the libraries you link into your application - maybe you added debug libraries of vtk in the release tab?

@AliAmin110
Copy link
Author

@larshg Thanks a lot , the point was that. I was added debug libs into release properties.
Thanks again

@larshg
Copy link
Contributor

larshg commented Apr 9, 2024

@AliAmin110 Great - then we can close the issue 👍

@larshg larshg closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants