A problem in TIFF reading

5 ビュー (過去 30 日間)
Genhou
Genhou 2015 年 5 月 17 日
コメント済み: Walter Roberson 2016 年 8 月 30 日
Hi,Everybody.
I have a problem in TIFF reading. The matlab gave me a warning when I read a TIFF file:
WARNING: The datatype for tag SamplesPerPixel should be TIFF_SHORT instead of
TIFF_LONG. This may cause data corruption.
the code I used is given as follows:
FileTif=filename;
InfoImage=imfinfo(FileTif);
mImage=InfoImage(1).Width;
nImage=InfoImage(1).Height;
NumberImages=length(InfoImage);
FinalImage=zeros(nImage,mImage,NumberImages,'uint16');
How can I overcome this problem? Thanks a lot
  2 件のコメント
jack walker
jack walker 2016 年 8 月 30 日
Hello , I have also see this error. If we are using the same code as above. All its doing is reading the information the tiff . Its not actually changing it right. So by just activating the reading part its not going to Corrupt the file ?
Walter Roberson
Walter Roberson 2016 年 8 月 30 日
Correct, just reading the file is not going to corrupt the file.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2015 年 5 月 17 日
The TIFF file you are reading does not have proper headers, and MATLAB is warning you about it. However, SamplesPerPixel is going to be a very small number, 1 for grayscale and 3 for RGB. If you were happening to use a TIFF with more than 32767 channels per pixel then you would encounter problems. For normal images it is just a warning about an improper file.
You could fix the file by opening it with some random image utility and asking to save it again.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by