vector median filter

is there any function in matlab for vector median filter or vector directional filter? plz help.

2 comentarios

Walter Roberson
Walter Roberson el 28 de Dic. de 2011
Is there a difference between "vector median filter" and "median filter applied to a vector" ?
Yogesh Joshi
Yogesh Joshi el 28 de Dic. de 2011
yes, vector median filter is used for color image enhancement.

Iniciar sesión para comentar.

 Respuesta aceptada

Chandra Kurniawan
Chandra Kurniawan el 28 de Dic. de 2011

2 votos

for 1D median filtering, Matlab has command medfilt1
Eq:
medfilt1([4 3 5 2 8 9 1],3)
ans =
3 4 3 5 8 8 1

4 comentarios

Yogesh Joshi
Yogesh Joshi el 28 de Dic. de 2011
actually i want to use median filter for color image enhancement
Chandra Kurniawan
Chandra Kurniawan el 28 de Dic. de 2011
Image is 2D matrix.
But, don't be worry!
Matlab also provide medfilt2 for 2D median filtering.
Walter Roberson
Walter Roberson el 28 de Dic. de 2011
color images are 3D matrices.
Chandra Kurniawan
Chandra Kurniawan el 29 de Dic. de 2011
Yes, I meant 3D matrix
That right function medfilt2 works on 2D image array.
Then, you can use the same function to filter rgb <color> image plane by plane.
I mean you need to apply this to red plane, green plane, blue plane one-by-one.
Here I give you sample code :
I = imread('peppers.png');
J = imnoise(I,'salt & pepper');
imshow(J);
K(:,:,1) = medfilt2(J(:,:,1));
K(:,:,2) = medfilt2(J(:,:,2));
K(:,:,3) = medfilt2(J(:,:,3));
figure, imshow(K);

Iniciar sesión para comentar.

Más respuestas (2)

Image Analyst
Image Analyst el 28 de Dic. de 2011

0 votos

Whether applying medfilt2() to each color plane independently (such as my code here: http://www.mathworks.com/matlabcentral/answers/16350-how-to-remove-pixels-in-an-image) is an improvement is something you'll have to decide as this can give color artifacts that can make it worse. Maybe you want to convert to HSV and just use medfilt2 on the V channel. Or you can do more sophisticated, smarter things like median filtering the image (somehow) and then replace only SOME of the pixels - the "bad" ones, which you've identified somehow - rather than all of them.
Yogesh Joshi
Yogesh Joshi el 2 de En. de 2012

0 votos

I think using medfilt2 for each color plane will not give good results,instead treat each pixel as vector and use vector median filter algorithm

Community Treasure Hunt

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

Start Hunting!

Translated by