added support for uncompressed parameters to tiff image format as described here: expertland.net/question/b6o3n6p9a72341db823b48nl98m91dx8n1/detail.html

This commit is contained in:
Eric Sommerlade 2015-02-23 06:12:42 -07:00
parent 6447c7b2f4
commit a07d7a70a0

View File

@ -574,13 +574,19 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const std::vector<int>& params)
|| !TIFFSetField(pTiffHandle, TIFFTAG_SAMPLESPERPIXEL, channels) || !TIFFSetField(pTiffHandle, TIFFTAG_SAMPLESPERPIXEL, channels)
|| !TIFFSetField(pTiffHandle, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG) || !TIFFSetField(pTiffHandle, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)
|| !TIFFSetField(pTiffHandle, TIFFTAG_ROWSPERSTRIP, rowsPerStrip) || !TIFFSetField(pTiffHandle, TIFFTAG_ROWSPERSTRIP, rowsPerStrip)
|| !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor) // || !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor)
) )
{ {
TIFFClose(pTiffHandle); TIFFClose(pTiffHandle);
return false; return false;
} }
if (compression != COMPRESSION_NONE && !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor) )
{
TIFFClose(pTiffHandle);
return false;
}
// row buffer, because TIFFWriteScanline modifies the original data! // row buffer, because TIFFWriteScanline modifies the original data!
size_t scanlineSize = TIFFScanlineSize(pTiffHandle); size_t scanlineSize = TIFFScanlineSize(pTiffHandle);
AutoBuffer<uchar> _buffer(scanlineSize+32); AutoBuffer<uchar> _buffer(scanlineSize+32);