int code = CvArrTest::write_default_params( fs );
if( code < 0 )
return code;
-
+
if( ts->get_testing_mode() == CvTS::CORRECTNESS_CHECK_MODE )
{
write_param( fs, "max_aperture_size", max_aperture_size );
void CV_FilterBaseTestImpl::prepare_to_validation( int /*test_case_idx*/ )
{
CvMat* src = &test_mat[INPUT][0];
-
+
if( !CV_ARE_TYPES_EQ( src, &test_mat[TEMP][0] ))
{
cvTsConvert( src, &test_mat[REF_OUTPUT][0] );
if( code <= 0 )
return code;
-
+
if( shape == CV_SHAPE_CUSTOM )
{
eldata = (int*)alloca( aperture_size.width*aperture_size.height*sizeof(eldata[0]) );
if( nonzero == 0 )
eldata[anchor.y*aperture_size.width + anchor.x] = 1;
}
-
+
cvReleaseStructuringElement( &element );
element = cvCreateStructuringElementEx( aperture_size.width, aperture_size.height,
anchor.x, anchor.y, shape, eldata );
void run_func();
void get_test_array_types_and_sizes( int test_case_idx, CvSize** sizes, int** types );
double get_success_error_level( int test_case_idx, int i, int j );
-
+
void get_timing_test_array_types_and_sizes( int test_case_idx, CvSize** sizes, int** types,
CvSize** whole_sizes, bool *are_images );
void print_timing_params( int test_case_idx, char* ptr, int params_left );
int t;
CV_SWAP( dx, dy, t );
}
-
+
if( _aperture_size < 0 )
aperture_size = cvSize(3, 3);
else if( _aperture_size == 1 )
int CV_SobelTest::prepare_test_case( int test_case_idx )
{
int code = CV_DerivBaseTest::prepare_test_case( test_case_idx );
-
+
if( code > 0 )
{
if( _aperture_size < 0 && ((dx != 1 || dy != 0) && (dx != 0 || dy != 1)) )
}
else
aperture_size = cvSize(_aperture_size, _aperture_size);
-
+
sizes[INPUT][1] = aperture_size;
sizes[TEMP][0].width = sizes[INPUT][0].width + aperture_size.width - 1;
sizes[TEMP][0].height = sizes[INPUT][0].height + aperture_size.height - 1;
{
CV_FilterBaseTest::get_timing_test_array_types_and_sizes( test_case_idx,
sizes, types, whole_sizes, are_images );
-
+
aperture_size.width = aperture_size.height = cvReadInt( find_timing_param( "mask_size" ), 3 );
anchor.x = anchor.y = aperture_size.width / 2;
sizes[INPUT][1] = aperture_size;
if( !normalize )
{
int depth = CV_MAT_DEPTH(types[INPUT][0]);
- types[INPUT][0] = CV_MAKETYPE(depth, 1);
+ types[INPUT][0] = CV_MAKETYPE(depth, 1);
types[TEMP][0] = types[OUTPUT][0] =
types[REF_OUTPUT][0] = CV_MAKETYPE(depth==CV_8U?CV_16S:CV_32F,1);
}
anchor = cvPoint(aperture_size.width/2,aperture_size.height/2);
sizes[TEMP][0].width = sizes[INPUT][0].width + aperture_size.width - 1;
sizes[TEMP][0].height = sizes[INPUT][0].height + aperture_size.height - 1;
-
+
sigma = exp(cvTsRandReal(rng)*5-2);
param1 = aperture_size.width;
param2 = aperture_size.height;
static void
icvCalcGaussianKernel( int n, double sigma, float* kernel )
{
- static const float small_gaussian_tab[][SMALL_GAUSSIAN_SIZE] =
+ static const float small_gaussian_tab[][SMALL_GAUSSIAN_SIZE] =
{
{1.f},
{0.25f, 0.5f, 0.25f},
double sum = 1.;
int i;
sum = kernel[n/2] = 1.f;
-
+
for( i = 1; i <= n/2; i++ )
{
kernel[n/2+i] = kernel[n/2-i] = (float)exp(scale2X*i*i);
int cn = CV_MAT_CN(types[INPUT][0]);
types[INPUT][0] = types[TEMP][0] = types[OUTPUT][0] = types[REF_OUTPUT][0] = CV_MAKETYPE(depth,cn);
types[INPUT][1] = types[TEMP][0] = types[TEMP][1] = CV_MAKETYPE(depth,1);
-
+
aperture_size.height = aperture_size.width;
anchor.x = anchor.y = aperture_size.width / 2;
sizes[INPUT][1] = cvSize(aperture_size.width,aperture_size.height);
- sizes[INPUT][0].width = MAX( sizes[INPUT][0].width, aperture_size.width );
- sizes[INPUT][0].height = MAX( sizes[INPUT][0].height, aperture_size.width );
sizes[OUTPUT][0] = sizes[INPUT][0];
sizes[REF_OUTPUT][0] = sizes[INPUT][0];
sizes[TEMP][0].width = sizes[INPUT][0].width + aperture_size.width - 1;
sizes[TEMP][0].height = sizes[INPUT][0].height + aperture_size.height - 1;
-
+
sizes[TEMP][1] = cn > 1 ? sizes[INPUT][0] : cvSize(0,0);
inplace = false;
}
: CV_FilterBaseTest( test_name, test_funcs, true ), downsample(_downsample)
{
test_array[TEMP].push(NULL);
+ size_list = filter_sizes;
depth_list = smooth_depths;
cn_list = pyramid_channels;
default_timing_param_names = 0;
if( strcmp( test_funcs, "" ) != 0 )
{
default_timing_param_names = pyramid_param_names;
+ size_list = 0;
cn_list = 0;
depth_list = 0;
}
sizes[OUTPUT][0] = sizes[REF_OUTPUT][0] = sz;
sizes[TEMP][1] = cvSize(0,0);
}
-
+
sizes[INPUT][1] = aperture_size;
sizes[TEMP][0].width = sz.width + aperture_size.width - 1;
sizes[TEMP][0].height = sz.height + aperture_size.height - 1;
double scale = 1./256;
CvMat* kernel;
int code = CV_FilterBaseTest::prepare_test_case( test_case_idx );
-
+
if( code <= 0 )
return code;
elem_size /= sizeof(int);
ncols /= sizeof(int);
}
-
+
for( i = 0; i < dst->rows; i++ )
{
const uchar* src_row = src->data.ptr + i*2*src->step;
elem_size /= sizeof(int);
ncols /= sizeof(int);
}
-
+
for( i = 0; i < src->rows; i++ )
{
const uchar* src_row = src->data.ptr + i*src->step;
//////////////////////// feature selection //////////////////////////
static const char* featuresel_param_names[] = { "block_size", "aperture", "size", "depth", 0 };
-static const int featuresel_block_size[] = { 3, 5, 11 };
+static const int featuresel_block_size[] = { 3, 5, 11 };
class CV_FeatureSelBaseTestImpl : public CvArrTest
{
int code = CvArrTest::write_default_params( fs );
if( code < 0 )
return code;
-
+
if( ts->get_testing_mode() == CvTS::CORRECTNESS_CHECK_MODE )
{
write_param( fs, "max_aperture_size", max_aperture_size );
CvMat *dx2 = 0, *dxdy = 0, *dy2 = 0;
CvMat* kernel = 0, *src2 = 0;
const CvMat* src = _src;
-
+
int type, ftype;
double denom;
CV_MAT_TYPE(eigenv->type) == CV_32FC1 );
assert( src->rows == eigenv->rows &&
- (mode > 0 && src->cols == eigenv->cols ||
- mode == 0 && src->cols*6 == eigenv->cols) );
+ ((mode > 0 && src->cols == eigenv->cols) ||
+ (mode == 0 && src->cols*6 == eigenv->cols)) );
type = CV_MAT_TYPE(src->type);
ftype = CV_32FC1;
-
+
CV_CALL( dx2 = cvCreateMat( src->rows, src->cols, ftype ));
CV_CALL( dy2 = cvCreateMat( src->rows, src->cols, ftype ));
CV_CALL( dxdy = cvCreateMat( src->rows, src->cols, ftype ));
cvTsAdd( src, cvScalarAll(1./255), 0, cvScalarAll(0.), cvScalarAll(0.), dx2, 0 );
src = dx2;
}
-
+
cvTsPrepareToFilter( src, src2, anchor, CV_TS_BORDER_REPLICATE );
cvTsCalcSobelKernel2D( 1, 0, _aperture_size, 0, kernel );
cvTsConvolve2D( src2, dx2, kernel, anchor );
CV_CALL( kernel = cvCreateMat( block_size, block_size, CV_32F ));
cvTsAdd( 0, cvScalarAll(0), 0, cvScalarAll(0), cvScalarAll(1./*(block_size*block_size)*/), kernel, 0 );
anchor = cvPoint( block_size/2, block_size/2 );
-
+
cvTsPrepareToFilter( dx2, src2, anchor, CV_TS_BORDER_REPLICATE );
cvTsConvolve2D( src2, dx2, kernel, anchor );
cvTsPrepareToFilter( dy2, src2, anchor, CV_TS_BORDER_REPLICATE );
/* the orientation of eigen vectors might be inversed relative to OpenCV function,
which is normal */
- if( fabs(x1) >= fabs(y1) && ocv_eigenvp[j*6+2]*x1 < 0 ||
- fabs(x1) < fabs(y1) && ocv_eigenvp[j*6+3]*y1 < 0 )
+ if( (fabs(x1) >= fabs(y1) && ocv_eigenvp[j*6+2]*x1 < 0) ||
+ (fabs(x1) < fabs(y1) && ocv_eigenvp[j*6+3]*y1 < 0) )
x1 = -x1, y1 = -y1;
- if( fabs(x2) >= fabs(y2) && ocv_eigenvp[j*6+4]*x2 < 0 ||
- fabs(x2) < fabs(y2) && ocv_eigenvp[j*6+5]*y2 < 0 )
+ if( (fabs(x2) >= fabs(y2) && ocv_eigenvp[j*6+4]*x2 < 0) ||
+ (fabs(x2) < fabs(y2) && ocv_eigenvp[j*6+5]*y2 < 0) )
x2 = -x2, y2 = -y2;
eigenvp[j*6] = (float)l1;
static const char* precorner_param_names[] = { "aperture", "size", "depth", 0 };
-static const int precorner_aperture[] = { 3, 5, 7 };
+static const int precorner_aperture[] = { 3, 5, 7 };
// precornerdetect
class CV_PreCornerDetectTest : public CV_FeatureSelBaseTest
int code = CV_FeatureSelBaseTest::write_default_params( fs );
if( code < 0 )
return code;
-
+
if( ts->get_testing_mode() == CvTS::TIMING_MODE )
{
start_write_param( fs );
int code = CvArrTest::write_default_params( fs );
if( code < 0 )
return code;
-
+
if( ts->get_testing_mode() == CvTS::TIMING_MODE )
{
int i;
- start_write_param( fs );
-
+ start_write_param( fs );
+
cvStartWriteStruct( fs, "sum_depth", CV_NODE_SEQ+CV_NODE_FLOW );
for( i = 0; integral_sum_depth[i] >= 0; i++ )
cvWriteString( fs, 0, cvTsGetTypeName(integral_sum_depth[i]) );
int cn = cvTsRandInt(rng) % 3 + 1;
CvArrTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize sum_size;
-
+
depth = depth == 0 ? CV_8U : CV_32F;
cn += cn == 2;
sum_depth = depth == CV_8U && (cvTsRandInt(rng) & 1) == 1 ? CV_32S : CV_64F;
if( cvTsRandInt(rng) % 3 > 0 )
{
sizes[OUTPUT][1] = sizes[REF_OUTPUT][1] = sum_size;
- if( cvTsRandInt(rng) % 2 > 0 && cn == 1 )
+ if( cvTsRandInt(rng) % 2 > 0 )
sizes[REF_OUTPUT][2] = sizes[OUTPUT][2] = sum_size;
}
double CV_IntegralTest::get_success_error_level( int /*test_case_idx*/, int i, int j )
{
int depth = CV_MAT_DEPTH(test_mat[i][j].type);
- return depth == CV_32S ? 0 : 1e-10;
+ return depth == CV_32S ? 0 : FLT_EPSILON;
}
int CV_IntegralTest::prepare_test_case( int test_case_idx )
{
int code = CvArrTest::prepare_test_case( test_case_idx );
- return code > 0 && (test_array[OUTPUT][2] && CV_MAT_CN(test_mat[OUTPUT][2].type) > 1 ||
+ return code > 0 && ((test_array[OUTPUT][2] && CV_MAT_CN(test_mat[OUTPUT][2].type) > 1) ||
CV_MAT_DEPTH(test_mat[OUTPUT][0].type) < CV_MAT_DEPTH(test_mat[INPUT][0].type)) ? 0 : code;
}
double t = x > 0 ? data[x-1] : 0, ts = t;
s += t;
sq += t*t;
-
+
sdata[x] = s + sdata[x - sstep];
if( sqdata )
sqdata[x] = sq + sqdata[x - sqstep];
-
+
if( !tdata )
continue;
-
+
if( x == 0 )
ts += tdata[-tstep+1];
else
CV_IntegralTest integral_test;
-
-