Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

really, this is not so much an opencv problem, but a maths one ..

houghlinesP already gives you the endpoints of the line,

Vec4i line = lines[i];
Point a(line[0], line[1]);
Point b(line[2], line[3]);

so

  • the slope is dy/dx , or

    float(b.y - a-y) / float(b.x - a-x);

  • the length is the euclidean distance, or:

    norm(a,b);

no idea, what you mean with the distance, try to explain ?

really, this is not so much an opencv problem, but a maths one ..

houghlinesP already gives you the endpoints of the line,

Vec4i line = lines[i];
Point a(line[0], line[1]);
Point b(line[2], line[3]);

so

  • the slope is dy/dx , or

    float(b.y - a-y) a.y) / float(b.x - a-x);a.x);

  • the length is the euclidean distance, or:

    norm(a,b);

no idea, what you mean with the distance, try to explain ?

really, this is not so much an opencv problem, but a maths one ..

houghlinesP already gives you the endpoints of the line,

Vec4i line = lines[i];
Point a(line[0], line[1]);
Point b(line[2], line[3]);

so

  • the slope is dy/dx , or

    float(b.y - a.y) / float(b.x - a.x);

  • the length is the euclidean distance, or:

    norm(a,b);

no idea, what you mean with the distance, try to explain ?