1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-28 23:03:03 +04:00

fixed canny test; fixed mhi-global test & implementation (hopefully, for the last time); added sse 4.1 & 4.2 support (not working in Xcode for some reason); moved splineInterpolation to color.cpp; fixed a few bugs in documentation

This commit is contained in:
Vadim Pisarevsky
2010-11-24 09:46:46 +00:00
parent 0e43976259
commit d366c0b2fa
9 changed files with 452 additions and 750 deletions
+44
View File
@@ -52,6 +52,7 @@ protected:
int prepare_test_case( int test_case_idx );
void run_func();
void prepare_to_validation( int );
int validate_test_results( int /*test_case_idx*/ );
int aperture_size, use_true_gradient;
double threshold1, threshold2;
@@ -271,8 +272,51 @@ void CV_CannyTest::prepare_to_validation( int )
{
icvTsCanny( &test_mat[INPUT][0], &test_mat[REF_OUTPUT][0],
threshold1, threshold2, aperture_size, use_true_gradient );
/*cv::Mat output(&test_mat[OUTPUT][0]);
cv::Mat ref_output(&test_mat[REF_OUTPUT][0]);
cv::absdiff(output, ref_output, output);
cv::namedWindow("ref test", 0);
cv::imshow("ref test", ref_output);
cv::namedWindow("test", 0);
cv::imshow("test", output);
cv::waitKey();*/
}
int CV_CannyTest::validate_test_results( int test_case_idx )
{
int code = CvTS::OK, nz0;
prepare_to_validation(test_case_idx);
double err = cvNorm(&test_mat[OUTPUT][0], &test_mat[REF_OUTPUT][0], CV_L1);
if( err == 0 )
goto _exit_;
if( err != cvRound(err) || cvRound(err)%255 != 0 )
{
ts->printf( CvTS::LOG, "Some of the pixels, produced by Canny, are not 0's or 255's; the difference is %g\n", err );
code = CvTS::FAIL_INVALID_OUTPUT;
goto _exit_;
}
nz0 = cvCountNonZero(&test_mat[REF_OUTPUT][0]);
err = (err/255/MAX(nz0,100))*100;
if( err > 1 )
{
ts->printf( CvTS::LOG, "Too high percentage of non-matching edge pixels = %g%%\n", err);
code = CvTS::FAIL_BAD_ACCURACY;
goto _exit_;
}
_exit_:
if( code < 0 )
ts->set_failed_test_info( code );
return code;
}
CV_CannyTest canny_test;
/* End of file. */
+4 -5
View File
@@ -484,11 +484,10 @@ cvTsCalcGlobalOrientation( const CvMat* orient, const CvMat* mask, const CvMat*
for( x = 0; x < orient->cols; x++ )
{
if( mask_data[x] )
if( mask_data[x] && mhi_data[x] > low_time )
{
double diff = orient_data[x] - base_orientation;
double delta_weight = mhi_data[x] >= low_time ?
(((mhi_data[x] - low_time)/duration)*254 + 1)/255 : 0;
double delta_weight = (((mhi_data[x] - low_time)/duration)*254 + 1)/255;
if( diff < -180 ) diff += 360;
if( diff > 180 ) diff -= 360;
@@ -506,7 +505,7 @@ cvTsCalcGlobalOrientation( const CvMat* orient, const CvMat* mask, const CvMat*
global_orientation = base_orientation;
else
{
global_orientation = base_orientation + cvRound(delta_orientation/weight);
global_orientation = base_orientation + delta_orientation/weight;
if( global_orientation < 0 ) global_orientation += 360;
if( global_orientation > 360 ) global_orientation -= 360;
}
@@ -594,7 +593,7 @@ void CV_MHIGlobalOrientTest::get_minmax_bounds( int i, int j, int type, CvScalar
double CV_MHIGlobalOrientTest::get_success_error_level( int /*test_case_idx*/, int /*i*/, int /*j*/ )
{
return 30;
return 15;
}
+2 -2
View File
@@ -48,8 +48,8 @@ const char* blacklist[] =
"calibrate-camera-artificial", //ticket 472
"inpaint", //ticket 570
"warp-resize", //ticket 429
"mhi-global", //ticket 457
"canny", //ticket 702
//"mhi-global", //ticket 457
//"canny", //ticket 702
0
};