Please help to solve the error

1 Ansicht (letzte 30 Tage)
Prakash Sharma
Prakash Sharma am 27 Mär. 2015
Kommentiert: Prakash Sharma am 28 Mär. 2015
</matlabcentral/answers/uploaded_files/27943/BrainMRI-GadLesion.jpg> Sir in my code in the "Remove_callback " part when I want to convert the image in RGB to Gray using the code rgb2gray its showing the following errors. Error using rgb2gray>parse_inputs (line 81) MAP must be a m x 3 array.
_ _ * _Error in rgb2gray (line 35) X = parse_inputs(varargin{:});
Error in barintumor>REMOVE_Callback (line 102) c=rgb2gray(I);
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in barintumor (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)barintumor('REMOVE_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback_ * _ _
how can I solve it?
  2 Kommentare
Geoff Hayes
Geoff Hayes am 27 Mär. 2015
Prakash - what are the dimensions for I? The error message is telling you that the input matrix must be three dimensional. Is this the case? Use the debugger to step through your code to verify.
Prakash Sharma
Prakash Sharma am 28 Mär. 2015
can You give me an example of m*3 matrix mapping.... or the syntax of it?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 28 Mär. 2015
Prakash - rgb2gray converts an RGB (true colour) image to grayscale. This means that it requires the input image to be three dimensional, one dimension for each of the red, green, and blue channels. So something like
rgbImg = uint8(randi(255,200,300,3));
Note that the above 200x300 matrix has three dimensions. I suspect that your I matrix is just one- or two-dimensional.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by