问题
I have few tif images which open on imread
or cvLoadImage
gives null
data
in windows whereas the same file is processed conveniently on ubuntu installation.
Running imagemagik identify
returns
$identify 60018969.tif
60018969.tif[0] TIFF 1696x2192 1696x2192+0+0 8-bit Grayscale DirectClass 516KB 0.000u 0:00.040
60018969.tif[1] TIFF 1696x2192 1696x2192+0+0 8-bit Grayscale DirectClass 516KB 0.000u 0:00.030
60018969.tif[2] TIFF 1696x2376 1696x2376+0+0 8-bit Grayscale DirectClass 516KB 0.000u 0:00.019
60018969.tif[3] TIFF 1696x2376 1696x2376+0+0 8-bit Grayscale DirectClass 516KB 0.000u 0:00.019
identify: 60018969.tif: wrong data type 4 for "JpegProc"; tag ignored. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.
After a lot of google search ,opencv can read uncompressed tiff images, but for compressed types tiff libtiff is needed. I tried re-intalling/re-configuring opencv many times but could not find a way to load compressed tiff images.
The same image is processed in ubuntu installation of OpenCV 2.4.9. Which codec I need to build in windows for opencv libtiff and how?
Please Help.
EDIT: During the course of time. I tried reading the file using libtiff
library and it failed to read the file giving an error "deprecated and troublesome old-style jpeg compression mode please convert to new-style jpeg compression"
. I made sure that libtiff had following codecs installed
Support for external codecs:
ZLIB support: yes
Pixar log-format algorithm: yes
JPEG support: yes
Old JPEG support: yes
JPEG 8/12 bit dual mode: no
ISO JBIG support: yes
LZMA2 support: no
C++ support: yes
OpenGL support: no
The example file as asked
回答1:
You should be aware that "Old Style JPEG" TIFFs are an extension that was glommed on to TIFF by Microsoft (IIRC) without consulting anyone and they did so rather poorly. Within all TIFF compression schemes there are "interesting" cases that are non-spec compliant and are more or less hacked into various codecs for compatibility, but old-style JPEG is the king of all kings in that regard and the crap that I've seen (I work for a company that makes a TIFF codec) would turn your hair white. I know for a fact that we have at least a half-dozen classes of old-style JPEG TIFFs that we can read that libtiff cannot.
来源:https://stackoverflow.com/questions/22334069/opencv-2-4-5-unable-to-load-tif-image-file-properly-in-windows