Line Detection
-
Upload
upekha-vandebona -
Category
Education
-
view
209 -
download
1
Transcript of Line Detection
![Page 1: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/1.jpg)
Individual Assignment
11. Line Detection of an Image
MCS3108 – IMAGE
PROCESSING AND
VISION
U. V Vandebona13440722
![Page 2: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/2.jpg)
Tools and Techniques Used
Java
OpenCV
HoughLinesP Function
Canny Operation
Gaussian Smoothing
![Page 3: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/3.jpg)
Hough Line Transform
It is a transformation technique used to
detect straight lines.
To apply the Transform, first an edge
detection pre-processing is desirable.
![Page 4: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/4.jpg)
Line in an Image expressed as…
Cartesian coordinate system
Polar coordinate system
y = mx +
c
For Hough Transforms, we will express lines in the Polar system
![Page 5: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/5.jpg)
How it Works
θ
r
x
y
Arranging the terms:
![Page 6: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/6.jpg)
How it Works…
In general, for each point (x0, y0) , we can define the family of lines that goes through that point as:
Meaning that each pair (rθ,θ ) represents each line that passes by (x0, y0)
![Page 7: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/7.jpg)
How it Works…
If for a given (x0, y0) we plot the family of lines that goes through it, we get a sine wave.
For instance, for x0 = 8 and y0 = 6 and we get the following plot (in a plane coordinates with θ and r)
We consider only points such that
r > 0 and 0 < θ < 2π
![Page 8: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/8.jpg)
How it Works…
We can do the same operation above for all the
points in an image.
If the curves of two different points intersect in the
plane coordinates with θ and r, that means that
both points belong to a same line.
For instance, following with the example above and
drawing the plot for two more points: x1 = 9, y1 =
4 and x2 = 12, y2 = 3, we get:
![Page 9: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/9.jpg)
The three plots intersect in one single point (0.925, 9.6), these coordinates are the parameters ( θ, r) or the line in which (x0, y0) , (x1, y1) and (x2, y2) lay.
![Page 10: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/10.jpg)
So it means…
A line can be detected by finding the number of
intersections between curves.
The more curves intersecting means that the line
represented by that intersection have more
points.
In general, we can define a threshold of the
minimum number of intersections needed
to detect a line.
![Page 11: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/11.jpg)
Hough Line Transform
It keeps track of the intersection between
curves of every point in the image.
If the number of intersections is above
some threshold, then it declares it as a line
with the parameters ( θ, rθ) of the
intersection point.
![Page 12: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/12.jpg)
Application
1. Loads an image
2. (Optional) Convert to grayscale
3. (Optional) Blur Image
Gaussian Smoothening
4. Edge Detection
Canny Operation
5. Line Detection
Hough Line Transformation
![Page 13: Line Detection](https://reader030.fdocuments.net/reader030/viewer/2022032716/55b3c93ebb61ebc0548b477e/html5/thumbnails/13.jpg)
Application