creating 2D bearing angle image from 3d pointcloud

asked 2019-05-01 10:27:41 -0600

playeronros gravatar image

Hi,

I have a ROS node that subscribes to 3D points from a depth camera. I am using the PCL library to create a 3D bearing angle image based on the 3D pointcloud from a depth camera. I am able to create the image but am unsure how to reconstruct this. Using the methods defined in pcl/common/src/bearing_angle_image.cpp and Open CV I have the following code:

 pcl::BearingAngleImage bearing_angle_image;
 bearing_angle_image.generateBAImage(*pcl_cloud_xyz);
 cv::Mat Im(bearing_angle_image.height, bearing_angle_image.width, CV_8UC1, cv::Scalar(255));
 int count = 0;
 for (int i=0; i< bearing_angle_image.height-1; i++)
 {
       for (int j=0; j< bearing_angle_image.width-1; j++)
       {
           Im.at<unsigned char>(i,j) = bearing_angle_image.points[count].rgba; 
           count++;
       }
 }
 cv::namedWindow("image", CV_WINDOW_AUTOSIZE);
 imshow("image", Im);
 cv::waitKey(0);
 cv::destroyAllWindows();

The final output displayed is wrong. My question is what is the order of points and how can I reconstruct the bearing angle image to view?

edit retag flag offensive close merge delete