Line detection
In image processing, a line is a collection of edge points that are adjacent and have the same direction.[1] Line detection is an algorithm that take a collection of n edge points and find all the lines on which these edge points lie. The most popular line detectors are the Hough transform and convolution based technique. [2]
Hough transform can be used to detect lines and the output is a parametric description of the lines in an image, for example ρ = r cos(θ) + sin(θ).[1] If we have a line in our row and column based image space, we can define that line by ρ, the distance from the origin to the line along a perpendicular to the line, and θ, the angle of the perpendicular projection from the origin to the line measured in degrees clockwise from the positive row axis. [2] Therefore, a line in the image corresponds to a point in the Hough space.[[3]]
In a convolution based technique, the line detector operator consists of a convolution masks tuned to detect the presence of lines of a particular width n and a θ orientation. The mask shown below can be used to detect lines at various orientations
a) Horizontal mask(R1)
-1 | -1 | -1 |
2 | 2 | 2 |
-1 | -1 | -1 |
(b) Vertical (R3)
-1 | 2 | -1 |
-1 | 2 | -1 |
-1 | 2 | -1 |
(C) Oblique (+45 degrees)(R2)
-1 | -1 | 2 |
-1 | 2 | -1 |
2 | -1 | -1 |
(d) Oblique (-45 degrees)(R4)
2 | -1 | -1 |
-1 | 2 | -1 |
-1 | -1 | 2 |
in practice, masks are run over the the image and the responses are combine given by the following equation:
R(x, y) = max(|R1 (x, y)|, |R2 (x, y)|, |R3 (x, y)|, |R4 (x, y)|)
If R(x, y) > T, then discontinuity
Example:
Horizontal line | convolved image | |||||||||||
0 | 0 | 0 | 0 | - | - | - | - | |||||
1 | 1 | 1 | 1 | = | - | 6 | 6 | - | ||||
Mask | * | 0 | 0 | 0 | 0 | - | - | - | - | |||
-1 | -1 | -1 | ||||||||||
2 | 2 | 2 | ||||||||||
-1 | -1 | -1 | ||||||||||
* | Vertical line | convolved image | ||||||||||
0 | 0 | 1 | 0 | - | - | - | - | |||||
0 | 0 | 1 | 0 | = | - | 0 | 0 | - | ||||
0 | 0 | 1 | 0 | - | - | - | - |
These masks above are tuned for light lines against a dark background, and would give a big negative response to dark lines against a light background.[4]
Example:
- ^ a b E., Umbaugh, Scott (2011). Digital image processing and analysis : human and computer vision applications with CVIPtools. Umbaugh, Scott E. (2nd ed ed.). Boca Raton, FL: CRC Press. ISBN 9781439802052. OCLC 491888664.
{{cite book}}
:|edition=
has extra text (help)CS1 maint: multiple names: authors list (link) - ^ "Hough transform - MATLAB hough". www.mathworks.com. Retrieved 2018-04-23.
- ^ http://vision.stanford.edu/teaching/cs231a_autumn1112/lecture/lecture4_edges_lines_cs231a_marked.pdf
- ^ a b "Line Detection". homepages.inf.ed.ac.uk. Retrieved 2018-04-23.