Define bounding space (or box) in perspective view inside PCL Visualizer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Define bounding space (or box) in perspective view inside PCL Visualizer

ravijoshi
I have captured a point cloud of a scene containing a sphere (yellow ball).
In order to define a bounding box for this sphere, I carried out following
procedure-

(1) Visualize the point cloud in PCL Visualizer
(2) Used registerPointPickingCallback function to manually record both
diagonal points of the bounding rectangle for the current view inside PCL
Visualizer
(3) Used CropBox filter by providing these two points as limits for the
filter (The z limit for the filter was increased just to be on safe side and
not to crop the sphere on z-axes).

The above doesn't work. In order to debug into the issue, I colored both
diagonal points of the bounding rectangle as red and green. Also, I draw a
cube with the same limits used in CropBox filter. Please see below GIF image
of the visualizer-

<http://www.pcl-users.org/file/t499210/pcl.gif>

Initially, the sphere appeared to be inside the bounding rectangle. But it
was much clear after the view was rotated.

My goal is to define a bounding box for this sphere. I realized that the
problem is arriving due to perspective view hence I tried composing an
affine transformation using camera object, but it didn't work. Below is the
code snippet-

---------------------------------------------------------
pcl::visualization::PCLVisualizer viewer("Cloud Viewer");
viewer.setCameraParameters(camera);
viewer.addCube(x_min, x_max, y_min, y_max, z_min, z_max, 1, 0, 0,
"bounding_box");

Eigen::Matrix4d view_mat;
Eigen::Affine3f transformation;
camera.computeViewMatrix(view_mat);
transformation.matrix() = view_mat.cast<float>();

pcl::CropBox<pcl::PointXYZRGB> box_filter;
box_filter.setMin(Eigen::Vector4f(x_min, y_min, z_min, 1.0));
box_filter.setMax(Eigen::Vector4f(x_max, y_max, z_max, 1.0));
box_filter.setInputCloud(cloud);
box_filter.setTransform (transformation);
box_filter.filter(*seg_cloud);
---------------------------------------------------------

Am I missing something obvious? Any workaround, please?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Define bounding space (or box) in perspective view inside PCL Visualizer

ravijoshi
any suggestions, please?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users