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

Node and Auth0 - Integration

 so now we have completed all the steps for integration  since we have the node and auth0 as two separate things the integration happens in the app.js  we need to modify the app.js with some auth0 code  app.js / const http = require('http'); const express = require('express'); var router = require('express').Router(); const { auth } = require('express-openid-connect'); const app = express(); app.use('/', router); const hostname = '127.0.0.1'; const port = 3000; http.createServer(app)   .listen(port, () => {     console.log(`Listening on `);   }); const config = {   authRequired: false,   auth0Logout: true,   secret: 'a long, randomly-generated string stored in env',   baseURL: 'http://localhost:3000',   clientID: 'QxpAXsXkzy0Vm2VdT6dFFS0VOKdrah67',   issuerBaseURL: 'https://dev-bnga041p.us.auth0.com' }; console.log(config) // auth router attaches /login, /logout, and /callback routes to the baseURL app.u

Auth0

You might be wondering what is this auth0  it is used for authentication of you applications  could be any apps  1.SPA - Angular , React  2.web app 3.Node  here we will talk about the node use case and go with example  moving ahead for now  if your are not familiar with node dont worry its a funny exercise for now walk with me  we dont have to worry too much for authentication as the service is  provided from auth0   create your node app  install node  https://nodejs.org/en/download/package-manager/  choose your os and do the installation once installed check for the version ' node -v  ' i assume u have installed so that u wil get the version for now  since iam using LINUX this will look like root@strings-desktop:/home/strings/js# node -v v16.13.0 moving on to creating node app for now    create a file app.js and paste the contents  app.js/ const http = require('http'); const express = require('express'); const app = express(); const hostname = '127.0.0.1&#