Matlab 中向量的高斯滤波器
我有一个 n 维向量(1xn 数据集,它不是图像数据),我想对其应用高斯滤波器。我有图像处理工具包和其他一些工具包(询问您是否需要列表)。
据推测,我可以将 fspecial
函数的 hsize
参数设置为类似于 [1 n]
的形式。 作为下一步,我仍然可以使用 imfilter
将其应用到我的向量中,还是应该使用其他东西?
我已经看过很多关于如何在 Matlab 中将高斯滤波器应用于二维图像数据的示例,但我对 Matlab 作为平台还比较陌生,因此一个示例非常好。
注意:我目前无法尝试一下,看看会发生什么(目前不在安装了 Matlab 的机器上),否则我会先尝试一下,然后只询问我是否在使用 fspecial< 时遇到问题/code> 和
imfilter
。
I have a n-dimensional vector (1xn dataset, and it is not image data), and I want to apply a Gaussian filter to it. I have the Image Processing Toolkit, and a few others (ask if you need a list).
Presumably I can make the hsize
parameter of the fspecial
function something like [1 n]
.
Can I still use imfilter
to apply it to my vector as the next step, or should I be using something else?
I've seen quite a few examples on how to apply a Gaussian filter to two dimensional image data in Matlab, but I'm still relatively new to Matlab as a platform so an example would be really good.
Note: I'm not currently in a position to just try it and see what happens (not currently on a machine with Matlab installed), otherwise I would have tried it first and only asked if I ran into problems using fspecial
and imfilter
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不自己创建高斯滤波器?您可以查看 fspecial 中的公式(或高斯的任何其他定义):
为了应用它,您可以使用过滤器:
并且不要忘记过滤器有延迟,这意味着滤波后的信号与输入信号相比发生了偏移。由于此过滤器是对称的,因此您可以使用
conv
而不是filter
获得非移位输出,并使用same
选项:Why not create the Gaussian filter yourself? You can look at the formula in
fspecial
(or any other definition of a Gaussian):and in order to apply it you can use
filter
:and don't forget the filter has latency, which means the filtered signal is shifted as compared to the input signal. Since this filter is symmetric, you can get a non-shifted output by using
conv
instead offilter
, and use thesame
option: