void get_timing_test_array_types_and_sizes( int /*test_case_idx*/,
CvSize** sizes, int** types, CvSize** whole_sizes, bool *are_images );
void generate_scalars( int depth );
+ void finalize_scalar( CvScalar& s );
CvScalar alpha, beta, gamma;
int gen_scalars;
bool calc_abs;
}
}
+void CxCore_ArithmTestImpl::finalize_scalar( CvScalar& s )
+{
+ int depth = CV_MAT_DEPTH(test_mat[INPUT][0].type);
+ if( depth < CV_32F )
+ s = cvScalar(cvRound(s.val[0]), cvRound(s.val[1]), cvRound(s.val[2]), cvRound(s.val[3]));
+}
+
void CxCore_ArithmTestImpl::get_test_array_types_and_sizes( int test_case_idx,
CvSize** sizes, int** types )
{
CvRNG* rng = ts->get_rng();
- int depth = cvTsRandInt(rng)%CV_64F;
+ int depth = cvTsRandInt(rng)%(CV_64F+1);
int cn = cvTsRandInt(rng) % 4 + 1;
int i, j;
+ depth += depth == CV_8S;
CvArrTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
generate_scalars( depth );
- depth += depth == CV_8S;
for( i = 0; i < max_arr; i++ )
{
{
cv::MatND a = cv::cvarrToMatND(test_array[INPUT][0]);
cv::MatND b = cv::cvarrToMatND(test_array[INPUT][1]);
- cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][2]);
- if( test_array[MASK][0] )
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ if( !test_array[MASK][0] )
cv::add(a, b, c);
else
cv::add(a, b, c, cv::cvarrToMatND(test_array[MASK][0]));
{
cv::MatND a = cv::cvarrToMatND(test_array[INPUT][0]);
cv::MatND b = cv::cvarrToMatND(test_array[INPUT][1]);
- cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][2]);
- if( test_array[MASK][0] )
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ if( !test_array[MASK][0] )
cv::subtract(a, b, c);
else
cv::subtract(a, b, c, cv::cvarrToMatND(test_array[MASK][0]));
void CxCore_AddSTest::run_func()
{
+ finalize_scalar(gamma);
if(!test_nd)
{
- cvAddS( test_array[INPUT][0], gamma,
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if( test_mat[INPUT][0].cols % 2 == 0 )
+ cvAddS( test_array[INPUT][0], gamma,
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ else
+ {
+ cv::Mat a = cv::cvarrToMat(test_array[INPUT][0]),
+ c = cv::cvarrToMat(test_array[INPUT_OUTPUT][0]);
+ cv::subtract(a, -cv::Scalar(gamma), c, test_array[MASK][0] ?
+ cv::cvarrToMat(test_array[MASK][0]) : cv::Mat());
+ }
}
else
{
cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
cv::add( cv::cvarrToMatND(test_array[INPUT][0]),
- gamma, c,
- test_array[MASK][0] ?
- cv::cvarrToMatND(test_array[MASK][0]) : cv::MatND());
+ gamma, c, test_array[MASK][0] ?
+ cv::cvarrToMatND(test_array[MASK][0]) : cv::MatND());
}
}
void CxCore_SubRSTest::run_func()
{
+ finalize_scalar(gamma);
if(!test_nd)
{
cvSubRS( test_array[INPUT][0], gamma,
void CxCore_AbsDiffSTest::run_func()
{
+ finalize_scalar(gamma);
if(!test_nd)
{
cvAbsDiffS( test_array[INPUT][0], test_array[OUTPUT][0], gamma );
void CxCore_MulTest::run_func()
{
- cvMul( test_array[INPUT][0], test_array[INPUT][1],
- test_array[OUTPUT][0], alpha.val[0] );
+ if(!test_nd)
+ {
+ cvMul( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[OUTPUT][0], alpha.val[0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::multiply(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]),
+ c, alpha.val[0]);
+ }
}
void CxCore_MulTest::prepare_to_validation( int /*test_case_idx*/ )
void CxCore_DivTest::run_func()
{
- cvDiv( test_array[INPUT][0], test_array[INPUT][1],
- test_array[OUTPUT][0], alpha.val[0] );
+ if(!test_nd)
+ {
+ cvDiv( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[OUTPUT][0], alpha.val[0] );
+ }
+ else
+ {
+ cv::MatND b = cv::cvarrToMatND(test_array[INPUT][1]);
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::divide(cv::cvarrToMatND(test_array[INPUT][0]),
+ b, c, alpha.val[0]);
+ }
}
void CxCore_DivTest::prepare_to_validation( int /*test_case_idx*/ )
void CxCore_RecipTest::run_func()
{
- cvDiv( 0, test_array[INPUT][0],
- test_array[OUTPUT][0], gamma.val[0] );
+ if(!test_nd)
+ {
+ cvDiv( 0, test_array[INPUT][0],
+ test_array[OUTPUT][0], gamma.val[0] );
+ }
+ else
+ {
+ cv::MatND b = cv::cvarrToMatND(test_array[INPUT][0]);
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::divide(gamma.val[0], b, c);
+ }
}
void CxCore_RecipTest::prepare_to_validation( int /*test_case_idx*/ )
void CxCore_SetIdentityTest::run_func()
{
- cvSetIdentity(test_array[OUTPUT][0], gamma);
+ if(!test_nd)
+ cvSetIdentity(test_array[OUTPUT][0], gamma);
+ else
+ {
+ cv::Mat a = cv::cvarrToMat(test_array[OUTPUT][0]);
+ cv::setIdentity(a, gamma);
+ }
}
void CxCore_SetZeroTest::run_func()
{
- cvSetZero(test_array[OUTPUT][0]);
+ if(!test_nd)
+ cvSetZero(test_array[OUTPUT][0]);
+ else
+ {
+ cv::MatND a = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ a.setTo(cv::Scalar());
+ }
}
void CxCore_FillTest::run_func()
{
- cvSet(test_array[INPUT_OUTPUT][0], gamma, test_array[MASK][0]);
+ const CvArr* mask = test_array[MASK][0];
+ if(!test_nd)
+ cvSet(test_array[INPUT_OUTPUT][0], gamma, mask);
+ else
+ {
+ cv::MatND a = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ a.setTo(gamma, mask ? cv::cvarrToMatND(mask) : cv::MatND());
+ }
}
void CxCore_CopyTest::run_func()
{
- cvCopy(test_array[INPUT][0], test_array[INPUT_OUTPUT][0], test_array[MASK][0]);
+ const CvArr* mask = test_array[MASK][0];
+ if(!test_nd)
+ cvCopy(test_array[INPUT][0], test_array[INPUT_OUTPUT][0], mask);
+ else
+ {
+ cv::MatND a = cv::cvarrToMatND(test_array[INPUT][0]);
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ if(!mask)
+ a.copyTo(c);
+ else
+ a.copyTo(c, cv::cvarrToMatND(mask));
+ }
}
void CxCore_SplitTest::run_func()
{
- cvSplit( test_array[INPUT][0], hdrs[0], hdrs[1], hdrs[2], hdrs[3] );
+ int i, nz = (hdrs[0] != 0) + (hdrs[1] != 0) + (hdrs[2] != 0) + (hdrs[3] != 0);
+
+ if(!test_nd || nz != CV_MAT_CN(test_mat[INPUT][0].type))
+ cvSplit( test_array[INPUT][0], hdrs[0], hdrs[1], hdrs[2], hdrs[3] );
+ else
+ {
+ cv::MatND _hdrs[4];
+ for( i = 0; i < nz; i++ )
+ _hdrs[i] = cv::cvarrToMatND(hdrs[i]);
+ cv::split(cv::cvarrToMatND(test_array[INPUT][0]), _hdrs);
+ }
}
CxCore_SplitTest split_test;
void CxCore_MergeTest::run_func()
{
- cvMerge( hdrs[0], hdrs[1], hdrs[2], hdrs[3], test_array[INPUT_OUTPUT][0] );
+ int i, nz = (hdrs[0] != 0) + (hdrs[1] != 0) + (hdrs[2] != 0) + (hdrs[3] != 0);
+
+ if(!test_nd || nz != CV_MAT_CN(test_mat[INPUT_OUTPUT][0].type))
+ cvMerge( hdrs[0], hdrs[1], hdrs[2], hdrs[3], test_array[INPUT_OUTPUT][0] );
+ else
+ {
+ cv::MatND _hdrs[4], dst = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ for( i = 0; i < nz; i++ )
+ _hdrs[i] = cv::cvarrToMatND(hdrs[i]);
+ cv::merge(_hdrs, nz, dst);
+ }
}
CxCore_MergeTest merge_test;
void CxCore_MinTest::run_func()
{
- cvMin( test_array[INPUT][0], test_array[INPUT][1], test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvMin( test_array[INPUT][0], test_array[INPUT][1], test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::min(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]), c);
+ }
}
CxCore_MinTest min_test;
void CxCore_MaxTest::run_func()
{
- cvMax( test_array[INPUT][0], test_array[INPUT][1], test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvMax( test_array[INPUT][0], test_array[INPUT][1], test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::max(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]), c);
+ }
}
CxCore_MaxTest max_test;
void CxCore_MinSTest::run_func()
{
- cvMinS( test_array[INPUT][0], gamma.val[0], test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvMinS( test_array[INPUT][0], gamma.val[0], test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::min(cv::cvarrToMatND(test_array[INPUT][0]),
+ gamma.val[0], c);
+ }
}
CxCore_MinSTest mins_test;
void CxCore_MaxSTest::run_func()
{
- cvMaxS( test_array[INPUT][0], gamma.val[0], test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvMaxS( test_array[INPUT][0], gamma.val[0], test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::max(cv::cvarrToMatND(test_array[INPUT][0]),
+ gamma.val[0], c);
+ }
}
CxCore_MaxSTest maxs_test;
void CxCore_AndTest::run_func()
{
- cvAnd( test_array[INPUT][0], test_array[INPUT][1],
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if(!test_nd)
+ {
+ cvAnd( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ cv::bitwise_and(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]),
+ c, cv::cvarrToMatND(test_array[MASK][0]));
+ }
}
CxCore_AndTest and_test;
void CxCore_AndSTest::run_func()
{
- cvAndS( test_array[INPUT][0], gamma,
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if(!test_nd)
+ {
+ cvAndS( test_array[INPUT][0], gamma,
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ cv::bitwise_and(cv::cvarrToMatND(test_array[INPUT][0]),
+ gamma, c,
+ cv::cvarrToMatND(test_array[MASK][0]));
+ }
}
CxCore_AndSTest ands_test;
void CxCore_OrTest::run_func()
{
- cvOr( test_array[INPUT][0], test_array[INPUT][1],
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if(!test_nd)
+ {
+ cvOr( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ cv::bitwise_or(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]),
+ c, cv::cvarrToMatND(test_array[MASK][0]));
+ }
+
}
CxCore_OrTest or_test;
void CxCore_OrSTest::run_func()
{
- cvOrS( test_array[INPUT][0], gamma,
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if(!test_nd)
+ {
+ cvOrS( test_array[INPUT][0], gamma,
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ cv::bitwise_or(cv::cvarrToMatND(test_array[INPUT][0]),
+ gamma, c,
+ cv::cvarrToMatND(test_array[MASK][0]));
+ }
}
CxCore_OrSTest ors_test;
void CxCore_XorTest::run_func()
{
- cvXor( test_array[INPUT][0], test_array[INPUT][1],
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if(!test_nd)
+ {
+ cvXor( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ cv::bitwise_xor(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]),
+ c, cv::cvarrToMatND(test_array[MASK][0]));
+ }
+
}
CxCore_XorTest xor_test;
void CxCore_XorSTest::run_func()
{
- cvXorS( test_array[INPUT][0], gamma,
- test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ if(!test_nd)
+ {
+ cvXorS( test_array[INPUT][0], gamma,
+ test_array[INPUT_OUTPUT][0], test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[INPUT_OUTPUT][0]);
+ cv::bitwise_xor(cv::cvarrToMatND(test_array[INPUT][0]),
+ gamma, c,
+ cv::cvarrToMatND(test_array[MASK][0]));
+ }
}
CxCore_XorSTest xors_test;
void CxCore_NotTest::run_func()
{
- cvNot( test_array[INPUT][0],
- test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvNot( test_array[INPUT][0], test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::bitwise_not(cv::cvarrToMatND(test_array[INPUT][0]), c);
+ }
}
CxCore_NotTest nots_test;
void CxCore_CmpTest::run_func()
{
- cvCmp( test_array[INPUT][0], test_array[INPUT][1],
- test_array[OUTPUT][0], cmp_op );
+ if(!test_nd)
+ {
+ cvCmp( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[OUTPUT][0], cmp_op );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::compare(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]),
+ c, cmp_op);
+ }
}
CxCore_CmpTest cmp_test;
void CxCore_CmpSTest::run_func()
{
- cvCmpS( test_array[INPUT][0], gamma.val[0],
+ if(!test_nd)
+ {
+ cvCmpS( test_array[INPUT][0], gamma.val[0],
test_array[OUTPUT][0], cmp_op );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::compare(cv::cvarrToMatND(test_array[INPUT][0]),
+ gamma.val[0], c, cmp_op);
+ }
}
CxCore_CmpSTest cmps_test;
void CxCore_InRangeTest::run_func()
{
- cvInRange( test_array[INPUT][0], test_array[INPUT][1],
- test_array[INPUT][2], test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvInRange( test_array[INPUT][0], test_array[INPUT][1],
+ test_array[INPUT][2], test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::inRange(cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[INPUT][1]),
+ cv::cvarrToMatND(test_array[INPUT][2]),
+ c);
+ }
}
CxCore_InRangeTest inrange_test;
void CxCore_InRangeSTest::run_func()
{
- cvInRangeS( test_array[INPUT][0], alpha, gamma, test_array[OUTPUT][0] );
+ if(!test_nd)
+ {
+ cvInRangeS( test_array[INPUT][0], alpha, gamma, test_array[OUTPUT][0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::inRange(cv::cvarrToMatND(test_array[INPUT][0]), alpha, gamma, c);
+ }
}
CxCore_InRangeSTest inranges_test;
void CxCore_CvtScaleTest::run_func()
{
- cvConvertScale( test_array[INPUT][0], test_array[OUTPUT][0],
- alpha.val[0], gamma.val[0] );
+ if(!test_nd)
+ {
+ cvConvertScale( test_array[INPUT][0], test_array[OUTPUT][0],
+ alpha.val[0], gamma.val[0] );
+ }
+ else
+ {
+ cv::MatND c = cv::cvarrToMatND(test_array[OUTPUT][0]);
+ cv::cvarrToMatND(test_array[INPUT][0]).convertTo(c,c.type(),alpha.val[0], gamma.val[0]);
+ }
}
CxCore_CvtScaleTest cvtscale_test;
void CxCore_CvtScaleAbsTest::run_func()
{
- cvConvertScaleAbs( test_array[INPUT][0], test_array[OUTPUT][0],
+ if(!test_nd)
+ {
+ cvConvertScaleAbs( test_array[INPUT][0], test_array[OUTPUT][0],
alpha.val[0], gamma.val[0] );
+ }
+ else
+ {
+ cv::Mat c = cv::cvarrToMat(test_array[OUTPUT][0]);
+ cv::convertScaleAbs(cv::cvarrToMat(test_array[INPUT][0]),c,alpha.val[0], gamma.val[0]);
+ }
}
CxCore_CvtScaleAbsTest cvtscaleabs_test;
int output_count;
bool single_channel;
bool is_binary;
+ bool test_nd;
};
whole_size_list = arithm_whole_sizes;
depth_list = arithm_depths;
cn_list = arithm_channels;
+ test_nd = false;
}
coi = cvTsRandInt(rng) % cn + 1;
cvmat_allowed = false;
}
+ test_nd = cvTsRandInt(rng) % 3 == 0;
}
void CxCore_SumTest::run_func()
{
- *(CvScalar*)(test_mat[OUTPUT][0].data.db) = cvSum(test_array[INPUT][0]);
+ if(!test_nd || coi)
+ {
+ *(CvScalar*)(test_mat[OUTPUT][0].data.db) = cvSum(test_array[INPUT][0]);
+ }
+ else
+ {
+ *(cv::Scalar*)(test_mat[OUTPUT][0].data.db) = cv::sum(cv::cvarrToMatND(test_array[INPUT][0]));
+ }
}
void CxCore_SumTest::prepare_to_validation( int /*test_case_idx*/ )
void CxCore_NonZeroTest::run_func()
{
- test_mat[OUTPUT][0].data.db[0] = cvCountNonZero(test_array[INPUT][0]);
+ if(!test_nd || coi)
+ {
+ test_mat[OUTPUT][0].data.db[0] = cvCountNonZero(test_array[INPUT][0]);
+ }
+ else
+ {
+ test_mat[OUTPUT][0].data.db[0] = cv::countNonZero(cv::cvarrToMatND(test_array[INPUT][0]));
+ }
}
void CxCore_NonZeroTest::get_test_array_types_and_sizes( int test_case_idx,
void CxCore_MeanTest::run_func()
{
- *(CvScalar*)(test_mat[OUTPUT][0].data.db) =
- cvAvg(test_array[INPUT][0], test_array[MASK][0]);
+ if(!test_nd || coi)
+ {
+ *(CvScalar*)(test_mat[OUTPUT][0].data.db) =
+ cvAvg(test_array[INPUT][0], test_array[MASK][0]);
+ }
+ else
+ {
+ *(cv::Scalar*)(test_mat[OUTPUT][0].data.db) = cv::mean(
+ cv::cvarrToMatND(test_array[INPUT][0]),
+ cv::cvarrToMatND(test_array[MASK][0]));
+ }
}
void CxCore_MeanTest::prepare_to_validation( int /*test_case_idx*/ )
void CxCore_MeanStdDevTest::run_func()
{
- /*CvScalar s;
- CvRNG* rng = ts->get_rng();
- s.val[0] = cvTsRandReal(rng)*100. - 50.;
- s.val[1] = cvTsRandReal(rng)*100. - 50.;
- s.val[2] = cvTsRandReal(rng)*100. - 50.;
- s.val[3] = cvTsRandReal(rng)*100. - 50.;
- cvSet( &test_mat[INPUT][0], s );*/
- cvAvgSdv( test_array[INPUT][0],
- &((CvScalar*)(test_mat[OUTPUT][0].data.db))[0],
- &((CvScalar*)(test_mat[OUTPUT][0].data.db))[1],
- test_array[MASK][0] );
+ if(!test_nd || coi)
+ {
+ cvAvgSdv( test_array[INPUT][0],
+ &((CvScalar*)(test_mat[OUTPUT][0].data.db))[0],
+ &((CvScalar*)(test_mat[OUTPUT][0].data.db))[1],
+ test_array[MASK][0] );
+ }
+ else
+ {
+ cv::meanStdDev(cv::cvarrToMatND(test_array[INPUT][0]),
+ ((cv::Scalar*)(test_mat[OUTPUT][0].data.db))[0],
+ ((cv::Scalar*)(test_mat[OUTPUT][0].data.db))[1],
+ cv::cvarrToMatND(test_array[MASK][0]) );
+ }
}
double CxCore_MeanStdDevTest::get_success_error_level( int test_case_idx, int i, int j )
void CxCore_NormTest::run_func()
{
- test_mat[OUTPUT][0].data.db[0] = cvNorm( test_array[INPUT][0],
- test_array[INPUT][1], norm_type, test_array[MASK][0] );
+ if(!test_nd || coi)
+ {
+ test_mat[OUTPUT][0].data.db[0] = cvNorm( test_array[INPUT][0],
+ test_array[INPUT][1], norm_type, test_array[MASK][0] );
+ }
+ else
+ {
+ cv::MatND a = cv::cvarrToMatND(test_array[INPUT][0]);
+ cv::MatND b = cv::cvarrToMatND(test_array[INPUT][1]);
+ cv::MatND mask = cv::cvarrToMatND(test_array[MASK][0]);
+ test_mat[OUTPUT][0].data.db[0] = b.data ?
+ cv::norm( a, b, norm_type, mask ) :
+ cv::norm( a, norm_type, mask );
+ }
}
void CxCore_NormTest::prepare_to_validation( int /*test_case_idx*/ )