An example using the Hough circle detector
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
static void help()
{
cout << "\nThis program demonstrates circle finding with the Hough transform.\n"
"Usage:\n"
"./houghcircles <image_name>, Default is ../data/board.jpg\n" << endl;
}
int main(int argc, char** argv)
{
"{help h ||}{@image|../data/board.jpg|}"
);
{
help();
return 0;
}
string filename = parser.
get<
string>(
"@image");
if(img.empty())
{
help();
cout << "can not open " << filename << endl;
return -1;
}
vector<Vec3f> circles;
100, 30, 1, 30
);
for( size_t i = 0; i < circles.size(); i++ )
{
}
imshow(
"detected circles", img);
return 0;
}