bigtiff images reading

pull/21453/head
Suleyman TURKMEN 3 years ago
parent 60228d30d1
commit f1857030b5
  1. 6
      modules/imgcodecs/src/grfmt_tiff.cpp
  2. 23
      modules/imgcodecs/test/test_tiff.cpp

@ -112,6 +112,8 @@ static bool cv_tiffSetErrorHandler()
static const char fmtSignTiffII[] = "II\x2a\x00";
static const char fmtSignTiffMM[] = "MM\x00\x2a";
static const char fmtSignBigTiffII[] = "II\x2b\x00";
static const char fmtSignBigTiffMM[] = "MM\x00\x2b";
TiffDecoder::TiffDecoder()
{
@ -140,7 +142,9 @@ bool TiffDecoder::checkSignature( const String& signature ) const
{
return signature.size() >= 4 &&
(memcmp(signature.c_str(), fmtSignTiffII, 4) == 0 ||
memcmp(signature.c_str(), fmtSignTiffMM, 4) == 0);
memcmp(signature.c_str(), fmtSignTiffMM, 4) == 0 ||
memcmp(signature.c_str(), fmtSignBigTiffII, 4) == 0 ||
memcmp(signature.c_str(), fmtSignBigTiffMM, 4) == 0);
}
int TiffDecoder::normalizeChannelsNumber(int channels) const

@ -455,6 +455,29 @@ TEST(Imgcodecs_Tiff, read_multipage_indexed)
}
}
TEST(Imgcodecs_Tiff, read_bigtiff_images)
{
const string root = cvtest::TS::ptr()->get_data_path();
const string filenamesInput[] = {
"readwrite/BigTIFF.tif",
"readwrite/BigTIFFMotorola.tif",
"readwrite/BigTIFFLong.tif",
"readwrite/BigTIFFLong8.tif",
"readwrite/BigTIFFMotorolaLongStrips.tif",
"readwrite/BigTIFFLong8Tiles.tif",
"readwrite/BigTIFFSubIFD4.tif",
"readwrite/BigTIFFSubIFD8.tif"
};
for (int i = 0; i < 8; i++)
{
const Mat bigtiff_img = imread(root + filenamesInput[i], IMREAD_UNCHANGED);
ASSERT_FALSE(bigtiff_img.empty());
EXPECT_EQ(64, bigtiff_img.cols);
EXPECT_EQ(64, bigtiff_img.rows);
ASSERT_EQ(CV_8UC3, bigtiff_img.type());
}
}
#endif

Loading…
Cancel
Save