I have just started doing image processing, and I am currently working on line detection. I am using Hough transform on the image below.

enter image description here

I'm wondering how I can improve the efficiency of the Hough transform? Before applying the transform what can be done (pre-processes) to improve the performance?

  • 2
    $\begingroup$ Welcome to dsp.SE :) some more information on your current approach would help us answering your problems: What kind of results are you getting now? How good do your results need to be (e.g. how/for what will your solution be applied)? Also, mentioning the approaches you explored on your own could be nice. $\endgroup$
    – penelope
    Nov 28, 2012 at 9:29
  • $\begingroup$ Try not to see the image as a human sees it. Try to see it as a function of brightness vs position. One of the lines you want to find is darker than its surroundings at one point, then lighter than its surroundings at another point! If you do edge detection it should find both, but will be confused by the transition region in the middle. Maybe there's a way to reverse the effects of the lighting like I tried to do here, though I don't really know how. $\endgroup$
    – endolith
    Nov 28, 2012 at 16:53

1 Answer 1


Are you using openCV? Anyway, if you are running an edge-detection, and then the hough transform on the edges, it might help to smooth/blur the edges with some bluring functions. OpenCV got some different ones for that.

In particular a boxFilter with a 2x2 sized kernel, anchor=Point(-1,-1), and normalize=false. It will hopefully make all the edges "thicker", filling in gaps and inconsitencies in the process.

  • $\begingroup$ I am using MATLAB. $\endgroup$
    – Amadeus
    Nov 28, 2012 at 3:14
  • $\begingroup$ @HenrikKjusAlstad Welcome to dsp.SE, and thank you for contributing. We aim for questions and answers here to not be language-specific, so would it maybe be possible for you to describe the openCV arguments you recommend? It's fine that your solutions are in OpenCV, but they should be understandable and reproducible in any other language suitable for the problem :) $\endgroup$
    – penelope
    Nov 28, 2012 at 9:26
  • $\begingroup$ @Zxy, I havent used matlab before, but the key idea would be the same, no matter which language or tool you use. I would look into some blur functions and see if they can smooth the edges to make them fall more into a line. $\endgroup$ Nov 28, 2012 at 11:57

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.