Error in displaying .TIF images in MATLAB

29 次查看(过去 30 天)
I tried to display a .tif image in MATLAB. The system is able to read it, but not able to display it.
pet=imread('13.tif');
imshow(pet);
Error using imageDisplayValidateParams>validateCData (line 113)
Multi-plane image inputs must be RGB images of size MxNx3.
Error in imageDisplayValidateParams (line 27)
common_args.CData = validateCData(common_args.CData,image_type);
Error in imageDisplayParseInputs (line 78)
common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 219)
[common_args,specific_args] = ...
  16 个评论
Soumyadip Ray Cahudhuri
this is my code
I=imread('pout.tif');
imshow(I)
figure
imshow(I>220)
this is thr error
Error using images.internal.imageDisplayValidateParams>validateCData (line 115)
Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.imageDisplayValidateParams (line 27)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 78)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 223)
[common_args,specific_args] = ...
Error in xd (line 2)
imshow(I)
what is the solution ?

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2016-1-5
What does size(pet) report? If it shows a 4 dimensional image, and you have the Image Processing Toolkit, try implay(pet)
  3 个评论
Ronnie II Concepcion
Hi! I am trying to extract RGB channels from a colored picture and the resulting size and data type of each RGB component is MxNx7 uint8. I need to change the size to MxNx3. I think we have the same challenge. May I know how you resolved it? Thanks.
Walter Roberson
Walter Roberson 2020-4-17
Please show imfinfo() of the file.
Possibly the code I showed above would work,
tiff_image = imread('AppropriateFileName.tif');
tiff_image = tiff_image(:,:,1:3);
However, in my experience, TIFF with 7 channels are typically multispectra and do not necessarily have RGB or the RGB might not be the first three channels. I have found that most people who have TIFF with 7 channels want to synthesize an RGB image from multispectra data, typically hoping to include two channels of infrared from satellites.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by