alessandro-gentilini / Efficient-RANSAC-for-Point-Cloud-Shape-Detection

Efficient RANSAC for Point-Cloud Shape Detection
126 stars 30 forks source link

How to visualize the result of the shape detection? #3

Open Tina1994 opened 4 years ago

Tina1994 commented 4 years ago

Hello, I have some question with how to visualize the detection result. We can see how many points in the different type shapes, but can not see which points are in which shape? Does there any code on this repo to do this work?

Barks27 commented 4 years ago

Hi,

after a shape is recognized the input point cloud is reordered and the assigned points of the recognized shape are swapped to the end of the point cloud. So if your input point cloud has n points and your recognized shape has k points you can find the first point at point cloud[n-k] and the last point at point cloud[n]. After the first shape is recognized the points of the second shape are arranged at the end of the point cloud but before the first recognized shape.

You can find an example of how to implement this in the CloudCompare implementation.

For visualization you could use open3d and trimesh for python.

https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/Standard/qRANSAC_SD/src/qRANSAC_SD.cpp

guillermoacdc commented 2 years ago

Hi,

after a shape is recognized the input point cloud is reordered and the assigned points of the recognized shape are swapped to the end of the point cloud. So if your input point cloud has n points and your recognized shape has k points you can find the first point at point cloud[n-k] and the last point at point cloud[n]. After the first shape is recognized the points of the second shape are arranged at the end of the point cloud but before the first recognized shape.

You can find an example of how to implement this in the CloudCompare implementation.

For visualization you could use open3d and trimesh for python.

https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/Standard/qRANSAC_SD/src/qRANSAC_SD.cpp

Updating the path: https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/Standard/qRANSAC_SD/src/qRANSAC_SD.cpp

Somebody knows how to address the pointer in shapes[i].first to save its content into a new variable ?

Example Vec3f myValue; myValue = *shapes[0].first;