直线检测

 



void Hough_1(int, void*)
{
vector<Vec4i> vec_lines;
HoughLinesP(img_canny1, vec_lines, 1, CV_PI / 360.0, hough_thread,1,50);
for (size_t k = 0; k<vec_lines.size(); k++)
{
Vec4i line_1 = vec_lines[k];
double line_length = sqrt((line_1[2] - line_1[0])*(line_1[2] - line_1[0]) +(line_1[3]- line_1[1])*(line_1[3] - line_1[1]));

if (line_length<50.0|| line_length>560.0)
{
continue;
}

line(img5, Point(line_1[0], line_1[1]), Point(line_1[2], line_1[3]), Scalar(0, 0, 255), 2, 8, 0);

}
imshow(win3, img5);
}


 

 

检测直线_直线检测

 

 

##############################