Skip to main content

Hough Lines

consider the image like this we need to find the lines on this image 

the basic lines would be horizontal ,vertical and inclined line 

we will try to use hough to detect using equations 

ok before that we need to understand the image co ordinate 

top left is 0,0 assume it is the third quadrant , for 

better understanding i have drawn a to show how a pixel is calculated from top left



pixel arrangement for image 


 

this is level zoom of more than 1000 , in real world u cannot see the pixel (1pixel of size 1,1) 

alright now we can need to see how to find the lines on the first image

the triangle on a zoomed in pixel wil look like this 

ok we will start with the horizontal line calculation 

since the pixel calculation is in the quadrant  i will shift or plot the values in 

the first quadrant for my calculation 

when shifted will look like this ,


for horizontal line calculation the theta of r must be at 90 degrees to the horizontal line u can see the value in diagram

r = x cos𝛳 + y sin 𝛳

calculate for [4,2] [5,2] ,[8,2 ] 

if u put random values for 𝛳 starting from  𝛳 >0 and 𝛳  <2𝞹

u could see for 𝛳 = 90

for calculation convert degrees to radians which is 0.5 *𝞹

r =  4 *cos(0.5 *𝞹) + 2 sin (0.5 *𝞹)

= 0 + 2 =2

r =  5 *cos(0.5 *𝞹) + 2 sin (0.5 *𝞹)

 = 0 + 2 =2

so it says for the  𝛳 = 90 r = 2 for these points so according to hough 

it means they lie on the same line which is in our case is the horizontal line.


moving on to the inclined line from the diagram u can see the 𝛳 = 315

so the calculation for the pixel on the slope 

[4,3] [5,4] [7,6]

 r =  4 *cos(1.75 *𝞹) + 3 sin (1.75 *𝞹)

= 0.7 

r =  7 *cos(1.75 *𝞹) + 6 sin (1.75 *𝞹)= 0.7 

so at an angle of  𝛳 = 315 and r =0.7 which is a small line as u can see in the diagram ,the line which is at right angles to this line r would be the

inclined line where the above point lie .

enjoy


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