Commit 7fe4fbfc authored by Maria Dimashova's avatar Maria Dimashova

modified grabCut test to stable verification

parent cfda65a1
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
CV_GrabcutTest(); CV_GrabcutTest();
~CV_GrabcutTest(); ~CV_GrabcutTest();
protected: protected:
bool verify(const Mat& mask, const Mat& exp);
void run(int); void run(int);
}; };
...@@ -62,18 +63,15 @@ CV_GrabcutTest::CV_GrabcutTest(): CvTest( "segmentation-grabcut", "cv::grabCut" ...@@ -62,18 +63,15 @@ CV_GrabcutTest::CV_GrabcutTest(): CvTest( "segmentation-grabcut", "cv::grabCut"
} }
CV_GrabcutTest::~CV_GrabcutTest() {} CV_GrabcutTest::~CV_GrabcutTest() {}
bool verify(const Mat& mask, const Mat& exp) bool CV_GrabcutTest::verify(const Mat& mask, const Mat& exp)
{ {
if (0 == norm(mask, exp, NORM_INF)) const float maxDiffRatio = 0.005f;
return true; int expArea = countNonZero( exp );
int nonIntersectArea = countNonZero( mask != exp );
Mat mask_dilated, exp_dilated; float curRatio = (float)nonIntersectArea / (float)expArea;
ts->printf( CvTS::LOG, "nonIntersectArea/expArea = %f\n", curRatio );
const int inter_num = 2; return curRatio < maxDiffRatio;
dilate(mask, mask_dilated, Mat(), Point(-1, -1), inter_num);
dilate(exp, exp_dilated, Mat(), Point(-1, -1), inter_num);
return countNonZero(mask-exp_dilated) + countNonZero(mask_dilated-exp) == 0;
} }
void CV_GrabcutTest::run( int /* start_from */) void CV_GrabcutTest::run( int /* start_from */)
......
...@@ -53,7 +53,6 @@ const char* blacklist[] = ...@@ -53,7 +53,6 @@ const char* blacklist[] =
"latentsvmdetector", //ticket 661 "latentsvmdetector", //ticket 661
"warp-affine", //ticket 572 "warp-affine", //ticket 572
"warp-perspective", //ticket 575 "warp-perspective", //ticket 575
"segmentation-grabcut", //ticket 666
"_3d-fundam", //ticket 434 "_3d-fundam", //ticket 434
"posit", //ticket 430 "posit", //ticket 430
0 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment