An example using the Hough line detector
Sample input image
Output image
int main(int argc, char** argv)
{
const char* default_file = "sudoku.png";
const char* filename = argc >=2 ? argv[1] : default_file;
printf(" Error opening image\n");
printf(" Program Arguments: [image_name -- default %s] \n", default_file);
return -1;
}
Canny(src, dst, 50, 200, 3);
vector<Vec2f> lines;
for( size_t i = 0; i < lines.size(); i++ )
{
float rho = lines[i][0], theta = lines[i][1];
double a =
cos(theta), b =
sin(theta);
double x0 = a*rho, y0 = b*rho;
}
vector<Vec4i> linesP;
for( size_t i = 0; i < linesP.size(); i++ )
{
}
imshow(
"Detected Lines (in red) - Standard Hough Line Transform", cdst);
imshow(
"Detected Lines (in red) - Probabilistic Line Transform", cdstP);
return 0;
}