创造“多孔” Matlab中的中值滤波器 [英] Creating "holey" median filter in Matlab
问题描述
我需要做的是在Matlab中为图像处理创建一种特殊中值滤波器 - 多孔中值滤波器。这是一个过滤器,不包括该区域中心的元素。
What I need to do is to create a "special" kind of median filter for image processing in Matlab - the "holey" median filter. This is a filter that excludes the element at the center of the area.
对于标准中值滤波器,我使用 medfilt2
函数,但我无法传递掩码(内核)它作为矩阵(它不是线性变换)。
例如,使用标准平均滤波器3x3我创建掩码(内核)为:
For standard median filter I use the medfilt2
function, but I can't pass the mask (kernel) for it as a matrix (it's not a linear transform).
For example, using standard averaging filter 3x3 I create the mask (kernel) as:
h = ones(3,3)/9;
对于多空平均滤波器:
h = ones(3,3)/8;
h(2,2) = 0;
如何使用中值滤波器做同样的事情?有没有办法修改 medfilt2
还是我需要自己实现一个运行中位数?
How to do the same thing with median filter? Is there any way to modify the medfilt2
or do I need to implement a running median on my own?
推荐答案
如何使用底层函数ordfilt2并在那里定义自己的域?
What about using the underlying function ordfilt2 and defining your own domain there?
http://www.mathworks.com/访问/帮助台/帮助/工具箱/ images / ordfilt2.html
这篇关于创造“多孔” Matlab中的中值滤波器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!