Mode & median filters for color image

Can you please send the syntax for mode and median filters for image restoration of color images.It would be very helpful

 Respuesta aceptada

Sean de Wolski
Sean de Wolski el 6 de Mayo de 2011
%Median:
Irgb = your_rgb_image;
for ii = 1:3
Irgb(:,:,ii) = medfilt2(Irgb(:,:,ii),ones(3)); %3x3 median
end

Más respuestas (1)

Darshan A
Darshan A el 6 de Mayo de 2011

0 votos

Thanks a lot for the quick response..!

4 comentarios

Darshan A
Darshan A el 6 de Mayo de 2011
got some error. this is working code..
Irgb = imread('pathname');
for ii=1:3
Irgb(:,:,ii) = medfilt2(Irgb(:,:,ii),[3 3]);
end
imshow(Irgb);
Sean de Wolski
Sean de Wolski el 6 de Mayo de 2011
Well what error? How do you possibly expect us to diagnose an error we don't know?
Darshan A
Darshan A el 7 de Mayo de 2011
Error using ==> medfilt2>parse_inputs at 134
MEDFILT2(A,[M N]): Second argument must consist of two integers.
Error in ==> medfilt2 at 48
[a, mn, padopt] = parse_inputs(varargin{:});
Error in ==> median_color at 3
Irgb(:,:,ii) = medfilt2(Irgb(:,:,ii),ones(3));
I am new to MATLAB , so this might have been my mistake.
Sean de Wolski
Sean de Wolski el 7 de Mayo de 2011
No it's mine.
medfilt2(Irgb,[3 3]);
I was confusing it with conv2. (what you would use for mean or std)

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by