How to apply a median filter on a coloured image?

1 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2019-10-30
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by