3

I am developing a larger system for navigation and positioning of automated guided vehicles and have stumbled upon a problem. When developing a map, the important part is finding the walls. The navigation is done using a LiDAR unit.

An example "image" of that the sensor sees is as follows: enter image description here

And the wanted output is something like this: enter image description here

I have looked alot at the Hough transform and the RANSAC algorithm but the Hough transform as from what I know is used on images which is not optimal for my case and the RANSAC is not great for finding multiple walls in sparse data.

The data that was used in this specific example can be found in this link: https://drive.google.com/file/d/1EnSOr2FYjIdqG1RdFgTkgsoEhVcG7Tl_/view?usp=sharing Where the two arrays in the file represent x and y coordinates where elemets correspond by index.

Im developing in python but I have no issue to write the algorithm myself if anyone knows a suitable one that is not available in a package or so.

Thanks in advance, Jakob

JakobVinkas
  • 1,003
  • 7
  • 23
  • From a clueless guy, perhaps you should cluster your points and then perform RANSAC? But why does HoughTransform not work? Theoretically it should work by finding the edges among your sparse points....and image is simply a collection of points on a plane with light intensity values. – Jason Chia Jan 16 '20 at 14:56
  • @JasonChia Yeah you might be right but then how do I properly cluster the measurements? When it comes to the Hough Transform I think I mainly came to a conclusion that it would require me to reduce the precision to much, I need to be able to estimate the walls to millimeter precision in a 50 meter long warehouse. Do you think the Hough could be used for that? Thank you for the answer. – JakobVinkas Jan 16 '20 at 15:40
  • Have you tried this code from PCL? Plane segmentation http://pointclouds.org/documentation/tutorials/planar_segmentation.php – Suhas C Jan 16 '20 at 19:52
  • 1
    @SuhasC Thank you for the answer, my cpp knowlage is close to non-existing but I will have a look at it. – JakobVinkas Jan 17 '20 at 06:22
  • @JakobVinkas have you found a solution in python? I'm facing the same problem too! – youssef Jun 20 '22 at 12:19

2 Answers2

0

You could try mathematical morphology such as erosion/ dilatation https://docs.opencv.org/trunk/d9/d61/tutorial_py_morphological_ops.html

I tried on your image and it starts looking to a room :

source image eroded/dilated image threshold-ed

Here is an example of implementation in python using opencv:

import numpy as np
import scipy.stats
import cv2

inputImage = cv2.imread('input.jpg')

skernel = cv2.getStructuringElement(cv2.MORPH_RECT,(3,3))
cv2.imshow("test1",inputImage)

openImg =cv2.morphologyEx(inputImage, cv2.MORPH_OPEN, skernel, iterations =15)
cv2.imshow("test2",openImg)
img_gray = cv2.cvtColor(openImg, cv2.COLOR_BGR2GRAY)
ret,th3 = cv2.threshold(img_gray,200,255,cv2.THRESH_BINARY)

cv2.imshow("test3",th3)

Also I think that there is a missing keyword in your question since what you are looking for is a point cloud reconstruction algorithm. you may have a look here also https://hal.inria.fr/hal-01348404v2/document

Cryckx
  • 659
  • 6
  • 18
  • 1
    Hi, thank you for the answer and for all the effort you went through. Sadly I suspect that this would yiled a less than optimal precision.. And I belive that the large amount of noise in the data is going to screw up the results to much using the "image analysis" method. – JakobVinkas Jan 17 '20 at 13:22
  • this approach does not provide a way to find the lines in the image. It only makes it 'look better' for a human, which is completely irrelevant in this case. – Jev Feb 25 '21 at 22:29
  • cv2 has canny edge detection, and there are loads of look for lines in the road functions for autonomous cars that can extend or ignore lines as needed. Probably @jacobvinkas and others including myself would benefit from comparing the hough transform with the above and see which prove useful. – brianlmerritt Mar 15 '22 at 01:56
0

Probably a bit late for the original question, but I'm sure more people will want to solve the same problem.

Hough transform can very well be done on a point cloud, however I'm not aware of a ready to use library implementation.

Here is an excellent example with full explanation and source code: Processing LIDAR data using a Hough Transform

If you understand how Hough transform works and take a look at the code, you'll see how it iterates through the points and creates a 2-d histogram in the feature space. It's farly straightforward to implement something like this.

Jev
  • 1,163
  • 10
  • 13