MATLAB: What I am trying to do here is remove noise from a certain image and this is the code I have written. But every time I run it I get an error shown below. Could someone please guide me in the right direction to solve this problem.

image processingMATLAB

% Removal of noise from an Image using Adaptive filtering method
I = imread('I:\Image Proccessing\MATLAB COURSEWORK 14 APRIL (1)\Image_Processing_Images\MARTON_JULIAN_w1286286_noisy_gauss.tiff');
% the image is a truecolor image,converts it to grayscale.
Im = rgb2gray(I);
Errors that I got from the code above –
Error using rgb2gray>parse_inputs (line 81) MAP must be a m x 3 array.
Error in rgb2gray (line 35) X = parse_inputs(varargin{:});

Best Answer

% Removal of noise from an Image using Adaptive filtering method
% Read in the image from disk.
I = imread('I:\Image Proccessing\MATLAB COURSEWORK 14 APRIL (1)\Image_Processing_Images\MARTON_JULIAN_w1286286_noisy_gauss.tiff');
[rows, columns, numberOfColorChannels] = size(I);
% If the image is a truecolor image, convert it to grayscale.
if numberOfColorChannels > 1
% It's color, so convert to gray scale.
Im = rgb2gray(I);
else
% Already grayscale
Im = I;
end
Related Question