1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #26181 from sturkmen72:png_exif_test

Enable PNG exif orientation test
This commit is contained in:
Alexander Smorkalov
2024-11-13 16:57:18 +03:00
committed by GitHub
6 changed files with 155 additions and 229 deletions
-45
View File
@@ -187,51 +187,6 @@ INSTANTIATE_TEST_CASE_P(
////////////////////////////////////////////////////////////////////////////////
typedef testing::TestWithParam<string> Imgcodecs_AVIF_Exif;
TEST_P(Imgcodecs_AVIF_Exif, exif_orientation) {
const string root = cvtest::TS::ptr()->get_data_path();
const string filename = root + GetParam();
const int colorThresholdHigh = 250;
const int colorThresholdLow = 5;
Mat m_img = imread(filename);
ASSERT_FALSE(m_img.empty());
Vec3b vec;
// Checking the first quadrant (with supposed red)
vec = m_img.at<Vec3b>(2, 2); // some point inside the square
EXPECT_LE(vec.val[0], colorThresholdLow);
EXPECT_LE(vec.val[1], colorThresholdLow);
EXPECT_GE(vec.val[2], colorThresholdHigh);
// Checking the second quadrant (with supposed green)
vec = m_img.at<Vec3b>(2, 7); // some point inside the square
EXPECT_LE(vec.val[0], colorThresholdLow);
EXPECT_GE(vec.val[1], colorThresholdHigh);
EXPECT_LE(vec.val[2], colorThresholdLow);
// Checking the third quadrant (with supposed blue)
vec = m_img.at<Vec3b>(7, 2); // some point inside the square
EXPECT_GE(vec.val[0], colorThresholdHigh);
EXPECT_LE(vec.val[1], colorThresholdLow);
EXPECT_LE(vec.val[2], colorThresholdLow);
}
const string exif_files[] = {"readwrite/testExifOrientation_1.avif",
"readwrite/testExifOrientation_2.avif",
"readwrite/testExifOrientation_3.avif",
"readwrite/testExifOrientation_4.avif",
"readwrite/testExifOrientation_5.avif",
"readwrite/testExifOrientation_6.avif",
"readwrite/testExifOrientation_7.avif",
"readwrite/testExifOrientation_8.avif"};
INSTANTIATE_TEST_CASE_P(ExifFiles, Imgcodecs_AVIF_Exif,
testing::ValuesIn(exif_files));
////////////////////////////////////////////////////////////////////////////////
class Imgcodecs_Avif_Animation_RoundTripSuite
: public Imgcodecs_Avif_RoundTripSuite {
public: