Error in displaying .TIF images in MATLAB

48 views (last 30 days)
Gee Cheng Mun
Gee Cheng Mun on 5 Jan 2016
Commented: Walter Roberson on 17 Apr 2020
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 Comments
Soumyadip Ray Cahudhuri
Soumyadip Ray Cahudhuri on 31 Jul 2019
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 ?
Walter Roberson
Walter Roberson on 31 Jul 2019
Show us size(I) and imfinfo('pout.tif')

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 5 Jan 2016
What does size(pet) report? If it shows a 4 dimensional image, and you have the Image Processing Toolkit, try implay(pet)
  3 Comments
Ronnie II Concepcion
Ronnie II Concepcion on 17 Apr 2020
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 on 17 Apr 2020
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.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!