I am trying to improve an edge following algorithm developed by some students who did a project at my work. The algorithm is supposed to make a robot follow a line with the use of a camera. Their approach was to detect edges with Canny's algorithm and then extract lines from this image using the Hough transform. Three suggested lines will then be presented to the user, who may choose which line the robot should try to follow.

What I want feedback about is data association using the Hough transform. Is there any good criteria for matching of lines between frames? The used solution right now is to measure the angle and distance between followed line and extracted lines and to choose the one that is most similar.

One other problem I see is that they did not filter the signal, i.e. detected lines between frames. I have an idea about using Kalman filter to estimate the current parameters of the edge by using the extracted lines so that it is dynamic and less error prone. What do you think about that?

I have thought about making a SLAM algorithm instead but since we only want a proof of concept that will be a huge remake and requires much more data than I currently have.

  • $\begingroup$ As this is just an idea and not an actual answer, I answer in the comments. Instead of selecting highest maximas in the hough space for two successive frames and then try to match the lines parameters, you could try to find the highest maximas in the successive frames taking the previous maximas into account(ie have a window in the hough space around your previous maximas, and selecting your new maximas in those subspaces). By fine tuning the window, you may be able to follow the lines more accurately. $\endgroup$
    – Al_th
    Commented Mar 18, 2014 at 10:19

2 Answers 2


SLAM is Simultaneous Localization and Mapping. If you have maps already, I think your main challenge in line following is the localization part.

For straight lines, Canny+Hough pipeline works relatively well in detection. Are the lines within each frame strictly linear? Will they curve? Assuming that you are dealing with straight lines, the output will be a line parameterization, e.g. $ax + by = c$. There are many establish methods in measuring distances between lines, and you can definitely integrate this into a single target tracker to associate the most likely lines as you step through the frames.

  1. Matching lines across multiple views is a common research problem and is reasonably well studied: If you have the end points for example: Tomas Werner - Matching of Line Segments Across Multiple Views: Implementation Description (memo).

Even tough this deals with more geometric properties, if your scenes are well conditioned, you could as well use the gradient/intensity information to match the lines.

Here is a full source code on multiview line matching from monocular setups: manhofer - Line3D++ - Multi-View Stereo using Line Segments.

You might also like to start with that.

  1. Using a KALMAN filter on the lines would be a good idea. There are also more sophisticated algorithms. For example, in each frame you might want to minimize cost function to obtain the subpixel line, which has better resemblence to the line in the previous frame.

You can also track the camera pose and from there hypothesize the lines.

You try to avoid SLAM, but maybe, triangulating the lines and obtaining 3D structure would be the best in reducing the errors.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.