【发布时间】:2015-04-23 19:30:43
【问题描述】:
我目前正在使用霍夫变换来获得直线。但是检测到很多行。我可以知道如何过滤并仅从输出中获取最长的行吗?
HoughLinesP(dst, lines, 1, CV_PI/180, 50, 20, 10 ); //left lane
for( size_t i = 0; i < lines.size(); i++ )
{
Vec4i l = lines[i];
double theta1,theta2, hyp, result;
theta1 = (l[3]-l[1]);
theta2 = (l[2]-l[0]);
hyp = hypot(theta1,theta2);
line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(255,0,0), 3, CV_AA);
}
imshow("detected lines", cdst);
}
【问题讨论】:
标签: c++ opencv filter lines hough-transform