So what is hough lines or the transform ,
Hough Line Transform is a transform used to detect straight lines.
consider a image where u need to find the lines straight lines ,could be horizontal , vertical , diagonal lines in the image u can do that via the hough transform
before that there is something called
Cartesian coordinate system: Parameters:
Polar coordinate system: Parameters:
if the line equation is y = m * x +b in the cartesian
x, y
in the polar it is
x = r cos(π³)
y = r sin(π³) .
we will see about this in detail
from the diagram u can see the inclined line and π³ are related as
x = r cos(π³) , the adjacent side of π³
y = r sin(π³), the opposite side of π³
' r ' the distance from the origin the reference point to the line which
hits the line at 90 degrees
ok so by Pythagoras
r = sqrt ( x ^2 + y^2)
substitute for x and y
r = sqrt (r^2 *x^2 cos^2π³ + r^2 * y^2sin^2π³)
cos^2π³ + ^sin^2π³ = 1
r = r
ok what we have proved is the value of x and y is correct moving forward
u will not get this satisfying until u play with a use case ,
the use case would be a image .we will see and example with an image for the
implementation .
consider a point x, y (4, 3) this is the cartesian system
we will transform this point into something in terms of (r(π³ ) ,π³)
stay with me for now
rπ³ = x cos π³ +y sinπ³ it means for the value of x,y
we need to find r ,so what is ' π³ ' it could be any value π³ >0 and π³ <2πΉ
for x ,y [4, 3]
plot values of π³ and r
from the diagram u can see the family of lines that pass through x ,y which is 4,3for now i have take only 2 lines the π³ =50 and r 50
π³ =10 and r10
if you plot this as a graph of π³ and r
u might wonder what is the use of this curve ,we will see with two point
examples and the intersection of these curves will give us results for line computation.
reference -
https://docs.opencv.org/3.4/d9/db0/tutorial_hough_lines.html
Comments
Post a Comment