ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello srik11 and all, If all you need is to convert laser scan msgs into an image and apply some cv algorithms, you don't even need PCL in between. This is how I did hallway detection from the laser data: (Note: This is not the only way. It works and does the job)

If you realized, the laser output is already in polar form i.e., (r, theta) [distance of object in a particular direction]. All you need to do is take an empty image (by which I mean an image with all white pixels) and using (r, theta) calculate (x, y) which is (r cos theta, r sin theta). Round of (x, y) and in the image, change the corresponding (x, y) pixel from white to black. Repeat this for all the (r, theta) pair from the laser scan. Please also note that you might want to shift the origin (laser origin is at the center and the image origin should always be on the top left corner - atleast for openCV image format). formulas for origin shift: X = x - h, Y = y - k.

You might want to scale the image down to a reasonable size for you to process it especially if your laser scanner range is high.

I hope this helps. Happy coding!