Home > Back-end >  Pcl1.72 the visualization: : CloudViewer couldn't display the image
Pcl1.72 the visualization: : CloudViewer couldn't display the image

Time:10-05

Run the following program point cloud don't come, no matter what the input, the output is the


#include
#include
#include
#include
#include

Using the namespace CV;
using namespace std;
Using the namespace photo;

Int user_data;
//the camera inside, according to the input changes
Const double u0=1329.49/4;//behind due to resize to a quarter of the original so some parameters to reduce the same multiples
Const double where v0=954.485/4;
Const double fx=6872.874/4;
Const double fy=6872.874/4;
Const double Tx=174.724;
Const double doffs=293.97/4;

Void viewerOneOff (the visualization: : PCLVisualizer& Viewer)
{
//viewer. SetBackgroundColor (0.0, 0.0, 0.0);
Viewer. SetBackgroundColor (1, 1, 1);
}

Int main ()
{
PointCloud Cloud_a;
PointCloud : : Ptr cloud (new PointCloud


Mat color1=imread (" im0. PNG ");
Mat the depth=imread (" Sword1_perfect_d. PNG ");
////Resize
//color1. The resize ();
Mat color;
The resize (color1, color, Size (color1. Cols/4, color1. Rows/4), 0, 0, CV_INTER_LINEAR);
//imshow (" h ", color);
//waitKey (0);

Int rowNumber=color. Rows;
Int colNumber=color. Cols;

Cloud_a. Height=rowNumber;
Cloud_a. Width=colNumber;
Cloud_a. Points. The resize (cloud_a. Width * cloud_a. Height);

For (unsigned int u=0; U & lt; RowNumber; + + u)
{
For (unsigned int v=0; V & lt; ColNumber; + + v)
{
/* unsigned int num=rowNumber * colNumber - (u * colNumber + v) - 1; */
Unsigned int num=u * colNumber + v.
Double Xw=0, Yw=0, Zw=0;


Zw=fx * Tx/(((double) the depth. AtXw=(n + 1 - u0) * Zw/fx.
Yw=(u + 1 - where v0) * Zw/fy;

Cloud_a. Points [r]. Num=b color. AtCloud_a. Points [num] g=color. AtCloud_a. Points [num] r=color. At
Cloud_a. Points [num]. X=Xw;
Cloud_a. Points [num] y=Yw;
Cloud_a. Points [num]. Z=Zw;
}
}

* cloud=cloud_a;

The visualization: : CloudViewer viewer (" Cloud viewer ");

Viewer. ShowCloud (cloud);

Viewer. RunOnVisualizationThreadOnce (viewerOneOff);

while (! Viewer. WasStopped ())
{
User_data=https://bbs.csdn.net/topics/9;
}

return 0;
system("pause");
}

CodePudding user response:

Move the mouse wheel

CodePudding user response:

Press the keyboard R is ok,

CodePudding user response:

I also have this problem, the building Lord, please find a solution to the
  • Related