How to apply a median filter on a coloured image?

1 vue (au cours des 30 derniers jours)
Salad Box
Salad Box le 30 Oct 2019
Commenté : Walter Roberson le 30 Oct 2019
Hi,
I'm not exactly sure how 'median filter' works on a coloured image.
I can understand how the median filter work on a black and white image. Because instead of the image being m by n by 3, the image is m by n by 1. So there is only 1 number contained in each pixel. With a 3 by 3 median block, you can easily sort those 9 numbers and take the median number.
However, if it is a colored image, there will be 3 numbers (R, G, B) representing each pixel. In a 3 by 3 block, how to get the median? Do I have to apply the median filter on each channel separately?
Would that also have the risk of generating some artificial pixel values? I mean for instance, the median of R channel is 5, G channel is 20, B channel is 180. Does that mean the median of this block will be [5, 20, 180]. If I'm using [5, 20 180], is it likely that [5, 20, 180] does not belong to any of the 9 pixels in the 3 by 3 block?
  1 commentaire
Walter Roberson
Walter Roberson le 30 Oct 2019
You are exactly right, if you process per channel then you do risk creating artificial colors. And that can happen even if you drop into other color spaces such as HSV.
You certainly get into definitional problems of what it means to take a median color.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by