result = estimator.run7Point(m1, m2, &_F9x3);
else if( count == 8 || method == CV_FM_8POINT )
result = estimator.run8Point(m1, m2, &_F3x3);
- else if( count > 8 )
+ else if( count >= 8 )
{
if( param1 <= 0 )
param1 = 3;
if( param2 < DBL_EPSILON || param2 > 1 - DBL_EPSILON )
param2 = 0.99;
- if( (method & ~3) == CV_RANSAC )
+ if( (method & ~3) == CV_RANSAC && count >= 15 )
result = estimator.runRANSAC(m1, m2, &_F3x3, tempMask, param1, param2 );
else
result = estimator.runLMeDS(m1, m2, &_F3x3, tempMask, param2 );
if( minMedian < DBL_MAX )
{
sigma = 2.5*1.4826*(1 + 5./(count - modelPoints))*sqrt(minMedian);
- sigma = MAX( sigma, FLT_EPSILON*100 );
+ sigma = MAX( sigma, 0.001 );
count = findInliers( m1, m2, model, err, mask, sigma );
result = count >= modelPoints;
float* d = (float*)dst.data;
size_t step1 = src1.step/sizeof(s1[0]), step2 = src2.step/sizeof(s2[0]);
size_t step = dst.step/sizeof(d[0]);
- float a = (float)alpha;
if( size.width == 1 )
{
for( ; size.height--; s1 += step1, s2 += step2, d += step )
- d[0] = s1[0]*a + s2[0];
+ d[0] = (float)(s1[0]*alpha + s2[0]);
return;
}
int i;
for( i = 0; i <= size.width - 4; i += 4 )
{
- float t0 = s1[i]*a + s2[i];
- float t1 = s1[i+1]*a + s2[i+1];
+ float t0 = (float)(s1[i]*alpha + s2[i]);
+ float t1 = (float)(s1[i+1]*alpha + s2[i+1]);
d[i] = t0;
d[i+1] = t1;
- t0 = s1[i+2]*a + s2[i+2];
- t1 = s1[i+3]*a + s2[i+3];
+ t0 = (float)(s1[i+2]*alpha + s2[i+2]);
+ t1 = (float)(s1[i+3]*alpha + s2[i+3]);
d[i+2] = t0;
d[i+3] = t1;
}
for( ; i < size.width; i++ )
- d[i] = s1[i]*a + s2[i];
+ d[i] = (float)(s1[i]*alpha + s2[i]);
}
}
else if( depth == CV_64F )
int type = v1.type(), depth = v1.depth();
Size sz = v1.size();
int i, j, len = sz.width*sz.height*v1.channels();
- AutoBuffer<uchar> buf(len*v1.elemSize());
+ AutoBuffer<double> buf(len);
double result = 0;
CV_Assert( type == v2.type() && type == icovar.type() &&
sz == v2.size() && len == icovar.rows && len == icovar.cols );
+ sz.width *= v1.channels();
if( v1.isContinuous() && v2.isContinuous() )
{
sz.width *= sz.height;
const float* src2 = (const float*)v2.data;
size_t step1 = v1.step/sizeof(src1[0]);
size_t step2 = v2.step/sizeof(src2[0]);
- float* diff = (float*)(uchar*)buf;
+ double* diff = buf;
const float* mat = (const float*)icovar.data;
size_t matstep = icovar.step/sizeof(mat[0]);
diff[i] = src1[i] - src2[i];
}
- diff = (float*)(uchar*)buf;
+ diff = buf;
for( i = 0; i < len; i++, mat += matstep )
{
double row_sum = 0;
const double* src2 = (const double*)v2.data;
size_t step1 = v1.step/sizeof(src1[0]);
size_t step2 = v2.step/sizeof(src2[0]);
- double* diff = (double*)(uchar*)buf;
+ double* diff = buf;
const double* mat = (const double*)icovar.data;
size_t matstep = icovar.step/sizeof(mat[0]);
diff[i] = src1[i] - src2[i];
}
- diff = (double*)(uchar*)buf;
+ diff = buf;
for( i = 0; i < len; i++, mat += matstep )
{
double row_sum = 0;
const sT *tsrc = src + j;
for( k = 0; k < size.height; k++, tsrc += srcstep )
- s0 += col_buf[k] * tsrc[0];
+ s0 += (double)col_buf[k] * tsrc[0];
tdst[j] = (dT)(s0*scale);
}
const dT *d = delta_buf ? delta_buf : delta + j;
for( k = 0; k < size.height; k++, tsrc+=srcstep, d+=deltastep )
- s0 += col_buf[k] * (tsrc[0] - d[0]);
+ s0 += (double)col_buf[k] * (tsrc[0] - d[0]);
tdst[j] = (dT)(s0*scale);
}
const sT *tsrc2 = src + j*srcstep;
for( k = 0; k <= size.width - 4; k += 4 )
- s += tsrc1[k]*tsrc2[k] + tsrc1[k+1]*tsrc2[k+1] +
- tsrc1[k+2]*tsrc2[k+2] + tsrc1[k+3]*tsrc2[k+3];
+ s += (double)tsrc1[k]*tsrc2[k] + (double)tsrc1[k+1]*tsrc2[k+1] +
+ (double)tsrc1[k+2]*tsrc2[k+2] + (double)tsrc1[k+3]*tsrc2[k+3];
for( ; k < size.width; k++ )
- s += tsrc1[k] * tsrc2[k];
+ s += (double)tsrc1[k] * tsrc2[k];
tdst[j] = (dT)(s*scale);
}
else
tdelta2 = delta_buf;
}
for( k = 0; k <= size.width-4; k += 4, tdelta2 += delta_shift )
- s += row_buf[k]*(tsrc2[k] - tdelta2[0]) +
- row_buf[k+1]*(tsrc2[k+1] - tdelta2[1]) +
- row_buf[k+2]*(tsrc2[k+2] - tdelta2[2]) +
- row_buf[k+3]*(tsrc2[k+3] - tdelta2[3]);
+ s += (double)row_buf[k]*(tsrc2[k] - tdelta2[0]) +
+ (double)row_buf[k+1]*(tsrc2[k+1] - tdelta2[1]) +
+ (double)row_buf[k+2]*(tsrc2[k+2] - tdelta2[2]) +
+ (double)row_buf[k+3]*(tsrc2[k+3] - tdelta2[3]);
for( ; k < size.width; k++, tdelta2++ )
- s += row_buf[k]*(tsrc2[k] - tdelta2[0]);
+ s += (double)row_buf[k]*(tsrc2[k] - tdelta2[0]);
tdst[j] = (dT)(s*scale);
}
}
CV_INLINE double cvTriangleArea( CvPoint2D32f a, CvPoint2D32f b, CvPoint2D32f c )
{
- return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
+ return ((double)b.x - a.x) * ((double)c.y - a.y) - ((double)b.y - a.y) * ((double)c.x - a.x);
}
anchor = normalizeAnchor(anchor, _kernel.size());
- if( sdepth == CV_8U && ddepth == CV_8U && kdepth == CV_32S )
+ /*if( sdepth == CV_8U && ddepth == CV_8U && kdepth == CV_32S )
return Ptr<BaseFilter>(new Filter2D<uchar, FixedPtCastEx<int, uchar>, FilterVec_8u>
(_kernel, anchor, delta, FixedPtCastEx<int, uchar>(bits),
FilterVec_8u(_kernel, bits, delta)));
if( sdepth == CV_8U && ddepth == CV_16S && kdepth == CV_32S )
return Ptr<BaseFilter>(new Filter2D<uchar, FixedPtCastEx<int, short>, FilterVec_8u16s>
(_kernel, anchor, delta, FixedPtCastEx<int, short>(bits),
- FilterVec_8u16s(_kernel, bits, delta)));
+ FilterVec_8u16s(_kernel, bits, delta)));*/
kdepth = sdepth == CV_64F || ddepth == CV_64F ? CV_64F : CV_32F;
Mat kernel;
const Scalar& _borderValue )
{
_srcType = CV_MAT_TYPE(_srcType);
- _dstType = CV_MAT_TYPE(_dstType);
- int sdepth = CV_MAT_DEPTH(_srcType), ddepth = CV_MAT_DEPTH(_dstType);
+ _dstType = CV_MAT_TYPE(_dstType);
int cn = CV_MAT_CN(_srcType);
CV_Assert( cn == CV_MAT_CN(_dstType) );
Mat kernel = _kernel;
- int ktype = _kernel.depth() == CV_32S ? KERNEL_INTEGER : getKernelType(_kernel, _anchor);
int bits = 0;
+ /*int sdepth = CV_MAT_DEPTH(_srcType), ddepth = CV_MAT_DEPTH(_dstType);
+ int ktype = _kernel.depth() == CV_32S ? KERNEL_INTEGER : getKernelType(_kernel, _anchor);
if( sdepth == CV_8U && (ddepth == CV_8U || ddepth == CV_16S) &&
_kernel.rows*_kernel.cols <= (1 << 10) )
{
bits = (ktype & KERNEL_INTEGER) ? 0 : 11;
_kernel.convertTo(kernel, CV_32S, 1 << bits);
- }
+ }*/
Ptr<BaseFilter> _filter2D = getLinearFilter(_srcType, _dstType,
kernel, _anchor, _delta, bits);
icvIsRightOf( CvPoint2D32f& pt, CvSubdiv2DEdge edge )
{
CvSubdiv2DPoint *org = cvSubdiv2DEdgeOrg(edge), *dst = cvSubdiv2DEdgeDst(edge);
- Cv32suf cw_area;
- cw_area.f = (float)cvTriangleArea( pt, dst->pt, org->pt );
+ double cw_area = cvTriangleArea( pt, dst->pt, org->pt );
- return (cw_area.i > 0)*2 - (cw_area.i*2 != 0);
+ return (cw_area > 0) - (cw_area < 0);
}
// find the maximum index (the dominant orientation)
cvGetMinMaxHistValue( hist, 0, 0, 0, &base_orient );
- base_orient *= 360/hist_size;
+ base_orient = cvRound(base_orient*360./hist_size);
// override timestamp with the maximum value in MHI
cvMinMaxLoc( mhi, 0, &curr_mhi_timestamp, 0, 0, mask );
rel_angle += (rel_angle < -180 ? 360 : 0);
rel_angle += (rel_angle > 180 ? -360 : 0);
- if( abs(rel_angle) < 90 )
+ if( abs(rel_angle) < 45 )
{
shift_orient += weight * rel_angle;
shift_weight += weight;
\r
const float imgPointErr = 1e-3f,\r
dEps = 1e-3f;\r
+ \r
+ double err;\r
\r
Size imgSize( 600, 800 );\r
Mat_<float> objPoints( pointCount, 3), rvec( 1, 3), rmat, tvec( 1, 3 ), cameraMatrix( 3, 3 ), distCoeffs( 1, 4 ),\r
rightImgPoints[i], valDpdrot, valDpdt, valDpdf, valDpdc, valDpddist, 0 );\r
}\r
calcdfdx( leftImgPoints, rightImgPoints, dEps, valDpdrot );\r
- if( norm( dpdrot, valDpdrot, NORM_INF ) > 2.5 )\r
+ err = norm( dpdrot, valDpdrot, NORM_INF );\r
+ if( err > 3 )\r
{\r
- ts->printf( CvTS::LOG, "bad dpdrot\n" );\r
+ ts->printf( CvTS::LOG, "bad dpdrot: too big difference = %g\n", err );\r
code = CvTS::FAIL_BAD_ACCURACY;\r
}\r
\r
goto _exit_;
}
- if( fabs(comp.area - area0) > area0*0.1 )
+ if( fabs(comp.area - area0) > area0*0.15 )
{
ts->printf( CvTS::LOG,
"Incorrect CvConnectedComp area (=%.1f, should be %d)\n", comp.area, area0 );
double t;
CV_SWAP( low.val[i], high.val[i], t );
}
+ if( high.val[i] < low.val[i] + 1 )
+ high.val[i] += 1;
}
generate_point_set( points );
Mat aff_est = estimateRigidTransform(fpts, tpts, true);
- double thres = 0.03*norm(aff);
+ double thres = 0.1*norm(aff);
double d = norm(aff_est, aff, NORM_L2);
if (d > thres)
{
if( diff < -180 ) diff += 360;
if( diff > 180 ) diff -= 360;
- if( delta_weight > 0 && fabs(diff) < 90 )
+ if( delta_weight > 0 && fabs(diff) < 45 )
{
delta_orientation += diff*delta_weight;
weight += delta_weight;
CvMat* true_translation = cvCreateMat( 3, 1, CV_32F );
const float flFocalLength = 760.f;
- const float flEpsilon = 0.1f;
+ const float flEpsilon = 0.5f;
/* Initilization */
criteria.type = CV_TERMCRIT_EPS|CV_TERMCRIT_ITER;
void CV_PyrSegmentationTest::run( int /*start_from*/ )
{
const int level = 5;
- const double range = 20;
+ const double range = 15;
int code = CvTS::OK;
if( channels == 1 )
{
- int color1 = 30, color2 = 110, color3 = 180;
+ int color1 = 30, color2 = 110, color3 = 190;
cvSet( image, cvScalarAll(color1));
cvFillPoly( image, &cp, &nPoints, 1, cvScalar(color2));
params.rng_seed = 0;
params.debug_mode = -1;
params.print_only_failed = 0;
- params.skip_header = 0;
+ params.skip_header = -1;
+ params.ignore_blacklist = -1;
params.test_mode = CORRECTNESS_CHECK_MODE;
params.timing_mode = MIN_TIME;
params.use_optimized = -1;
set_data_path(argv[++i]);
else if( strcmp( argv[i], "-nc" ) == 0 )
params.color_terminal = 0;
+ else if( strcmp( argv[i], "-nh" ) == 0 )
+ params.skip_header = 1;
+ else if( strcmp( argv[i], "-nb" ) == 0 )
+ params.ignore_blacklist = 1;
else if( strcmp( argv[i], "-r" ) == 0 )
params.debug_mode = 0;
else if( strcmp( argv[i], "-tn" ) == 0 )
if( datapath_dir )
{
sprintf( buf, "%s/%s", datapath_dir, module_name ? module_name : "" );
- printf( LOG + SUMMARY, "Data Path = %s\n", buf);
+ //printf( LOG + SUMMARY, "Data Path = %s\n", buf);
set_data_path(buf);
}
}
}
if( !config_name )
- printf( LOG, "WARNING: config name is not specified, using default parameters\n" );
+ ;
+ //printf( LOG, "WARNING: config name is not specified, using default parameters\n" );
else
{
// 2. read common parameters of test system
"-l - list all the registered tests or subset of the tests,\n"
" selected in the config file, and exit\n"
"-tn - only run a specific test\n"
- "-nc - do not use colors in the console output\n"
+ "-nc - do not use colors in the console output\n"
+ "-nh - do not print the header\n"
"-O{0|1} - disable/enable on-fly detection of IPP and other\n"
" supported optimized libs. It's enabled by default\n"
"-r - continue running tests after OS/Hardware exception occured\n"
CvFileNode* node = fs ? cvGetFileNodeByName( fs, 0, "common" ) : 0;
if(params.debug_mode < 0)
params.debug_mode = cvReadIntByName( fs, node, "debug_mode", 1 ) != 0;
- params.skip_header = cvReadIntByName( fs, node, "skip_header", 0 ) != 0;
+ if( params.skip_header < 0 )
+ params.skip_header = cvReadIntByName( fs, node, "skip_header", 0 ) > 0;
+ if( params.ignore_blacklist < 0 )
+ params.ignore_blacklist = cvReadIntByName( fs, node, "ignore_blacklist", 0 ) > 0;
params.print_only_failed = cvReadIntByName( fs, node, "print_only_failed", 0 ) != 0;
params.rerun_failed = cvReadIntByName( fs, node, "rerun_failed", 0 ) != 0;
params.rerun_immediately = cvReadIntByName( fs, node, "rerun_immediately", 0 ) != 0;
int inverse = 0;
int greater_or_equal = 0;
- if( blacklist )
+ if( blacklist && !params.ignore_blacklist )
{
for( ; *blacklist != 0; blacklist++ )
{
// otherwise the system tries to catch the exceptions and continue with other tests
int debug_mode;
- // if non-zero, the header is not print
- bool skip_header;
+ // if > 0, the header is not print
+ int skip_header;
+
+ // if > 0, the blacklist is ignored
+ int ignore_blacklist;
// if non-zero, the system includes only failed tests into summary
bool print_only_failed;