Skip to content

Commit 9ef574a

Browse files
author
Rostislav Vasilikhin
committed
added bit-exact tests for RGB2Gray
1 parent 76f495d commit 9ef574a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/imgproc/test/test_color.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void CV_ColorGrayTest::get_test_array_types_and_sizes( int test_case_idx, vector
455455
double CV_ColorGrayTest::get_success_error_level( int /*test_case_idx*/, int i, int j )
456456
{
457457
int depth = test_mat[i][j].depth();
458-
return depth == CV_8U ? 2 : depth == CV_16U ? 16 : 1e-5;
458+
return depth == CV_8U ? 1 : depth == CV_16U ? 2 : 1e-5;
459459
}
460460

461461

@@ -2844,6 +2844,11 @@ void runCvtColorBitExactCheck(ColorConversionCodes code, int inputType, uint32_t
28442844
}
28452845
}
28462846

2847+
TEST(Imgproc_cvtColor_BE, COLOR_RGB2GRAY) { runCvtColorBitExactCheck(COLOR_RGB2GRAY, CV_8UC3, 0x416bd44a); }
2848+
TEST(Imgproc_cvtColor_BE, COLOR_RGBA2GRAY) { runCvtColorBitExactCheck(COLOR_RGBA2GRAY, CV_8UC3, 0x416bd44a); }
2849+
TEST(Imgproc_cvtColor_BE, COLOR_BGR2GRAY) { runCvtColorBitExactCheck(COLOR_BGR2GRAY, CV_8UC3, 0x3008c6b8); }
2850+
TEST(Imgproc_cvtColor_BE, COLOR_BGRA2GRAY) { runCvtColorBitExactCheck(COLOR_BGRA2GRAY, CV_8UC3, 0x3008c6b8); }
2851+
28472852
TEST(Imgproc_cvtColor_BE, COLOR_BGR2YUV) { runCvtColorBitExactCheck(COLOR_BGR2YUV, CV_8UC3, 0xc2cbcfda); }
28482853
TEST(Imgproc_cvtColor_BE, COLOR_RGB2YUV) { runCvtColorBitExactCheck(COLOR_RGB2YUV, CV_8UC3, 0x4e98e757); }
28492854
TEST(Imgproc_cvtColor_BE, COLOR_YUV2BGR) { runCvtColorBitExactCheck(COLOR_YUV2BGR, CV_8UC3, 0xb2c62a3f); }

0 commit comments

Comments
 (0)