Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

line detection within a plain geometry figure

What I want to achieve from the given following image triangle

  1. the coordinates of point A, B, C and D making point A the origin.
  2. the fact there is lineAB, AC, BC and AD.
  3. the fact point D is on lineAB

The point id is not important as long as it can detect there are points at these locations and there are lines between them. Would OpenCV help me to achieve that? If so, would you please be a little more specific?

Thanks very much.

like image 606
user1935724 Avatar asked Jan 17 '26 21:01

user1935724


1 Answers

As joe said hough transform will help you,i know openCV will help u but i've never used it before,here's a simple Matlab code i wrote to extract lines and coordinate of points.

f=imread("your image without piont ID"); 
f=rgb2gray(f);              
fb=im2bw(f,graythresh(f));  

[H,T,R] = hough(not(fb),'RhoResolution',0.5,'Theta',-90:0.5:89.5); 
peaks=houghpeaks(H,4,'threshold',ceil(0.3*max(H(:))));      


lines = houghlines(not(fb),T,R,peaks); %this will give u start and end point of lines, Rho and tetha (x*cos(tetha)+y*sin(tetha)=Rho) now you can answer to all of your questions 

http://en.wikipedia.org/wiki/Hough_transform

like image 134
Mehrdad_OCR Avatar answered Jan 21 '26 02:01

Mehrdad_OCR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!