Often, the range of θ is degrees and ρ is where d is the length of the edge image’s diagonal. It is worth noting that this method of thresholding might not always yield the best result without doing some preprocessing like neighborhood suppression on the Hough Space to remove similar lines in the edge image. Thus, the Hough Transform algorithm detects lines by finding the (ρ, θ) pairs that have a number of intersections larger than a certain threshold. If two edge points lay on the same line, their corresponding cosine curves will intersect each other on a specific (ρ, θ) pair. From this, if we were to map all the edge points from an edge image onto the Hough Space, it will generate a lot of cosine curves. The yellow dots in the Hough Space indicate that lines exist and are represented by the θ and ρ pairs.Īs mentioned, an edge point produces a cosine curve in the Hough Space. The process of detecting lines in an image.
In order to understand how the Hough Transform algorithm works, it is important to understand four concepts: edge image, the Hough Space, and the mapping of edge points onto the Hough Space, an alternate way to represent a line, and how lines are detected. Since its inception, the algorithm has been modified and enhanced to be able to recognize other shapes such as circles and quadrilaterals of specific types. Hough and was originally invented to recognize complex lines in photographs (Hough, 1962). The Hough Transform is an algorithm patented by Paul V. Hence, in this article, I would like to explain the Hough Transform algorithm and provide a “from-scratch” implementation of the algorithm in Python. Through that article, I learned about a method called the Hough Transform and how it can be used to detect lines in images. The article explains how Dropbox’s machine learning team implemented their document scanner by highlighting the steps they went through and the algorithms used in each step (Xiong, 2016). After doing some research, I came across an article written by Ying Xiong who was a member of Dropbox’s machine learning team.
Recently, I found myself having to incorporate a document scanner feature into an app. Note: You can read the Chinese version of this article here. Line Detection using the Hough Transform Algorithm