return false;
}
- // step 2. check that all the points inside ROI belong to the original source image
- Mat temp(imgsize, CV_8U), utemp, map1, map2;
- temp = Scalar::all(1);
- initUndistortRectifyMap(M, D, R, P, imgsize, CV_16SC2, map1, map2);
- remap(temp, utemp, map1, map2, INTER_LINEAR);
+ // step 2. check that all the points inside ROI belong to the original source image
+ Mat temp(imgsize, CV_8U), utemp, map1, map2;
+ temp = Scalar::all(1);
+ initUndistortRectifyMap(M, D, R, P, imgsize, CV_16SC2, map1, map2);
+ remap(temp, utemp, map1, map2, INTER_LINEAR);
- if(roi.x < 0 || roi.y < 0 || roi.x + roi.width > imgsize.width || roi.y + roi.height > imgsize.height)
- {
+ if(roi.x < 0 || roi.y < 0 || roi.x + roi.width > imgsize.width || roi.y + roi.height > imgsize.height)
+ {
ts->printf(cvtest::TS::LOG, "Test #%d. The ROI=(%d, %d, %d, %d) is outside of the imge rectangle\n",
- test_case_idx, roi.x, roi.y, roi.width, roi.height);
+ test_case_idx, roi.x, roi.y, roi.width, roi.height);
return false;
- }
- double s = sum(utemp(roi))[0];
- if( s > roi.area() || roi.area() - s > roi.area()*(1-eps) )
- {
+ }
+ double s = sum(utemp(roi))[0];
+ if( s > roi.area() || roi.area() - s > roi.area()*(1-eps) )
+ {
ts->printf(cvtest::TS::LOG, "Test #%d. The ratio of black pixels inside the valid ROI (~%g%%) is too large\n",
- test_case_idx, s*100./roi.area());
+ test_case_idx, s*100./roi.area());
return false;
- }
+ }
- return true;
+ return true;
}
void CV_StereoCalibrationTest::run( int )
&& (kpts[lastRowCorner_ind].pt.y == lastRow) )
lastRowCorner_ind++;
- if( (kpts[lastRowCorner_ind].pt.x == currCorner->pt.x)
- && (lastRowCorner_ind != curr_idx) )
- {
- size_t w = lastRowCorner_ind;
- // find the maximum in this block
- while(nmsFlags[w] != -1)
- w = nmsFlags[w];
+ if( (kpts[lastRowCorner_ind].pt.x == currCorner->pt.x)
+ && (lastRowCorner_ind != curr_idx) )
+ {
+ size_t w = lastRowCorner_ind;
+ // find the maximum in this block
+ while(nmsFlags[w] != -1)
+ w = nmsFlags[w];
- if(kpts[curr_idx].response < kpts[w].response)
- nmsFlags[curr_idx] = (int)w;
- else
- nmsFlags[w] = (int)curr_idx;
- }
+ if(kpts[curr_idx].response < kpts[w].response)
+ nmsFlags[curr_idx] = (int)w;
+ else
+ nmsFlags[w] = (int)curr_idx;
+ }
}
// check left
for( i = 0; i < total; i++ )
{
int a = src1[i], b = src2[i];
- if( a < 0 ) a ^= C; if( b < 0 ) b ^= C;
+ if( a < 0 ) a ^= C;
+ if( b < 0 ) b ^= C;
int diff = std::abs(a - b);
if( realmaxdiff < diff )
{
for( i = 0; i < total; i++ )
{
int64 a = src1[i], b = src2[i];
- if( a < 0 ) a ^= C; if( b < 0 ) b ^= C;
+ if( a < 0 ) a ^= C;
+ if( b < 0 ) b ^= C;
double diff = fabs((double)a - (double)b);
if( realmaxdiff < diff )
{