# Finding segment length

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

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?

edit retag close merge delete

find a maths book, and look into it.

( 2018-07-08 20:45:59 -0500 )edit

I think you did not understand the question :/

( 2018-07-09 04:07:00 -0500 )edit

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

( 2018-07-09 04:10:53 -0500 )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.

( 2018-07-09 04:22:10 -0500 )edit

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

( 2018-07-09 04:26:54 -0500 )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?

( 2018-07-09 04:35:19 -0500 )edit

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

( 2018-07-10 04:02:13 -0500 )edit