35 #include <Base/Common/W32Compat.hh>
40 #include <Base/Debug/Error.hh>
41 #include <Base/Image/Image.hh>
42 #include <Base/Image/ImageIO.hh>
43 #include <Base/Common/FileHandling.hh>
44 #include <FeatureDetector/CheckerboardDetector.hh>
49 int main(
int argc,
char** argv)
52 string imgFilename(BIAS_TESTS_DATA
"chess7x4_002.jpg");
53 unsigned int xCorners(7), yCorners(4);
57 imgFilename = argv[1];
59 xCorners = atoi(argv[2]);
61 yCorners = atoi(argv[3]);
64 cout <<
"Usage: ExampleCheckerboard [<image>] [<corners x>] [<corners y>]"
66 <<
"Default: image " << imgFilename <<
" with 7 x 4 corners"
69 cout <<
"Detecting " << xCorners <<
"x " << yCorners <<
" corners in image "
70 << imgFilename << endl << endl;
72 cout <<
"Loading image " << imgFilename << endl;
74 if (ImageIO::Load(imgFilename, img)!=0)
76 cout <<
"Failed to load image " << imgFilename <<
"!" << endl;
81 vector< pair<float,float> > coords;
84 int result = CheckerboardDetector::Compute(img, xCorners , yCorners, coords,
true);
86 cout <<
"Failed to detect corners!" << endl;
91 cout <<
"Detected " << coords.size() <<
" corners : " << endl;
92 for (
unsigned int i = 0; i < coords.size(); i++) {
93 cout <<
"[" << (i+1) <<
"] corner " << coords[i].first <<
", " << coords[i].second