Merge pull request #26114 from savuor:rv/rgb2gray_bit_exact

Added bit-exact tests for RGB2Gray
This commit is contained in:
Alexander Smorkalov 2024-09-05 11:29:29 +03:00 committed by GitHub
commit 06db881ca9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -455,7 +455,7 @@ void CV_ColorGrayTest::get_test_array_types_and_sizes( int test_case_idx, vector
double CV_ColorGrayTest::get_success_error_level( int /*test_case_idx*/, int i, int j )
{
int depth = test_mat[i][j].depth();
return depth == CV_8U ? 2 : depth == CV_16U ? 16 : 1e-5;
return depth == CV_8U ? 1 : depth == CV_16U ? 2 : 1e-5;
}
@ -2844,6 +2844,11 @@ void runCvtColorBitExactCheck(ColorConversionCodes code, int inputType, uint32_t
}
}
TEST(Imgproc_cvtColor_BE, COLOR_RGB2GRAY) { runCvtColorBitExactCheck(COLOR_RGB2GRAY, CV_8UC3, 0x416bd44a); }
TEST(Imgproc_cvtColor_BE, COLOR_RGBA2GRAY) { runCvtColorBitExactCheck(COLOR_RGBA2GRAY, CV_8UC3, 0x416bd44a); }
TEST(Imgproc_cvtColor_BE, COLOR_BGR2GRAY) { runCvtColorBitExactCheck(COLOR_BGR2GRAY, CV_8UC3, 0x3008c6b8); }
TEST(Imgproc_cvtColor_BE, COLOR_BGRA2GRAY) { runCvtColorBitExactCheck(COLOR_BGRA2GRAY, CV_8UC3, 0x3008c6b8); }
TEST(Imgproc_cvtColor_BE, COLOR_BGR2YUV) { runCvtColorBitExactCheck(COLOR_BGR2YUV, CV_8UC3, 0xc2cbcfda); }
TEST(Imgproc_cvtColor_BE, COLOR_RGB2YUV) { runCvtColorBitExactCheck(COLOR_RGB2YUV, CV_8UC3, 0x4e98e757); }
TEST(Imgproc_cvtColor_BE, COLOR_YUV2BGR) { runCvtColorBitExactCheck(COLOR_YUV2BGR, CV_8UC3, 0xb2c62a3f); }