Friday, 6 January 2017

image processing - Hough transformation vs Contour detection for Rectangle recognition with perspective projection

What sort of results are you getting with contour detection so far? Got any examples?



Hough transform should work well for rectangle detection IFF you can assume that the sides of the rectangle are the most prominent lines in your image.
Then you can simply detect the 4 biggest peaks in hough space and you got your rectangle.



This works for example with a photo of a white sheet of paper in front of a dark background.



Ideally you would preprocess the image with blur, threshold, morphological operators to remove any small-scale structures before hough transform.




If there are multiple smaller rectangles or other sorts of prominent lines in your images, contour detection might be the better choice.



Some general advantages for the hough transform off the top of my head:




  • Hough transform can still work if part of the rectangle is obstructed or out of the frame.

  • Hough transform should be faster than contour detection, I guess?

  • Hough transform will ignore anything that is not a straight line, so you may have greater success with cluttered images. (if the rectangle sides are the most prominent lines)




In the end it probably depends on the input data. Got any examples?



Perhaps a combined approach would be best? see
Combining Hough Transform and Contour Algorithm for detecting Vehicles License-Plates



I did some experiments in using hough transform to detect rectangles a while back, you can see some preliminary results here:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=14491&start=9



Unfortunately that is all that exists at the moment, the project is currently on hiatus, eventually I hope to resume it when I am less busy.




I'd be very interested in your results in comparison.



(If you are doing perspective correction, also check out proportions of a perspective-deformed rectangle )

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...