mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Merge pull request #21453 from sturkmen72:bigtiff
This commit is contained in:
commit
22f0bcaf8f
@ -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…
Reference in New Issue
Block a user