imshow 16 bit tif file turns to black

조회 수: 23 (최근 30일)
Mao Ye
Mao Ye 2017년 1월 23일
댓글: Mao Ye 2017년 1월 23일
I am currently loading a tif file into matlab by using the code below.
fname = '1.tif'; img = imread(fname); imshow(img)
But it showed a black picture. If I change to this.
fname = '1.tif'; [img,map] = imread(fname,k); imshow(img,map)
It works. And I found that map is actually empty.
If I did like this, it also works.
fname = '1.tif'; img = imread(fname); map = []; imshow(img,map)
I am wondering why.
The tif file information is here.
Filename:
FileModDate: ' '
FileSize: 761533941
Format: 'tif'
FormatVersion: []
Width: 630
Height: 630
BitDepth: 16
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 2
BitsPerSample: 16
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: 1x105 Double
SamplesPerPixel: 1
RowsPerStrip: 6
StripByteCounts: 1x105 Double
XResolution: []
YResolution: []
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 65535
MinSampleValue: 0
Thresholding: 1
Offset: ...
ImageDescription: ...
PageNumber: ...
UnknownTags: [4x1 struct]
Thank you so much. Any suggestions will be welcomed.
  댓글 수: 2
Jorge Mario Guerra González
Jorge Mario Guerra González 2017년 1월 23일
Can you attach '1.tif' image please
Mao Ye
Mao Ye 2017년 1월 23일
Sure. Because this is a big file. I am gonna show you one picture.

댓글을 달려면 로그인하십시오.

채택된 답변

Jorge Mario Guerra González
Jorge Mario Guerra González 2017년 1월 23일
I think that it happends because your tif image is a grayscale image are it's said in properties. Maps are used for colour images.
Since it's a grayscale image the notation [] means that the display range is [min max] then you see the whole gray scale.
Check this to see how maps work on a RGB tif image.
[X,map] = imread('corn.tif');
imshow(X,map)
  댓글 수: 1
Mao Ye
Mao Ye 2017년 1월 23일
Thank you very much. I think I got the idea. It just happens that map is empty. And I should use [] to have a big contrast to show this image. Another question is I have a stack of images this. If Each picture I showed is in [min max]. It look very strange. What should I do?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by