필터 지우기
필터 지우기

i can't display .tif image in matlab,where i can read it through imread,bt can't able to show it

조회 수: 2 (최근 30일)
i can't display .tif image in matlab,where i can read it through imread,bt can't able to show it. showing the error like this
Error using imageDisplayValidateParams>validateCData (line 117)
Unsupported dimension.
Error in imageDisplayValidateParams (line 31)
common_args.CData = validateCData(common_args.CData,image_type);
Error in imageDisplayParseInputs (line 79)
common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 198)
[common_args,specific_args] = ...
while checking imfinfo
Filename: [1x112 char]
FileModDate: '11-Aug-2015 07:30:15'
FileSize: 336095
Format: 'tif'
FormatVersion: []
Width: 106
Height: 115
BitDepth: 64
ColorType: 'grayscale'
FormatSignature: [77 77 0 42]
ByteOrder: 'big-endian'
NewSubFileType: 0
BitsPerSample: [32 32]
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: [2x1 double]
SamplesPerPixel: 2
RowsPerStrip: 115
StripByteCounts: [2x1 double]
XResolution: 1
YResolution: 1
ResolutionUnit: 'None'
Colormap: []
PlanarConfiguration: 'Planar'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: [4.2950e+09 4.2950e+09]
MinSampleValue: [0 0]
Thresholding: 1
Offset: 10
ImageDescription: [1x86 char]
SampleFormat: {2x1 cell}
ModelPixelScaleTag: [3x1 double]
ModelTiepointTag: [720x1 double]
GeoKeyDirectoryTag: [16x1 double]
UnknownTags: [1x1 struct]
i got like this and my image size given by size= 115 106 2 how i can display this image
  댓글 수: 1
Stephen23
Stephen23 2015년 8월 13일
편집: Stephen23 2015년 8월 13일
Please upload the image using the paperclip button and then pressing both the Choose file and Attach file buttons. You might need to change the file extension or zip the file first (please give a precise description if you do this).

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

답변 (2개)

D Joseph
D Joseph 2015년 8월 13일
use imshow

Walter Roberson
Walter Roberson 2015년 8월 13일
Look at ColorType: 'grayscale' but SamplesPerPixel: 2 . The image has two bitplanes even though grayscale images should only have one. You should index the array at (:,:,1) to display it.
I suspect that it might be a grayscale image with an Alpha plane. The UnknownTags might give some hints about that. You could try reading it in as
[Imagedata, Map, Transparency] = imread('filename.tif');
and see what size(Imagedata) and size(Transparency) is. But I suspect that the file is not constructed exactly properly -- and it is possible that it is two different images stored together.
With your current imread() if it is intended to be transparency then you would be able to view it with
image(Imagedata(:,:,1), 'AlphaData', Imagedata(:,:,2)); %where Imagedata is the image read in
colormap(gray(256))
However, notice that the data is indicated as 32 bits for each of the planes, and notice that MaxSampleValue: [4.2950e+09 4.2950e+09] . That 4.2950e+09 happens to be 2^32 -- the data is probably in uint32 format and the entire range is used. You are going to have to rescale the data to view it properly -- the second plane as well. Try
plane1 = double(Imagedata(:,:,1)) / 2^32; %where Imagedata is the image read in
plane2 = double(Imagedata(:,:,2)) / 2^32;
subplot(3,1,1)
image(plane1);
colormap(gray(256));
title('first layer by itself')
subplot(3,1,2)
image(plane2);
colormap(gray(256));
title('second layer by itself');
subplot(3,1,3)
image(plane1, 'AlphaData', plane2);
colormap(gray(256));
title('second layer is Alpha on first layer')

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by