Finding segment length

asked 2018-07-08 13:44:54 -0600

Hi all, I am new in the use of OpenCV. I have the following benchmark case to solve: image description

I need the complete definition of the three segments. With HoughLines() I am able to obtain the lines equations, but not the length of the segments. Is it any way to obtain the complete definition of those segments? Perhaps the starting and final points?

Thanks in advance

edit retag flag offensive close merge delete

Comments

find a maths book, and look into it.

berak gravatar imageberak ( 2018-07-08 20:45:59 -0600 )edit

I think you did not understand the question :/

Kikolo3000 gravatar imageKikolo3000 ( 2018-07-09 04:07:00 -0600 )edit

is it really so difficult, to find the formula for line-intersection on the internet ?

berak gravatar imageberak ( 2018-07-09 04:10:53 -0600 )edit

Yep, I was right, you didn't get the point of the question. Probabbly it was my mistake because I haven't explained properly. My appologizes.

I am not interested in the intersections, but in the coordinates of the starting and the end point of the three segments. Note that the three segments extend beyond the intersections!

A segment is a finite portion of a line. I want to locate the three segments, not only the line containg them.

Kikolo3000 gravatar imageKikolo3000 ( 2018-07-09 04:22:10 -0600 )edit

houghlines returns infinite lines (maybe you wanted HoughLinesP() ?)

berak gravatar imageberak ( 2018-07-09 04:26:54 -0600 )edit

"Segment" is a "portion" (finite) of a line. I trieded HoughLinesP(), but it returns several small line portions (segments), instead of the complete line. Perhaps it is a matter of properly setting the parameters of the function?

Kikolo3000 gravatar imageKikolo3000 ( 2018-07-09 04:35:19 -0600 )edit

Accumulate those segments using 2 constraints ( parallelism & distance) OR Collinearity you'll get complete segments. Then use simple Euclidean distance formula ...

Ziri gravatar imageZiri ( 2018-07-10 04:02:13 -0600 )edit