如何在matlab中对图像应用环形中值滤波器? [英] How can I apply a ring-shaped median filter to an image in matlab?

查看:545
本文介绍了如何在matlab中对图像应用环形中值滤波器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认的matlab函数medfilt2使用矩形蒙版。

The default matlab function medfilt2 uses a rectangular mask.

谢谢你们

推荐答案

你可以使用 ordfilt2

you can use ordfilt2 .

例如,如果您的响铃仅由以下定义:

For example, if your "ring" is just defined by:

ring= fspecial('gaussian',21,1)
ring = ring>eps & ring<1e-9

然后:

order=sum(ring(:))/2;
B = ordfilt2(A,order,ring);

用非零指定的有序邻居集合中的order-th元素替换A中的每个元素环域中的元素。
在这里,我选择'order'为环中像素总数的一半。

replaces each element in A by the order-th element in the sorted set of neighbors specified by the nonzero elements in the ring domain. Here I chose 'order' to be half the total # of the pixels in the ring.

这篇关于如何在matlab中对图像应用环形中值滤波器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆