1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #20875 from Harvey-Huang:master

* bmp specified BI_BITFIELDS should take care RGBA bit mask

* change the name

* support xrgb bmp file

* support xrgb bmp file(add test case)

* update testing code
This commit is contained in:
Harvey
2021-10-22 22:04:19 +08:00
committed by GitHub
parent d376fe9e17
commit 9267536fee
3 changed files with 84 additions and 3 deletions
+26
View File
@@ -295,6 +295,32 @@ TEST(Imgcodecs_Bmp, read_rle8)
EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), rle, ord);
}
TEST(Imgcodecs_Bmp, rgba_bit_mask)
{
const string root = cvtest::TS::ptr()->get_data_path();
const string filenameInput = root + "readwrite/test_rgba_mask.bmp";
const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
ASSERT_FALSE(img.empty());
ASSERT_EQ(CV_8UC4, img.type());
const uchar* data = img.ptr();
ASSERT_EQ(data[3], 255);
}
TEST(Imgcodecs_Bmp, read_32bit_xrgb)
{
const string root = cvtest::TS::ptr()->get_data_path();
const string filenameInput = root + "readwrite/test_32bit_xrgb.bmp";
const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
ASSERT_FALSE(img.empty());
ASSERT_EQ(CV_8UC4, img.type());
const uchar* data = img.ptr();
ASSERT_EQ(data[3], 255);
}
#ifdef HAVE_IMGCODEC_HDR
TEST(Imgcodecs_Hdr, regression)
{