\r
virtual int test(const Mat& img) = 0;\r
\r
- int CheckNorm(const Mat& m1, const Mat& m2); \r
+ int CheckNorm(const Mat& m1, const Mat& m2);\r
+\r
+ // Checks whether two images are similar enough using normalized\r
+ // cross-correlation as an error measure\r
int CheckSimilarity(const Mat& m1, const Mat& m2, float max_err=1e-3f);\r
};\r
\r
int CV_GpuImageProcTest::test32FC1(const Mat& img)\r
{\r
cv::Mat temp, img_C1;\r
- img.convertTo(temp, CV_32F);\r
+ img.convertTo(temp, CV_32F, 1.f / 255.f);\r
cvtColor(temp, img_C1, CV_BGR2GRAY);\r
\r
return test(img_C1);\r
return CvTS::OK;\r
}\r
\r
- static const double coeffs[2][3] =\r
- {\r
- {cos(3.14 / 6), -sin(3.14 / 6), 100.0},\r
- {sin(3.14 / 6), cos(3.14 / 6), -100.0}\r
- };\r
- Mat M(2, 3, CV_64F, (void*)coeffs);\r
+ static double reflect[2][3] = { {-1, 0, 0},\r
+ { 0, -1, 0} };\r
+ reflect[0][2] = img.cols;\r
+ reflect[1][2] = img.rows;\r
+\r
+ Mat M(2, 3, CV_64F, (void*)reflect);\r
\r
int flags[] = {INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_NEAREST | WARP_INVERSE_MAP, INTER_LINEAR | WARP_INVERSE_MAP, INTER_CUBIC | WARP_INVERSE_MAP};\r
const char* flags_str[] = {"INTER_NEAREST", "INTER_LINEAR", "INTER_CUBIC", "INTER_NEAREST | WARP_INVERSE_MAP", "INTER_LINEAR | WARP_INVERSE_MAP", "INTER_CUBIC | WARP_INVERSE_MAP"};\r
GpuMat gpudst;\r
cv::gpu::warpAffine(gpu1, gpudst, M, gpu1.size(), flags[i]);\r
\r
- if (CheckSimilarity(cpudst, gpudst, 3e-3f) != CvTS::OK)\r
+ // Check inner parts (ignoring 1 pixel width border)\r
+ if (CheckSimilarity(cpudst.rowRange(1, cpudst.rows - 1).colRange(1, cpudst.cols - 1),\r
+ gpudst.rowRange(1, gpudst.rows - 1).colRange(1, gpudst.cols - 1)) != CvTS::OK)\r
test_res = CvTS::FAIL_GENERIC;\r
}\r
\r
return CvTS::OK;\r
}\r
\r
- static const double coeffs[3][3] =\r
- {\r
- {cos(3.14 / 6), -sin(3.14 / 6), 100.0},\r
- {sin(3.14 / 6), cos(3.14 / 6), -100.0},\r
- {0.0, 0.0, 1.0}\r
- };\r
- Mat M(3, 3, CV_64F, (void*)coeffs);\r
+ static double reflect[3][3] = { { -1, 0, 0},\r
+ { 0, -1, 0},\r
+ { 0, 0, 1 }};\r
+ reflect[0][2] = img.cols;\r
+ reflect[1][2] = img.rows;\r
+ Mat M(3, 3, CV_64F, (void*)reflect);\r
\r
int flags[] = {INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_NEAREST | WARP_INVERSE_MAP, INTER_LINEAR | WARP_INVERSE_MAP, INTER_CUBIC | WARP_INVERSE_MAP};\r
const char* flags_str[] = {"INTER_NEAREST", "INTER_LINEAR", "INTER_CUBIC", "INTER_NEAREST | WARP_INVERSE_MAP", "INTER_LINEAR | WARP_INVERSE_MAP", "INTER_CUBIC | WARP_INVERSE_MAP"};\r
GpuMat gpudst;\r
cv::gpu::warpPerspective(gpu1, gpudst, M, gpu1.size(), flags[i]);\r
\r
- if (CheckSimilarity(cpudst, gpudst, 3e-3f) != CvTS::OK)\r
+ // Check inner parts (ignoring 1 pixel width border)\r
+ if (CheckSimilarity(cpudst.rowRange(1, cpudst.rows - 1).colRange(1, cpudst.cols - 1),\r
+ gpudst.rowRange(1, gpudst.rows - 1).colRange(1, gpudst.cols - 1)) != CvTS::OK)\r
test_res = CvTS::FAIL_GENERIC;\r
}\r
\r