Matlab cannot read the tiff image
39 ビュー (過去 30 日間)
古いコメントを表示
Matlab sometimes gives a warning when running the imread function to read a TIFF image.
My computer system is win8.1, and the Matlab is 2013b. What's wrong with this problem? How to fix it?
0 件のコメント
採用された回答
Walter Roberson
2015 年 7 月 28 日
It took me a bit of chasing to track this
34022 Color table. TIFF/IT TIFF/IT spec, 7.2.8.4 Note this 7.2.8.4
So what you have is a TIFF/IT tag IT8COLORTABLE . Now to research about TIFF/IT
<<TIFF/IT breaks TIFF 6.0 in many ways. TIFF/IT is certainly inspired by TIFF, but it is not a valid subset of TIFF 6.0 by far. It's best regarded a different file format altogether. [...]
TIFF/IT does not include the tag datatype 13 (IFD), nor, of course, its BigTIFF equivalent 18 (IFD8). It therefore enforces the problematically ambiguous use of the datatype 4 (Long, unsigned 32bit integer). [...] It therefore makes sense for TIFF/A to distinguish between unsigned 32bit integer data that is meant to communicate an actual integer value on the one hand, and a pointer to an auxiliary IFD on the other hand. [...]
TIFF/IT supports ICC color profiles. TIFF/A does not. (See section “7.2.8.4 Colour values” in the TIFF/IT specification.) [...]
Note that nothing here is actually valid criticism on the TIFF/IT file format, nor is it intended as such, on the condition that TIFF/IT is not mistaken for a flavor of TIFF, or an interchange or archival file format. If TIFF/IT is regarded as its own format, serving prepress needs perfectly fine, as it is intended, none of the above is anything other than a useful feature. Except for the badly chosen name, and the impractical and confusing reuse of another format's header and signature value.>>
Notice the 7.2.8.4 . So your IT8COLORTABLE is representing an ICC Color Profile, which is not used in the TIFF/A standard .
Basically what you have is a TIFF/IT file that is not a TIFF 6.0 file as is expected by imread(), and the TIFF/IT standard is incompatible with TIFF 6.0 in some regards. Especially as to what a LONG means in some circumstances. And your error message has to do with LONG.
So why the warning?
pronaldzito wrote "I believe this may be a bug in 64-bit libtiff where a TIFF IFD contains a data type of long with a value zero."
Possibly -- but the incompatibility in specifications would be more explanatory.
Joris wrote
<<In theory, one should never copy tags that are unknown.
You may do otherwise, and many people do. But then you are open for trouble, for instance when copying a LONG value that is in fact intended to be a private IFD pointer.>>
More evidence that it is incompatibility in file formats.
Your file is not a TIFF file in the sense expected by MATLAB's imread(): it is a TIFF/IT file, which has a subtly different use of the tag structure and you are seeing the effect of it. You might have problems with the file as it is corrupt from the standpoint of TIFF readers.
8 件のコメント
Justin
2023 年 10 月 10 日
I was able to resolve the issue by using Photoshop to update the .tiff to a .tif by using the save a copy option. Afterwards, I was able to load the image into Matlab.
その他の回答 (1 件)
Muhammad Usman Saleem
2015 年 7 月 28 日
Use the correct extension for tif or you have convert your image to some other data type image like unit8 ,unit16 or might be your image converted to RGB image or binary image.
参考
カテゴリ
Help Center および File Exchange で Image Data についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!