Skip to main content

Hough Transform - Introduction


 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: (m,b).

Polar coordinate system: Parameters: (r,ΞΈ) (r,ΞΈ)

 

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,3

for  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

Popular posts from this blog

SHA-256 initial values

The simple workout to arrive at the initial values for sha-256 The first 32 bit of the fractional part of the sqroot (first 8 prime number 2-19) Alright what does it say  Sqrroot(prime)- Let’s say the first prime is 2 Sqroot(2)  = 1.414213562373095 Convert to hexadecimal- Since we are worried about the fractional part alone Converting the fractional part would be easy Fractional part- 0.414213562373095 Multiply the fractional part with 16 to arrive at hex 0.414213562373095*16= 6.62741699796952 0.62741699796952*16= 10.03867196751232 0.03867196751232*16=0.61875148019712 0.61875148019712*16=9.90002368315392 0.90002368315392*16=14.40037893046272 0.40037893046272*16=6.40606288740352 0.40606288740352*16=6.49700619845632 0.49700619845632*16=7.95209917530112 Resulting hexadecimal would be 6a09e667 which is  h0 := 0x6a09e667 Iam going to stop at the 8th iteration , why is that ? Since we are interested in 32 bit (8*4=32) Alright to make it clear  Convert hexade...

Linear Regression with one variable - Introduction

 It is not but making a some how clear relationship among variables the dependent and independent variables. talking in terms of maths the equation can be used meaningfully for something may be to determine /predict values from data. if y = m * x + b  the values for m , b can be anything but has to appropriate to predict y  so the loss which is  difference from existing to prediction is close to zero ~0 to start with we can say the one variable as -x  in some scenario m , b are called variables    the equation stated about is a line equation we have any equation  y = 2*x  y = x*x y = 2x +2x*x  so why the need of all these equations , it is all about playing data now a days in machine learning problems we create a data sets , lets consider as x  y to be a value of x the datas . y = datas  when we express the data as a function and plot in the graph we get the curves  take some random data x and plot x and y  x =1 , 2, ...