From f3199a0701b8029cdbcc46896d72f60aa14dcf61 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Sat, 4 May 2024 11:28:01 +0300 Subject: [PATCH] Update imgcodecs tests --- modules/highgui/src/window_w32.cpp | 2 +- modules/imgcodecs/test/test_avif.cpp | 4 ++-- modules/imgcodecs/test/test_common.cpp | 2 +- modules/imgcodecs/test/test_grfmt.cpp | 6 ++++++ modules/imgcodecs/test/test_jpeg.cpp | 6 +++--- modules/imgcodecs/test/test_read_write.cpp | 4 +++- modules/imgcodecs/test/test_tiff.cpp | 2 +- modules/imgcodecs/test/test_webp.cpp | 6 +++--- modules/video/test/test_optflowpyrlk.cpp | 2 +- 9 files changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index 98f876a34fbd..32b239290407 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -2161,7 +2161,7 @@ static void showSaveDialog(CvWindow& window) #ifdef HAVE_TIFF "TIFF Files (*.tiff;*.tif)\0*.tiff;*.tif\0" #endif -#ifdef HAVE_JASPER +#if defined(HAVE_JASPER) || defined(HAVE_OPENJPEG) "JPEG-2000 files (*.jp2)\0*.jp2\0" #endif #ifdef HAVE_WEBP diff --git a/modules/imgcodecs/test/test_avif.cpp b/modules/imgcodecs/test/test_avif.cpp index 72b7f54feaa5..95c9581432bb 100644 --- a/modules/imgcodecs/test/test_avif.cpp +++ b/modules/imgcodecs/test/test_avif.cpp @@ -95,7 +95,7 @@ class Imgcodecs_Avif_Image_RoundTripSuite // bit depth. static void SetUpTestCase() { const string root = cvtest::TS::ptr()->get_data_path(); - const string filename = root + "../cv/shared/lena.png"; + const string filename = root + "../cv/shared/baboon.bmp"; const cv::Mat img_original = cv::imread(filename); cv::Mat img_resized; cv::resize(img_original, img_resized, cv::Size(kWidth, kHeight), 0, 0); @@ -244,7 +244,7 @@ class Imgcodecs_Avif_Animation_RoundTripSuite // bit depth. static void SetUpTestCase() { const string root = cvtest::TS::ptr()->get_data_path(); - const string filename = root + "../cv/shared/lena.png"; + const string filename = root + "../cv/shared/baboon.bmp"; const cv::Mat img_original = cv::imread(filename); cv::Mat img_resized; cv::resize(img_original, img_resized, cv::Size(kWidth, kHeight), 0, 0); diff --git a/modules/imgcodecs/test/test_common.cpp b/modules/imgcodecs/test/test_common.cpp index a0addafa8024..f4c438c8b3b6 100644 --- a/modules/imgcodecs/test/test_common.cpp +++ b/modules/imgcodecs/test/test_common.cpp @@ -12,7 +12,7 @@ Mat generateTestImageBGR_() Size sz(640, 480); Mat result(sz, CV_8UC3, Scalar::all(0)); - const string fname = cvtest::findDataFile("../cv/shared/baboon.png"); + const string fname = cvtest::findDataFile("../cv/shared/baboon.bmp"); Mat image = imread(fname, IMREAD_COLOR); CV_Assert(!image.empty()); CV_CheckEQ(image.size(), Size(512, 512), ""); diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp index 826f3d983653..1e0bf47b4713 100644 --- a/modules/imgcodecs/test/test_grfmt.cpp +++ b/modules/imgcodecs/test/test_grfmt.cpp @@ -87,11 +87,17 @@ const string all_images[] = "readwrite/uint16-mono2.dcm", "readwrite/uint8-rgb.dcm", #endif +#if defined(HAVE_PNG) || defined(HAVE_SPNG) "readwrite/color_palette_alpha.png", +#endif +#ifdef HAVE_TIFF "readwrite/multipage.tif", +#endif "readwrite/ordinary.bmp", "readwrite/rle8.bmp", +#ifdef HAVE_JPEG "readwrite/test_1_c1.jpg", +#endif #ifdef HAVE_IMGCODEC_HDR "readwrite/rle.hdr" #endif diff --git a/modules/imgcodecs/test/test_jpeg.cpp b/modules/imgcodecs/test/test_jpeg.cpp index 12abc0a8e3ed..120e93b57b35 100644 --- a/modules/imgcodecs/test/test_jpeg.cpp +++ b/modules/imgcodecs/test/test_jpeg.cpp @@ -106,7 +106,7 @@ TEST(Imgcodecs_Jpeg, encode_empty) TEST(Imgcodecs_Jpeg, encode_decode_progressive_jpeg) { cvtest::TS& ts = *cvtest::TS::ptr(); - string input = string(ts.get_data_path()) + "../cv/shared/lena.png"; + string input = string(ts.get_data_path()) + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(input); ASSERT_FALSE(img.empty()); @@ -131,7 +131,7 @@ TEST(Imgcodecs_Jpeg, encode_decode_progressive_jpeg) TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg) { cvtest::TS& ts = *cvtest::TS::ptr(); - string input = string(ts.get_data_path()) + "../cv/shared/lena.png"; + string input = string(ts.get_data_path()) + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(input); ASSERT_FALSE(img.empty()); @@ -156,7 +156,7 @@ TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg) TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg) { cvtest::TS& ts = *cvtest::TS::ptr(); - string input = string(ts.get_data_path()) + "../cv/shared/lena.png"; + string input = string(ts.get_data_path()) + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(input); ASSERT_FALSE(img.empty()); diff --git a/modules/imgcodecs/test/test_read_write.cpp b/modules/imgcodecs/test/test_read_write.cpp index 2320147a4ecc..7b56e55b7642 100644 --- a/modules/imgcodecs/test/test_read_write.cpp +++ b/modules/imgcodecs/test/test_read_write.cpp @@ -286,7 +286,7 @@ TEST(Imgcodecs_Image, regression_9376) TEST(Imgcodecs_Image, write_umat) { - const string src_name = TS::ptr()->get_data_path() + "../python/images/baboon.bmp"; + const string src_name = TS::ptr()->get_data_path() + "../cv/shared/baboon.bmp"; const string dst_name = cv::tempfile(".bmp"); Mat image1 = imread(src_name); @@ -303,6 +303,7 @@ TEST(Imgcodecs_Image, write_umat) EXPECT_EQ(0, remove(dst_name.c_str())); } +#ifdef HAVE_TIFF TEST(Imgcodecs_Image, multipage_collection_size) { const string root = cvtest::TS::ptr()->get_data_path(); @@ -479,6 +480,7 @@ TEST(ImgCodecs, multipage_collection_two_iterator_operatorpp) EXPECT_TRUE(cv::norm(img1, img[i], NORM_INF) == 0); } } +#endif TEST(Imgcodecs_Params, imwrite_regression_22752) diff --git a/modules/imgcodecs/test/test_tiff.cpp b/modules/imgcodecs/test/test_tiff.cpp index ee40c54b59dd..7e41f94a7393 100644 --- a/modules/imgcodecs/test/test_tiff.cpp +++ b/modules/imgcodecs/test/test_tiff.cpp @@ -1112,7 +1112,7 @@ TEST(Imgcodecs_Tiff_Modes, write_multipage) TEST(Imgcodecs_Tiff, imdecode_no_exception_temporary_file_removed) { const string root = cvtest::TS::ptr()->get_data_path(); - const string filename = root + "../cv/shared/lena.png"; + const string filename = root + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(filename); ASSERT_FALSE(img.empty()); std::vector buf; diff --git a/modules/imgcodecs/test/test_webp.cpp b/modules/imgcodecs/test/test_webp.cpp index 1f2cad7d89c1..552ec1ea1752 100644 --- a/modules/imgcodecs/test/test_webp.cpp +++ b/modules/imgcodecs/test/test_webp.cpp @@ -10,7 +10,7 @@ namespace opencv_test { namespace { TEST(Imgcodecs_WebP, encode_decode_lossless_webp) { const string root = cvtest::TS::ptr()->get_data_path(); - string filename = root + "../cv/shared/lena.png"; + string filename = root + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(filename); ASSERT_FALSE(img.empty()); @@ -59,7 +59,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossless_webp) TEST(Imgcodecs_WebP, encode_decode_lossy_webp) { const string root = cvtest::TS::ptr()->get_data_path(); - std::string input = root + "../cv/shared/lena.png"; + std::string input = root + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(input); ASSERT_FALSE(img.empty()); @@ -83,7 +83,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossy_webp) TEST(Imgcodecs_WebP, encode_decode_with_alpha_webp) { const string root = cvtest::TS::ptr()->get_data_path(); - std::string input = root + "../cv/shared/lena.png"; + std::string input = root + "../cv/shared/baboon.bmp"; cv::Mat img = cv::imread(input); ASSERT_FALSE(img.empty()); diff --git a/modules/video/test/test_optflowpyrlk.cpp b/modules/video/test/test_optflowpyrlk.cpp index 6e0ee3756e08..c7c6f2d0abfe 100644 --- a/modules/video/test/test_optflowpyrlk.cpp +++ b/modules/video/test/test_optflowpyrlk.cpp @@ -220,7 +220,7 @@ TEST(Video_OpticalFlowPyrLK, accuracy) { CV_OptFlowPyrLKTest test; test.safe_run TEST(Video_OpticalFlowPyrLK, submat) { // see bug #2075 - std::string path = cvtest::TS::ptr()->get_data_path() + "../cv/shared/lena.png"; + std::string path = cvtest::TS::ptr()->get_data_path() + "../cv/shared/baboon.bmp"; cv::Mat lenaImg = cv::imread(path); ASSERT_FALSE(lenaImg.empty());