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

imgcodecs: ensure parameters are key-value pairs, fix HDR encoder

This commit is contained in:
Alexander Alekhin
2022-11-18 18:09:26 +00:00
parent d9f66413ee
commit f0df78b7e7
6 changed files with 119 additions and 19 deletions
@@ -288,4 +288,23 @@ TEST(Imgcodecs_Image, write_umat)
EXPECT_EQ(0, remove(dst_name.c_str()));
}
TEST(Imgcodecs_Params, imwrite_regression_22752)
{
const Mat img(16, 16, CV_8UC3, cv::Scalar::all(0));
vector<int> params;
params.push_back(IMWRITE_JPEG_QUALITY);
// params.push_back(100)); // Forget it.
EXPECT_ANY_THROW(cv::imwrite("test.jpg", img, params)); // parameters size or missing JPEG codec
}
TEST(Imgcodecs_Params, imencode_regression_22752)
{
const Mat img(16, 16, CV_8UC3, cv::Scalar::all(0));
vector<int> params;
params.push_back(IMWRITE_JPEG_QUALITY);
// params.push_back(100)); // Forget it.
vector<uchar> buf;
EXPECT_ANY_THROW(cv::imencode("test.jpg", img, buf, params)); // parameters size or missing JPEG codec
}
}} // namespace