virtual int test(const Mat& img) = 0;\r
\r
int CheckNorm(const Mat& m1, const Mat& m2); \r
- int ChechSimilarity(const Mat& m1, const Mat& m2);\r
+ int CheckSimilarity(const Mat& m1, const Mat& m2, float max_err=1e-3f);\r
};\r
\r
\r
}\r
}\r
\r
-int CV_GpuImageProcTest::ChechSimilarity(const Mat& m1, const Mat& m2)\r
+int CV_GpuImageProcTest::CheckSimilarity(const Mat& m1, const Mat& m2, float max_err)\r
{\r
Mat diff;\r
cv::matchTemplate(m1, m2, diff, CV_TM_CCORR_NORMED);\r
\r
float err = abs(diff.at<float>(0, 0) - 1.f);\r
\r
- if (err > 1e-3f)\r
+ if (err > max_err)\r
return CvTS::FAIL_INVALID_OUTPUT;\r
\r
return CvTS::OK;\r
cv::gpu::resize(gpu1, gpu_res1, Size(), 2.0, 2.0, interpolations[i]);\r
cv::gpu::resize(gpu_res1, gpu_res2, Size(), 0.5, 0.5, interpolations[i]);\r
\r
- switch (img.depth())\r
- {\r
- case CV_8U: \r
- if (ChechSimilarity(cpu_res2, gpu_res2) != CvTS::OK)\r
- test_res = CvTS::FAIL_GENERIC;\r
- break;\r
- }\r
+ if (CheckSimilarity(cpu_res2, gpu_res2) != CvTS::OK)\r
+ test_res = CvTS::FAIL_GENERIC;\r
}\r
\r
return test_res;\r
GpuMat gpudst;\r
cv::gpu::warpAffine(gpu1, gpudst, M, gpu1.size(), flags[i]);\r
\r
- if (CheckNorm(cpudst, gpudst) != CvTS::OK)\r
+ if (CheckSimilarity(cpudst, gpudst, 3e-3f) != CvTS::OK)\r
test_res = CvTS::FAIL_GENERIC;\r
}\r
\r
GpuMat gpudst;\r
cv::gpu::warpPerspective(gpu1, gpudst, M, gpu1.size(), flags[i]);\r
\r
- if (CheckNorm(cpudst, gpudst) != CvTS::OK)\r
+ if (CheckSimilarity(cpudst, gpudst, 3e-3f) != CvTS::OK)\r
test_res = CvTS::FAIL_GENERIC;\r
}\r
\r