ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question

Revision history [back]

First I'd say that there isn't a simple way of doing this. Theoretically there are two approaches you could take, Hough transforms or RANSAC. These are very different choices because Hough transforms work on raster images and RANSAC works with point cloud data.

Your easiest approach would be to convert the laser scan data into a CV::Mat image (occupancy map) with empty pixels in black and pixels which contain a laser sample in white. You can then use the OpenCV library included with ROS to detect primitive shapes, cicles or lines using Hough transforms. Once you have got that working you're 99% of the way there.

Detecting squares and rectangles in a higher level task because these are compound shapes not primitives like cicles and lines. They are sets of four lines with several additional constraints between them, where square is a sub-set of rectangle.

Hope this is enough to get you started.