Home > Back-end >  Photo point cloud visualization, program crashes
Photo point cloud visualization, program crashes

Time:11-28

Contact photo, recently installed the other day with AllInOne package photo 1.11, VS version is 2019. Run after photo attached a routine
 # include & lt; Photo/visualization/cloud_viewer. H> 
# include & lt; Iostream>
# include & lt; Photo/IO/IO. H>
# include & lt; Photo/IO/pcd_io. H>

Int user_data;

Void
ViewerOneOff (PCLS: : the visualization: : PCLVisualizer& Viewer)
{
Viewer. SetBackgroundColor (1.0, 0.5, 1.0);
Photo: : PointXYZ o;
O.x=1.0;
O.y=0;
O.z=0;
Viewer. AddSphere (o, 0.25, "sphere", 0).
STD: : cout & lt; <"I only run once" & lt;
}

Void
ViewerPsycho (PCLS: : the visualization: : PCLVisualizer& Viewer)
{
The static unsigned count=0;
STD: : stringstream ss;
Ss & lt; <"Once per viewer loop:" & lt; Viewer. RemoveShape (" text ", 0).
Viewer. AddText (ss. STR (), 200, 300, "text", 0).

//FIXME: a possible race condition here:
User_data + +;
}

Int
The main ()
{
Photo: : PointCloud : : Ptr cloud (new photo: : PointCloudPhoto: : IO: : loadPCDFile (" C:/Users/Shinelon/Desktop/test_pcd PCD ", * cloud);

Photo: the visualization: : CloudViewer viewer (" Cloud viewer ");

//blocks until the cloud is later rendered
Viewer. ShowCloud (cloud);

//use the following functions provides the to get access to the physicist more advanced/powerful
//PCLVisualizer

//This will only get called once
Viewer. RunOnVisualizationThreadOnce (viewerOneOff);

////This will get called once per the visualization iteration
Viewer. RunOnVisualizationThread (viewerPsycho);
While (! Viewer. WasStopped ())
{
//you can also do cool processing here
//FIXME: Note that this is running in a separate thread from viewerPsycho
//and you should guard against race the conditions yourself...
User_data + +;
}
return 0;
}


The program compiled without error, but run in a window, after program crash,

Consult everybody, what reason is this?

Thank you for your reply!!!!

CodePudding user response:

I find a solution - heavy graphics driver!!
  • Related