Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/calib3d/test/test_chesscorners.cpp
16337 views
1
/*M///////////////////////////////////////////////////////////////////////////////////////
2
//
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
//
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
8
//
9
//
10
// Intel License Agreement
11
// For Open Source Computer Vision Library
12
//
13
// Copyright (C) 2000, Intel Corporation, all rights reserved.
14
// Third party copyrights are property of their respective owners.
15
//
16
// Redistribution and use in source and binary forms, with or without modification,
17
// are permitted provided that the following conditions are met:
18
//
19
// * Redistribution's of source code must retain the above copyright notice,
20
// this list of conditions and the following disclaimer.
21
//
22
// * Redistribution's in binary form must reproduce the above copyright notice,
23
// this list of conditions and the following disclaimer in the documentation
24
// and/or other materials provided with the distribution.
25
//
26
// * The name of Intel Corporation may not be used to endorse or promote products
27
// derived from this software without specific prior written permission.
28
//
29
// This software is provided by the copyright holders and contributors "as is" and
30
// any express or implied warranties, including, but not limited to, the implied
31
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32
// In no event shall the Intel Corporation or contributors be liable for any direct,
33
// indirect, incidental, special, exemplary, or consequential damages
34
// (including, but not limited to, procurement of substitute goods or services;
35
// loss of use, data, or profits; or business interruption) however caused
36
// and on any theory of liability, whether in contract, strict liability,
37
// or tort (including negligence or otherwise) arising in any way out of
38
// the use of this software, even if advised of the possibility of such damage.
39
//
40
//M*/
41
42
#include "test_precomp.hpp"
43
#include "test_chessboardgenerator.hpp"
44
45
#include <functional>
46
47
namespace opencv_test { namespace {
48
49
#define _L2_ERR
50
51
//#define DEBUG_CHESSBOARD
52
53
#ifdef DEBUG_CHESSBOARD
54
void show_points( const Mat& gray, const Mat& expected, const vector<Point2f>& actual, bool was_found )
55
{
56
Mat rgb( gray.size(), CV_8U);
57
merge(vector<Mat>(3, gray), rgb);
58
59
for(size_t i = 0; i < actual.size(); i++ )
60
circle( rgb, actual[i], 5, Scalar(0, 0, 200), 1, LINE_AA);
61
62
if( !expected.empty() )
63
{
64
const Point2f* u_data = expected.ptr<Point2f>();
65
size_t count = expected.cols * expected.rows;
66
for(size_t i = 0; i < count; i++ )
67
circle(rgb, u_data[i], 4, Scalar(0, 240, 0), 1, LINE_AA);
68
}
69
putText(rgb, was_found ? "FOUND !!!" : "NOT FOUND", Point(5, 20), FONT_HERSHEY_PLAIN, 1, Scalar(0, 240, 0));
70
imshow( "test", rgb ); while ((uchar)waitKey(0) != 'q') {};
71
}
72
#else
73
#define show_points(...)
74
#endif
75
76
enum Pattern { CHESSBOARD,CHESSBOARD_SB,CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID};
77
78
class CV_ChessboardDetectorTest : public cvtest::BaseTest
79
{
80
public:
81
CV_ChessboardDetectorTest( Pattern pattern, int algorithmFlags = 0 );
82
protected:
83
void run(int);
84
void run_batch(const string& filename);
85
bool checkByGenerator();
86
bool checkByGeneratorHighAccuracy();
87
88
// wraps calls based on the given pattern
89
bool findChessboardCornersWrapper(InputArray image, Size patternSize, OutputArray corners,int flags);
90
91
Pattern pattern;
92
int algorithmFlags;
93
};
94
95
CV_ChessboardDetectorTest::CV_ChessboardDetectorTest( Pattern _pattern, int _algorithmFlags )
96
{
97
pattern = _pattern;
98
algorithmFlags = _algorithmFlags;
99
}
100
101
double calcError(const vector<Point2f>& v, const Mat& u)
102
{
103
int count_exp = u.cols * u.rows;
104
const Point2f* u_data = u.ptr<Point2f>();
105
106
double err = std::numeric_limits<double>::max();
107
for( int k = 0; k < 2; ++k )
108
{
109
double err1 = 0;
110
for( int j = 0; j < count_exp; ++j )
111
{
112
int j1 = k == 0 ? j : count_exp - j - 1;
113
double dx = fabs( v[j].x - u_data[j1].x );
114
double dy = fabs( v[j].y - u_data[j1].y );
115
116
#if defined(_L2_ERR)
117
err1 += dx*dx + dy*dy;
118
#else
119
dx = MAX( dx, dy );
120
if( dx > err1 )
121
err1 = dx;
122
#endif //_L2_ERR
123
//printf("dx = %f\n", dx);
124
}
125
//printf("\n");
126
err = min(err, err1);
127
}
128
129
#if defined(_L2_ERR)
130
err = sqrt(err/count_exp);
131
#endif //_L2_ERR
132
133
return err;
134
}
135
136
const double rough_success_error_level = 2.5;
137
const double precise_success_error_level = 2;
138
139
140
/* ///////////////////// chess_corner_test ///////////////////////// */
141
void CV_ChessboardDetectorTest::run( int /*start_from */)
142
{
143
ts->set_failed_test_info( cvtest::TS::OK );
144
145
/*if (!checkByGenerator())
146
return;*/
147
switch( pattern )
148
{
149
case CHESSBOARD_SB:
150
checkByGeneratorHighAccuracy(); // not supported by CHESSBOARD
151
/* fallthrough */
152
case CHESSBOARD:
153
checkByGenerator();
154
if (ts->get_err_code() != cvtest::TS::OK)
155
{
156
break;
157
}
158
159
run_batch("negative_list.dat");
160
if (ts->get_err_code() != cvtest::TS::OK)
161
{
162
break;
163
}
164
165
run_batch("chessboard_list.dat");
166
if (ts->get_err_code() != cvtest::TS::OK)
167
{
168
break;
169
}
170
171
run_batch("chessboard_list_subpixel.dat");
172
break;
173
case CIRCLES_GRID:
174
run_batch("circles_list.dat");
175
break;
176
case ASYMMETRIC_CIRCLES_GRID:
177
run_batch("acircles_list.dat");
178
break;
179
}
180
}
181
182
void CV_ChessboardDetectorTest::run_batch( const string& filename )
183
{
184
ts->printf(cvtest::TS::LOG, "\nRunning batch %s\n", filename.c_str());
185
//#define WRITE_POINTS 1
186
#ifndef WRITE_POINTS
187
double max_rough_error = 0, max_precise_error = 0;
188
#endif
189
string folder;
190
switch( pattern )
191
{
192
case CHESSBOARD:
193
case CHESSBOARD_SB:
194
folder = string(ts->get_data_path()) + "cv/cameracalibration/";
195
break;
196
case CIRCLES_GRID:
197
folder = string(ts->get_data_path()) + "cv/cameracalibration/circles/";
198
break;
199
case ASYMMETRIC_CIRCLES_GRID:
200
folder = string(ts->get_data_path()) + "cv/cameracalibration/asymmetric_circles/";
201
break;
202
}
203
204
FileStorage fs( folder + filename, FileStorage::READ );
205
FileNode board_list = fs["boards"];
206
207
if( !fs.isOpened() || board_list.empty() || !board_list.isSeq() || board_list.size() % 2 != 0 )
208
{
209
ts->printf( cvtest::TS::LOG, "%s can not be read or is not valid\n", (folder + filename).c_str() );
210
ts->printf( cvtest::TS::LOG, "fs.isOpened=%d, board_list.empty=%d, board_list.isSeq=%d,board_list.size()%2=%d\n",
211
fs.isOpened(), (int)board_list.empty(), board_list.isSeq(), board_list.size()%2);
212
ts->set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA );
213
return;
214
}
215
216
int progress = 0;
217
int max_idx = (int)board_list.size()/2;
218
double sum_error = 0.0;
219
int count = 0;
220
221
for(int idx = 0; idx < max_idx; ++idx )
222
{
223
ts->update_context( this, idx, true );
224
225
/* read the image */
226
String img_file = board_list[idx * 2];
227
Mat gray = imread( folder + img_file, 0);
228
229
if( gray.empty() )
230
{
231
ts->printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", img_file.c_str() );
232
ts->set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA );
233
return;
234
}
235
236
String _filename = folder + (String)board_list[idx * 2 + 1];
237
bool doesContatinChessboard;
238
Mat expected;
239
{
240
FileStorage fs1(_filename, FileStorage::READ);
241
fs1["corners"] >> expected;
242
fs1["isFound"] >> doesContatinChessboard;
243
fs1.release();
244
}
245
size_t count_exp = static_cast<size_t>(expected.cols * expected.rows);
246
Size pattern_size = expected.size();
247
248
vector<Point2f> v;
249
int flags = 0;
250
switch( pattern )
251
{
252
case CHESSBOARD:
253
flags = CALIB_CB_ADAPTIVE_THRESH | CALIB_CB_NORMALIZE_IMAGE;
254
break;
255
case CIRCLES_GRID:
256
case CHESSBOARD_SB:
257
case ASYMMETRIC_CIRCLES_GRID:
258
default:
259
flags = 0;
260
}
261
bool result = findChessboardCornersWrapper(gray, pattern_size,v,flags);
262
if(result ^ doesContatinChessboard || (doesContatinChessboard && v.size() != count_exp))
263
{
264
ts->printf( cvtest::TS::LOG, "chessboard is detected incorrectly in %s\n", img_file.c_str() );
265
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
266
show_points( gray, expected, v, result );
267
return;
268
}
269
270
if( result )
271
{
272
273
#ifndef WRITE_POINTS
274
double err = calcError(v, expected);
275
max_rough_error = MAX( max_rough_error, err );
276
#endif
277
if( pattern == CHESSBOARD )
278
cornerSubPix( gray, v, Size(5, 5), Size(-1,-1), TermCriteria(TermCriteria::EPS|TermCriteria::MAX_ITER, 30, 0.1));
279
//find4QuadCornerSubpix(gray, v, Size(5, 5));
280
show_points( gray, expected, v, result );
281
#ifndef WRITE_POINTS
282
// printf("called find4QuadCornerSubpix\n");
283
err = calcError(v, expected);
284
sum_error += err;
285
count++;
286
if( err > precise_success_error_level )
287
{
288
ts->printf( cvtest::TS::LOG, "Image %s: bad accuracy of adjusted corners %f\n", img_file.c_str(), err );
289
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
290
return;
291
}
292
ts->printf(cvtest::TS::LOG, "Error on %s is %f\n", img_file.c_str(), err);
293
max_precise_error = MAX( max_precise_error, err );
294
#endif
295
}
296
else
297
{
298
show_points( gray, Mat(), v, result );
299
}
300
301
#ifdef WRITE_POINTS
302
Mat mat_v(pattern_size, CV_32FC2, (void*)&v[0]);
303
FileStorage fs(_filename, FileStorage::WRITE);
304
fs << "isFound" << result;
305
fs << "corners" << mat_v;
306
fs.release();
307
#endif
308
progress = update_progress( progress, idx, max_idx, 0 );
309
}
310
311
if (count != 0)
312
sum_error /= count;
313
ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
314
}
315
316
double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)
317
{
318
Mat m1(cornSz, CV_32FC2, (Point2f*)&corners_generated[0]);
319
Mat m2; flip(m1, m2, 0);
320
321
Mat m3; flip(m1, m3, 1); m3 = m3.t(); flip(m3, m3, 1);
322
323
Mat m4 = m1.t(); flip(m4, m4, 1);
324
325
double min1 = min(calcError(corners_found, m1), calcError(corners_found, m2));
326
double min2 = min(calcError(corners_found, m3), calcError(corners_found, m4));
327
return min(min1, min2);
328
}
329
330
bool validateData(const ChessBoardGenerator& cbg, const Size& imgSz,
331
const vector<Point2f>& corners_generated)
332
{
333
Size cornersSize = cbg.cornersSize();
334
Mat_<Point2f> mat(cornersSize.height, cornersSize.width, (Point2f*)&corners_generated[0]);
335
336
double minNeibDist = std::numeric_limits<double>::max();
337
double tmp = 0;
338
for(int i = 1; i < mat.rows - 2; ++i)
339
for(int j = 1; j < mat.cols - 2; ++j)
340
{
341
const Point2f& cur = mat(i, j);
342
343
tmp = cv::norm(cur - mat(i + 1, j + 1)); // TODO cvtest
344
if (tmp < minNeibDist)
345
minNeibDist = tmp;
346
347
tmp = cv::norm(cur - mat(i - 1, j + 1)); // TODO cvtest
348
if (tmp < minNeibDist)
349
minNeibDist = tmp;
350
351
tmp = cv::norm(cur - mat(i + 1, j - 1)); // TODO cvtest
352
if (tmp < minNeibDist)
353
minNeibDist = tmp;
354
355
tmp = cv::norm(cur - mat(i - 1, j - 1)); // TODO cvtest
356
if (tmp < minNeibDist)
357
minNeibDist = tmp;
358
}
359
360
const double threshold = 0.25;
361
double cbsize = (max(cornersSize.width, cornersSize.height) + 1) * minNeibDist;
362
int imgsize = min(imgSz.height, imgSz.width);
363
return imgsize * threshold < cbsize;
364
}
365
366
bool CV_ChessboardDetectorTest::findChessboardCornersWrapper(InputArray image, Size patternSize, OutputArray corners,int flags)
367
{
368
switch(pattern)
369
{
370
case CHESSBOARD:
371
return findChessboardCorners(image,patternSize,corners,flags);
372
case CHESSBOARD_SB:
373
// check default settings until flags have been specified
374
return findChessboardCornersSB(image,patternSize,corners,0);
375
case ASYMMETRIC_CIRCLES_GRID:
376
flags |= CALIB_CB_ASYMMETRIC_GRID | algorithmFlags;
377
return findCirclesGrid(image, patternSize,corners,flags);
378
case CIRCLES_GRID:
379
flags |= CALIB_CB_SYMMETRIC_GRID;
380
return findCirclesGrid(image, patternSize,corners,flags);
381
default:
382
ts->printf( cvtest::TS::LOG, "Internal Error: unsupported chessboard pattern" );
383
ts->set_failed_test_info( cvtest::TS::FAIL_GENERIC);
384
}
385
return false;
386
}
387
388
bool CV_ChessboardDetectorTest::checkByGenerator()
389
{
390
bool res = true;
391
392
//theRNG() = 0x58e6e895b9913160;
393
//cv::DefaultRngAuto dra;
394
//theRNG() = *ts->get_rng();
395
396
Mat bg(Size(800, 600), CV_8UC3, Scalar::all(255));
397
randu(bg, Scalar::all(0), Scalar::all(255));
398
GaussianBlur(bg, bg, Size(7,7), 3.0);
399
400
Mat_<float> camMat(3, 3);
401
camMat << 300.f, 0.f, bg.cols/2.f, 0, 300.f, bg.rows/2.f, 0.f, 0.f, 1.f;
402
403
Mat_<float> distCoeffs(1, 5);
404
distCoeffs << 1.2f, 0.2f, 0.f, 0.f, 0.f;
405
406
const Size sizes[] = { Size(6, 6), Size(8, 6), Size(11, 12), Size(5, 4) };
407
const size_t sizes_num = sizeof(sizes)/sizeof(sizes[0]);
408
const int test_num = 16;
409
int progress = 0;
410
for(int i = 0; i < test_num; ++i)
411
{
412
SCOPED_TRACE(cv::format("test_num=%d", test_num));
413
414
progress = update_progress( progress, i, test_num, 0 );
415
ChessBoardGenerator cbg(sizes[i % sizes_num]);
416
417
vector<Point2f> corners_generated;
418
419
Mat cb = cbg(bg, camMat, distCoeffs, corners_generated);
420
421
if(!validateData(cbg, cb.size(), corners_generated))
422
{
423
ts->printf( cvtest::TS::LOG, "Chess board skipped - too small" );
424
continue;
425
}
426
427
/*cb = cb * 0.8 + Scalar::all(30);
428
GaussianBlur(cb, cb, Size(3, 3), 0.8); */
429
//cv::addWeighted(cb, 0.8, bg, 0.2, 20, cb);
430
//cv::namedWindow("CB"); cv::imshow("CB", cb); cv::waitKey();
431
432
vector<Point2f> corners_found;
433
int flags = i % 8; // need to check branches for all flags
434
bool found = findChessboardCornersWrapper(cb, cbg.cornersSize(), corners_found, flags);
435
if (!found)
436
{
437
ts->printf( cvtest::TS::LOG, "Chess board corners not found\n" );
438
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
439
res = false;
440
return res;
441
}
442
443
double err = calcErrorMinError(cbg.cornersSize(), corners_found, corners_generated);
444
EXPECT_LE(err, rough_success_error_level) << "bad accuracy of corner guesses";
445
#if 0
446
if (err >= rough_success_error_level)
447
{
448
imshow("cb", cb);
449
Mat cb_corners = cb.clone();
450
cv::drawChessboardCorners(cb_corners, cbg.cornersSize(), Mat(corners_found), found);
451
imshow("corners", cb_corners);
452
waitKey(0);
453
}
454
#endif
455
}
456
457
/* ***** negative ***** */
458
{
459
vector<Point2f> corners_found;
460
bool found = findChessboardCornersWrapper(bg, Size(8, 7), corners_found,0);
461
if (found)
462
res = false;
463
464
ChessBoardGenerator cbg(Size(8, 7));
465
466
vector<Point2f> cg;
467
Mat cb = cbg(bg, camMat, distCoeffs, cg);
468
469
found = findChessboardCornersWrapper(cb, Size(3, 4), corners_found,0);
470
if (found)
471
res = false;
472
473
Point2f c = std::accumulate(cg.begin(), cg.end(), Point2f(), std::plus<Point2f>()) * (1.f/cg.size());
474
475
Mat_<double> aff(2, 3);
476
aff << 1.0, 0.0, -(double)c.x, 0.0, 1.0, 0.0;
477
Mat sh;
478
warpAffine(cb, sh, aff, cb.size());
479
480
found = findChessboardCornersWrapper(sh, cbg.cornersSize(), corners_found,0);
481
if (found)
482
res = false;
483
484
vector< vector<Point> > cnts(1);
485
vector<Point>& cnt = cnts[0];
486
cnt.push_back(cg[ 0]); cnt.push_back(cg[0+2]);
487
cnt.push_back(cg[7+0]); cnt.push_back(cg[7+2]);
488
cv::drawContours(cb, cnts, -1, Scalar::all(128), FILLED);
489
490
found = findChessboardCornersWrapper(cb, cbg.cornersSize(), corners_found,0);
491
if (found)
492
res = false;
493
494
cv::drawChessboardCorners(cb, cbg.cornersSize(), Mat(corners_found), found);
495
}
496
497
return res;
498
}
499
500
// generates artificial checkerboards using warpPerspective which supports
501
// subpixel rendering. The transformation is found by transferring corners to
502
// the camera image using a virtual plane.
503
bool CV_ChessboardDetectorTest::checkByGeneratorHighAccuracy()
504
{
505
// draw 2D pattern
506
cv::Size pattern_size(6,5);
507
int cell_size = 80;
508
bool bwhite = true;
509
cv::Mat image = cv::Mat::ones((pattern_size.height+3)*cell_size,(pattern_size.width+3)*cell_size,CV_8UC1)*255;
510
cv::Mat pimage = image(Rect(cell_size,cell_size,(pattern_size.width+1)*cell_size,(pattern_size.height+1)*cell_size));
511
pimage = 0;
512
for(int row=0;row<=pattern_size.height;++row)
513
{
514
int y = int(cell_size*row+0.5F);
515
bool bwhite2 = bwhite;
516
for(int col=0;col<=pattern_size.width;++col)
517
{
518
if(bwhite2)
519
{
520
int x = int(cell_size*col+0.5F);
521
pimage(cv::Rect(x,y,cell_size,cell_size)) = 255;
522
}
523
bwhite2 = !bwhite2;
524
525
}
526
bwhite = !bwhite;
527
}
528
529
// generate 2d points
530
std::vector<Point2f> pts1,pts2,pts1_all,pts2_all;
531
std::vector<Point3f> pts3d;
532
for(int row=0;row<pattern_size.height;++row)
533
{
534
int y = int(cell_size*(row+2));
535
for(int col=0;col<pattern_size.width;++col)
536
{
537
int x = int(cell_size*(col+2));
538
pts1_all.push_back(cv::Point2f(x-0.5F,y-0.5F));
539
}
540
}
541
542
// back project chessboard corners to a virtual plane
543
double fx = 500;
544
double fy = 500;
545
cv::Point2f center(250,250);
546
double fxi = 1.0/fx;
547
double fyi = 1.0/fy;
548
for(auto &&pt : pts1_all)
549
{
550
// calc camera ray
551
cv::Vec3f ray(float((pt.x-center.x)*fxi),float((pt.y-center.y)*fyi),1.0F);
552
ray /= cv::norm(ray);
553
554
// intersect ray with virtual plane
555
cv::Scalar plane(0,0,1,-1);
556
cv::Vec3f n(float(plane(0)),float(plane(1)),float(plane(2)));
557
cv::Point3f p0(0,0,0);
558
559
cv::Point3f l0(0,0,0); // camera center in world coordinates
560
p0.z = float(-plane(3)/plane(2));
561
double val1 = ray.dot(n);
562
if(val1 == 0)
563
{
564
ts->printf( cvtest::TS::LOG, "Internal Error: ray and plane are parallel" );
565
ts->set_failed_test_info( cvtest::TS::FAIL_GENERIC);
566
return false;
567
}
568
pts3d.push_back(Point3f(ray/val1*cv::Vec3f((p0-l0)).dot(n))+l0);
569
}
570
571
// generate multiple rotations
572
for(int i=15;i<90;i=i+15)
573
{
574
// project 3d points to new camera
575
Vec3f rvec(0.0F,0.05F,float(float(i)/180.0*CV_PI));
576
Vec3f tvec(0,0,0);
577
cv::Mat k = (cv::Mat_<double>(3,3) << fx/2,0,center.x*2, 0,fy/2,center.y, 0,0,1);
578
cv::projectPoints(pts3d,rvec,tvec,k,cv::Mat(),pts2_all);
579
580
// get perspective transform using four correspondences and wrap original image
581
pts1.clear();
582
pts2.clear();
583
pts1.push_back(pts1_all[0]);
584
pts1.push_back(pts1_all[pattern_size.width-1]);
585
pts1.push_back(pts1_all[pattern_size.width*pattern_size.height-1]);
586
pts1.push_back(pts1_all[pattern_size.width*(pattern_size.height-1)]);
587
pts2.push_back(pts2_all[0]);
588
pts2.push_back(pts2_all[pattern_size.width-1]);
589
pts2.push_back(pts2_all[pattern_size.width*pattern_size.height-1]);
590
pts2.push_back(pts2_all[pattern_size.width*(pattern_size.height-1)]);
591
Mat m2 = getPerspectiveTransform(pts1,pts2);
592
Mat out(image.size(),image.type());
593
warpPerspective(image,out,m2,out.size());
594
595
// find checkerboard
596
vector<Point2f> corners_found;
597
bool found = findChessboardCornersWrapper(out,pattern_size,corners_found,0);
598
if (!found)
599
{
600
ts->printf( cvtest::TS::LOG, "Chess board corners not found\n" );
601
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
602
return false;
603
}
604
double err = calcErrorMinError(pattern_size,corners_found,pts2_all);
605
if(err > 0.08)
606
{
607
ts->printf( cvtest::TS::LOG, "bad accuracy of corner guesses" );
608
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
609
return false;
610
}
611
//cv::cvtColor(out,out,cv::COLOR_GRAY2BGR);
612
//cv::drawChessboardCorners(out,pattern_size,corners_found,true);
613
//cv::imshow("img",out);
614
//cv::waitKey(-1);
615
}
616
return true;
617
}
618
619
TEST(Calib3d_ChessboardDetector, accuracy) { CV_ChessboardDetectorTest test( CHESSBOARD ); test.safe_run(); }
620
TEST(Calib3d_ChessboardDetector2, accuracy) { CV_ChessboardDetectorTest test( CHESSBOARD_SB ); test.safe_run(); }
621
TEST(Calib3d_CirclesPatternDetector, accuracy) { CV_ChessboardDetectorTest test( CIRCLES_GRID ); test.safe_run(); }
622
TEST(Calib3d_AsymmetricCirclesPatternDetector, accuracy) { CV_ChessboardDetectorTest test( ASYMMETRIC_CIRCLES_GRID ); test.safe_run(); }
623
#ifdef HAVE_OPENCV_FLANN
624
TEST(Calib3d_AsymmetricCirclesPatternDetectorWithClustering, accuracy) { CV_ChessboardDetectorTest test( ASYMMETRIC_CIRCLES_GRID, CALIB_CB_CLUSTERING ); test.safe_run(); }
625
#endif
626
627
}} // namespace
628
/* End of file. */
629
630