ldelange / plane-detection

Fast dominant plane segmentation algorithm for MATLAB
9 stars 2 forks source link

Multi-Plane Segmentation #2

Open hridaybavle opened 7 years ago

hridaybavle commented 7 years ago

Hi Leon,

I was using your code to perform plane segmentation in PCD files grabbed from intel-realsense camera. The dominant plane segmentation works well. I was trying to add multi-plane segmentation in the code but I am not achieving any results.

I first tried to call the detect_plane function n number of times to detect n number of planes, but this approach provides results for the first segmented plane and doesn't perform well in other remaining segmentations.

I also tried several other approaches but I am not able to detect multiple planes in the point cloud. Can you give me a brief idea of how I can achieve it extending your code?

Thanks, Hriday

ldelange commented 7 years ago

Hey Hriday,

Glad to hear that you got my code running :)

Easy solution: The most simple solution would be finding the dominant plane by calling detect_plane(). Remove all the pixels in the point cloud associated with this dominant plane. Next call the function detect_plane() with the 'updated' point cloud to find the second dominant plane.

Difficult solution: When you understand the detect_plane() code (based on the paper from Holtz) you can find multiple alternative plane orientations in the 'cluster' matrix (line: 54). For my thesis i used the cluster with the highest bin count to find the dominant plane (line: 47). Once you select an alternative cluster (with high bin count) check if it is not equal to the dominant plane. Next merge the clusters with similar orientation this is done in lines 76-84.

I hope this answers your question

kind regards, Leon

hridaybavle commented 7 years ago

Hi Leon,

Thanks for your answer, I was able to implement the easy solution that you mentioned, it works detecting the second dominant plane.

As it's obvious that calling the detect plane function several times would make the algorithm slow, do you think that it's worth implementing the difficult solution and do you think it can improve the computation time?

My final goal is to convert the code to c++ and use it for localization using rgbd sensors sensor, hence the lower the computation time the better.

Regards, Hriday

ldelange commented 7 years ago

Hi Hriday,

To be short, i don't know if it is worth implementing the difficult solution. I would suggest to place a software timer in detect_plane() and measure the execution time of lines 1 to 76 and your additional code, where the dominant plane points are removed. These parts of the algorithm only have to be executed once, when you implement the difficult solution. Now when you compare the found execution time to the total execution time of detect_plane() you can estimate if it is worth to implement the difficult solution. ( i.e. when the most execution time is spend between lines 76 and 112 it is not worth implementing the difficult solution. )

Good luck with the localization!

Kind regards, Leon