【发布时间】:2017-06-29 16:12:16
【问题描述】:
我有这个代码:
ifstream istream;
std::string line;
TIFHEAD header;
istream.open("pic.tif",ios::binary|ios::in);
istream.read((char*)&header, sizeof(TIFHEAD));
cout<<hex<<header.Identifier<<" "<<header.Version<<" "<<header.IFDOffset<<endl<<endl;
istream.seekg(header.IFDOffset);
WORD numEntries1;
istream.read((char *)&numEntries1, sizeof(WORD));
cout<<numEntries1<<endl;
DWORD tagOffset;
DWORD stripByte;
for(int i=0; i<numEntries1; i++) {
TIFTAG tag;
istream.read((char *)&tag, sizeof(TIFTAG));
cout<<istream.tellg()<<":"<<tag.TagId<<" "<<tag.DataType<<" "<<tag.DataCount<<" "<<tag.DataOffset<<endl;
}
我还在 pic.tif 上做了一个 hexdump,得到了大约 450 行十六进制值,其中很多都反映在我打印出来的标签数据和标题中。
但是我发现这个TIFF有压缩32946,也就是COMPRESSION_DEFLATE。
如何从 hexdump 中解压缩其他十六进制值以从该 TIFF 中获取实际浮点值?我知道 Zlib 可以解压缩,但它可以解压缩 deflate 压缩,如果可以,如何解压?
我通过 LibTIFF 知道浮点值应该是什么,但不能使用它。它是一个 512x512 32 位 tiff,它具有浮点值。
另外,如果有人想查看,我可以发布有关 TIFF 或来自 hexdump 的值的更多信息。
【问题讨论】:
标签: c++ zlib tiff compression hexdump