black out everything outside the 2 lines
I perform the hough transform on image to detect lines. but I want to blackout everything outside the 2 lines... i get this kind of output
but i want this type of output..
i used this code..
vector<Vec2f> lines;
HoughLines(dst, lines, 1, 2*CV_PI/180, 70, 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 = a*rho, y0 = b*rho;
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( src, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
}
any suggestion..
Keep track of the min/max x values. Then black everything less than min_x and vice-versa for max_x ?
this will blackout everything except lines, but i want SAMPLE kind of display as shown..
No, if you do if(x < min_x || x > max_x) mark as black, then it will produce the sample above.