MATLAB Answers

error in displaying an image in axes of GUI

Asked by Elysi Cochin on 18 Mar 2013

sir.... i cant load the image in the following link....

it is showing error as

    ??? Error using ==> imageDisplayValidateParams>validateCData at 114
    Unsupported dimension
    Error in ==> imageDisplayValidateParams at 31
    common_args.CData = validateCData(common_args.CData,image_type);
    Error in ==> imageDisplayParseInputs at 79
    common_args = imageDisplayValidateParams(common_args);
    Error in ==> imshow at 199
      [common_args,specific_args] = ...
    Error in ==> denoisemain>Select_Callback at 87
    Error in ==> gui_mainfcn at 96
    Error in ==> denoisemain at 42
        gui_mainfcn(gui_State, varargin{:});
    Error in ==>

please can anyone help me to rectify this error....


Elysi Cochin on 18 Mar 2013

sir when i did

 [r c d] = size(inputImage );

i got d = 4..... i wanted to convert it to gray-scale image..... is it possible sir.... please do reply sir....

Walter Roberson
on 18 Mar 2013

The image is an RGB image that contains alpha data. You will need to use

if size(inputImage,3) == 4  %alpha
  inputImage = inputImage(:,:,1:3);  %strip alpha
if size(inputImage,3) == 3
  inputImage = rgb2gray(inputImage); %convert to grayscale
Elysi Cochin on 18 Mar 2013

thank u sir.... saved lot of my time.... thank u sir...


No products are associated with this question.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today