Matlab中线性空间滤波函数imfilter()的边界扩展问题

本人最近在开设本科生的《数字图像处理》课程,对于课程中遇到的空域滤波算法,也做了一次从研究生毕业以来最深入的分析。对于图像处理的基础知识来说,本人觉得搞懂算法原理能在matlab中熟练利用工具函数解决问题,对于本科阶段已经足够了。至于编写自定义函数来实现和内置函数类似的功能,稍微有那么一点画蛇添足。

比如,空域滤波使用到的imfilter()函数,它的命令参数就值得深入研究一下。imfilter的基本格式是:

B = imfilter(A,h)
B = imfilter(A,h,options,...)

说的直白一点,就是利用掩模进行图像卷积的过程。但是对模板照顾不到的边界该怎样处理呢?matlab的官方文档提供的说明是一种名叫“Option padding”的选项,并提供了三种参数可供选择:

Padding Options

numeric scalar, X

Input array values outside the bounds of the array are assigned the value X. When no padding option is specified, the default is 0.

'symmetric'

Input array values outside the bounds of the array are computed by mirror-reflecting the array across the array border.

'replicate'

Input array values outside the bounds of the array are assumed to equal the nearest array border value.

'circular'

Input array values outside the bounds of the array are computed by implicitly assuming the input array is periodic.

字面意思上讲就是“指定值为X”、“对称”、“复制”和“循环”。后三种选项对应的图示如下(5*5掩模为例):

另外还有一些参数的调用方法如下:

 

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值