enabling sanity checks for warp and resize functions on Android
- add syntetic images generation function to ts - use generated syntetic images
This commit is contained in:
@@ -28,24 +28,23 @@ PERF_TEST_P( TestWarpAffine, WarpAffine,
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz;
|
||||
Size sz, szSrc(512, 512);
|
||||
int borderMode, interType;
|
||||
sz = get<0>(GetParam());
|
||||
interType = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
Scalar borderColor = Scalar::all(150);
|
||||
|
||||
Mat src, img = imread(getDataPath("cv/shared/fruits.png"));
|
||||
cvtColor(img, src, COLOR_BGR2RGBA, 4);
|
||||
Mat src(szSrc,CV_8UC4), dst(sz, CV_8UC4);
|
||||
cvtest::fillGradient(src);
|
||||
if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
|
||||
Mat warpMat = getRotationMatrix2D(Point2f(src.cols/2.f, src.rows/2.f), 30., 2.2);
|
||||
Mat dst(sz, CV_8UC4);
|
||||
|
||||
declare.in(src).out(dst);
|
||||
|
||||
TEST_CYCLE() warpAffine( src, dst, warpMat, sz, interType, borderMode, Scalar::all(150) );
|
||||
TEST_CYCLE() warpAffine( src, dst, warpMat, sz, interType, borderMode, borderColor );
|
||||
|
||||
// Test case temporary disabled for Android Platform
|
||||
#ifdef ANDROID
|
||||
SANITY_CHECK(dst, 255); // TODO: Reimplement check in future versions
|
||||
SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10);
|
||||
#else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#endif
|
||||
@@ -59,15 +58,16 @@ PERF_TEST_P( TestWarpPerspective, WarpPerspective,
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz;
|
||||
Size sz, szSrc(512, 512);
|
||||
int borderMode, interType;
|
||||
sz = get<0>(GetParam());
|
||||
interType = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
Scalar borderColor = Scalar::all(150);
|
||||
|
||||
|
||||
Mat src, img = imread(getDataPath("cv/shared/fruits.png"));
|
||||
cvtColor(img, src, COLOR_BGR2RGBA, 4);
|
||||
Mat src(szSrc,CV_8UC4), dst(sz, CV_8UC4);
|
||||
cvtest::fillGradient(src);
|
||||
if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
|
||||
Mat rotMat = getRotationMatrix2D(Point2f(src.cols/2.f, src.rows/2.f), 30., 2.2);
|
||||
Mat warpMat(3, 3, CV_64FC1);
|
||||
for(int r=0; r<2; r++)
|
||||
@@ -76,13 +76,16 @@ PERF_TEST_P( TestWarpPerspective, WarpPerspective,
|
||||
warpMat.at<double>(2, 0) = .3/sz.width;
|
||||
warpMat.at<double>(2, 1) = .3/sz.height;
|
||||
warpMat.at<double>(2, 2) = 1;
|
||||
Mat dst(sz, CV_8UC4);
|
||||
|
||||
declare.in(src).out(dst);
|
||||
|
||||
TEST_CYCLE() warpPerspective( src, dst, warpMat, sz, interType, borderMode, Scalar::all(150) );
|
||||
TEST_CYCLE() warpPerspective( src, dst, warpMat, sz, interType, borderMode, borderColor );
|
||||
|
||||
#ifdef ANDROID
|
||||
SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10);
|
||||
#else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
|
||||
@@ -105,24 +108,11 @@ PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
|
||||
interType = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
type = get<3>(GetParam());
|
||||
Scalar borderColor = Scalar::all(150);
|
||||
|
||||
Mat src, img = imread(getDataPath("cv/shared/5MP.png"));
|
||||
|
||||
if( type == CV_8UC1 )
|
||||
{
|
||||
cvtColor(img, src, COLOR_BGR2GRAY, 1);
|
||||
}
|
||||
else if( type == CV_8UC4 )
|
||||
{
|
||||
cvtColor(img, src, COLOR_BGR2BGRA, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL();
|
||||
}
|
||||
|
||||
resize(src, src, size);
|
||||
|
||||
Mat src(size, type), dst(size, type);
|
||||
cvtest::fillGradient(src);
|
||||
if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
|
||||
int shift = static_cast<int>(src.cols*0.04);
|
||||
Mat srcVertices = (Mat_<Vec2f>(1, 4) << Vec2f(0, 0),
|
||||
Vec2f(static_cast<float>(size.width-1), 0),
|
||||
@@ -134,19 +124,16 @@ PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
|
||||
Vec2f(static_cast<float>(shift/2), static_cast<float>(size.height-1)));
|
||||
Mat warpMat = getPerspectiveTransform(srcVertices, dstVertices);
|
||||
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src).out(dst);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
warpPerspective( src, dst, warpMat, size, interType, borderMode, Scalar::all(150) );
|
||||
warpPerspective( src, dst, warpMat, size, interType, borderMode, borderColor );
|
||||
}
|
||||
|
||||
// Test case temporary disabled for Android Platform
|
||||
#ifdef ANDROID
|
||||
SANITY_CHECK(dst, 255); // TODO: Reimplement check in future versions
|
||||
SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10);
|
||||
#else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user