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

Thanks for the quick reply. Yes, what you said seems valid. However, I have a question, How do I apply hough's transform to laser data? for the equation r = x cos theta + y sin theta, I can get r value (range in laser message), theta (theta increments from the laser message). I am still left with two unknowns x and y.

I used hough's transforms on Images before as follows: I iterate over every pixel and for every edge pixel, I calculate theta using gradient, solve for r in r = x cos theta + y sin theta vote for r , theta in a accumulator. The (r, theta) that gets maximum votes are my hough parameters.

So, when I have two unknowns (x, y ) how can solve for the equation.

Thanks for the quick reply. Yes, what you said seems valid. However, I have a question, How do I apply hough's transform to laser data? for the equation r = x cos theta + y sin theta, I can get r value (range in laser message), theta (theta increments from the laser message). I am still left with two unknowns x and y.

I used hough's transforms on Images before as follows: I iterate over every pixel and for every edge pixel, I calculate theta using gradient, solve for r in r = x cos theta + y sin theta vote for r , theta in a accumulator. The (r, theta) that gets maximum votes are my hough parameters.

So, when I have two unknowns (x, y ) how can solve for the equation.

Edit: I found the answer. The laser messages are already in polar form. so, you have r and theta from it. Using r, theta find x = r * cos theta and y = r * sin theta. round of both x and y. Using opencv create an empty image (white image) - the image size depends on the accuracy/resolution you need, for every calculated x, y manipulate pixel at x,y to black pixel. By doing so, you will get a white image with black dots (walls/obstacles detected by the laser). Now, use the built in Hough transform from OpenCV and find the lines. In order to detect the hallway, select two strong lines whose slopes are equal.