Blog 7: Wall Detection with RANSAC & Feature Extraction
Isolating Walls with Z-Slicing
After cleaning the point cloud, the first challenge was choosing the proper scan slice. Since LiDAR captures everything in 3D, including floors, ceilings, and objects in the environment, I had to filter out unnecessary points and focus on vertical structures. To do this, I analysed the Z-axis histogram and selected the height range that best represented walls. This process required fine-tuning the slicing parameters—too thin a slice removed practical details, while too thick a slice introduced noise.
Detecting Planes with RANSAC
Once I had a suitable slice, I applied RANSAC Plane Segmentation to detect flat surfaces, likely to be walls. The tricky part was setting the correct parameters—a low distance threshold fragmented walls, while a high threshold merged unrelated surfaces. After making some adjustments, I was able to extract a cleaner set of wall points, although the output was still rough in places.
Refining the Wall Geometry
Even after detecting the walls, gaps, misalignments, and fragmented edges remained. To improve the structure, I used collinear edge merging, which combines nearly aligned segments into longer, continuous walls. Some walls still had disconnected corners, so I applied corner extension, slightly lengthening wall segments to ensure they connected adequately.


Example of wall detection in red


Example of DXF Export





