Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to find coordinates of intersection of lines after using "houghlines"

Hello dears, image description

As you can see,i would like to find the coordinates of lines,but unfortunately i could not do it. i used this code for drawing the lines:

Canny(result , can , 50 , 200 , 3); imshow("can",can); vector<vec2f> lines; HoughLines(can,lines ,1,CV_PI/180,75,0,0); for( size_t i = 0; i < lines.size(); i++ )
{
float rho = lines[i][0], theta = lines[i][1];
Point pt1, pt2;
double a = cos(theta), b = sin(theta);
double x0 = arho, y0 = brho;
pt1.x = cvRound(x0 + 1000(-b));
pt1.y = cvRound(y0 + 1000
(a));
pt2.x = cvRound(x0 - 1000(-b));
pt2.y = cvRound(y0 - 1000
(a));
line( can, pt1, pt2, Scalar(255), 2, CV_AA); } cvtColor(can,can,CV_GRAY2RGB); imshow("cdst",can); in continue, i do not know how i can find the coordinate.Please help me,thank you.

Best, Arash

click to hide/show revision 2
No.2 Revision

how to find coordinates of intersection of lines after using "houghlines"

Hello dears, dears,

image description

As you can see,i would like to find the coordinates of lines,but unfortunately i could not do it. i used this code for drawing the lines:

Canny(result , can , 50 , 200 , 3);
 imshow("can",can);
 vector<vec2f> vector<Vec2f> lines;
 HoughLines(can,lines ,1,CV_PI/180,75,0,0);
  for( size_t i = 0; i < lines.size(); i++ ) 
{
float rho = lines[i][0], theta = lines[i][1];
Point pt1, pt2;
double a = cos(theta), b = sin(theta);
double x0 = arho, a*rho, y0 = brho;
b*rho; pt1.x = cvRound(x0 + 1000(-b));
1000*(-b)); pt1.y = cvRound(y0 + 1000(a));
1000*(a)); pt2.x = cvRound(x0 - 1000(-b));
1000*(-b)); pt2.y = cvRound(y0 - 1000(a));
1000*(a)); line( can, pt1, pt2, Scalar(255), 2, CV_AA); } cvtColor(can,can,CV_GRAY2RGB); imshow("cdst",can);

in continue, i do not know how i can find the coordinate.Please help me,thank you.

Best, Arash