@@ -217,8 +217,9 @@ bool CCheckerDetectorImpl::
217
217
// checker color analysis
218
218
// -------------------------------------------------------------------
219
219
std::vector<Ptr<CChecker>> checkers;
220
+ Point2f total_offset = static_cast <Point2f>(region.tl ());
220
221
checkerAnalysis (img_rgb_f, chartType, nc, colorCharts, checkers, asp, params,
221
- img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes);
222
+ img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes, total_offset );
222
223
223
224
#ifdef MCC_DEBUG
224
225
cv::Mat image_checker;
@@ -232,16 +233,8 @@ bool CCheckerDetectorImpl::
232
233
#endif
233
234
for (Ptr<CChecker> checker : checkers)
234
235
{
235
- const std::vector<cv::Point2f>& checkerBox = checker->getBox ();
236
- std::vector<cv::Point2f> restore_box (checkerBox.size ());
237
- for (size_t a = 0 ; a < checkerBox.size (); ++a) {
238
- restore_box[a] = checkerBox[a] + static_cast <cv::Point2f>(region.tl ());
239
- }
240
- checker->setBox (restore_box);
241
- {
242
- cv::AutoLock lock (mtx);
243
- m_checkers.push_back (checker);
244
- }
236
+ cv::AutoLock lock (mtx);
237
+ m_checkers.push_back (checker);
245
238
}
246
239
}
247
240
#ifdef MCC_DEBUG
@@ -442,8 +435,9 @@ bool CCheckerDetectorImpl::
442
435
// checker color analysis
443
436
// -------------------------------------------------------------------
444
437
std::vector<Ptr<CChecker>> checkers;
438
+ Point2f total_offset = static_cast <Point2f>(region.tl () + innerRegion.tl ());
445
439
checkerAnalysis (img_rgb_f, chartType, nc, colorCharts, checkers, asp, params,
446
- img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes);
440
+ img_rgb_org, img_ycbcr_org, rgb_planes, ycbcr_planes, total_offset );
447
441
#ifdef MCC_DEBUG
448
442
cv::Mat image_checker;
449
443
innerCroppedImage.copyTo (image_checker);
@@ -456,16 +450,8 @@ bool CCheckerDetectorImpl::
456
450
#endif
457
451
for (Ptr<CChecker> checker : checkers)
458
452
{
459
- const std::vector<cv::Point2f>& checkerBox = checker->getBox ();
460
- std::vector<cv::Point2f> restore_box (checkerBox.size ());
461
- for (size_t a = 0 ; a < checkerBox.size (); ++a) {
462
- restore_box[a] = checkerBox[a] + static_cast <cv::Point2f>(region.tl () + innerRegion.tl ());
463
- }
464
- checker->setBox (restore_box);
465
- {
466
- cv::AutoLock lock (mtx);
467
- m_checkers.push_back (checker);
468
- }
453
+ cv::AutoLock lock (mtx);
454
+ m_checkers.push_back (checker);
469
455
}
470
456
}
471
457
#ifdef MCC_DEBUG
@@ -983,7 +969,8 @@ void CCheckerDetectorImpl::
983
969
const cv::Mat &img_rgb_org,
984
970
const cv::Mat &img_ycbcr_org,
985
971
std::vector<cv::Mat> &rgb_planes,
986
- std::vector<cv::Mat> &ycbcr_planes)
972
+ std::vector<cv::Mat> &ycbcr_planes,
973
+ const Point2f& offset)
987
974
{
988
975
size_t N;
989
976
std::vector<cv::Point2f> ibox;
@@ -1019,9 +1006,9 @@ void CCheckerDetectorImpl::
1019
1006
if (J[i] > params->maxError )
1020
1007
continue ;
1021
1008
1022
- // redimention box
1009
+ // redimension box
1023
1010
for (size_t j = 0 ; j < 4 ; j++)
1024
- ibox[j] = invAsp * ibox[j];
1011
+ ibox[j] = invAsp * ibox[j] + offset ;
1025
1012
1026
1013
cv::Mat charts_rgb, charts_ycbcr;
1027
1014
get_profile (ibox, chartType, charts_rgb, charts_ycbcr, img_rgb_org,
0 commit comments