From an aerial photograph, the object containing multiple planes is given below:
|Screenshot of the object with multiple planes
Now, as we know, the real picture is never seen from an aerial photograph, so we also give you a screenshot of the data corresponding to this cutout.
|LiDAR data for the corresponding object
We therefore, make some assumptions regarding the thresholds as follows:
- The minimum number of points in a plane should be 40.
- The threshold for finding inliers would be say 0.20m.
Peter Kovesi's algorithm will always find out one best plane from the data set. So what I did is to follow an approach mentioned in Chapter 14 of the book titled Topographic Laser Scanning and Ranging which is authored by F. Bretar. To explain in brief, we find out one plane, remove the inliers from the dataset, find out a second plane, remove the inliers again and so on. We do this until we are not able to find a plane, or the number of remaining points is less than or equal to 3.
Output using Peter Kovesi's algorithm is shown in the following figure:
|Detected planes (denoted by different colors) using the Peter Kovesi's algorithm
Our next goal is to test the output using the Mobile Robot Programming Toolkit (MRPT), I have already provided you with the link of the demo code. MRPT is easily installable on the Ubuntu platforms using Synaptic. Just find mrpt and select all the installable software from the displayed list. I just customised the demo code to read the data (shown above) and execute the program.
The output given is as follows:
|OpenGL screenshot (basic API of MRPT) to display the detected planes and point cloud
Let us now go to Tim Zaman's code in MATLAB given on his website. What is appreciable is that Tim Zaman with all his humility does accept that his code is slow, but argues that it needs to be structured and readable. I agree with him. However, let us see how his code has performed with our data. Unfortunately Tim Zaman's code needs to be tuned further to be used for detecting multiple planes, and I am therefore providing you the elementary output (of detecting a single plane). Remember, the thresholds are always the same.
|Output found with Tim Zaman's code (www.timzaman.nl)