问题描述
我知道通常人们会选择奇数作为高斯滤波的大小,并且由于图像是由离散像素组成的,因此我们始终可以定位中心像素.
但是,如果大小是偶数怎么办?这将导致几个问题:
-
高斯滤波器应该是对称的还是不对称的?
-
如果大小数等于2,该怎么办?
谢谢.
确实没有这样的选择.
移位的高斯滤波内核将导致图像平滑+移位.如果要使用不使图像移位的滤镜,则滤镜必须在内核原点(通常是奇数内核的中心像素)处具有高斯原点.
一旦确定,使用均匀大小的过滤器必须导致不对称内核.确实不希望有一个非对称平滑滤波器(除非我们在谈论自适应滤波),因为不对称会带来偏差.
因此,我们陷入了一个奇数大小的过滤器中.偶数大小的滤镜会引入偏差或偏移半个像素.
2像素核不能是高斯滤波器,因为它需要至少5个样本来表示高斯核,并具有足够的细节来呈现高斯滤波器的积极方面.如果采样较少,则滤镜的行为将不会像高斯滤镜.有关高斯过滤的更多信息,建议您阅读此博客文章我十年前写的.
I know usually people prefer to choose the odd number as the size of Gaussian Filtering, and since the image made of discrete pixels, we can always locate the central pixel.
But what if the size is an even number? There will lead to several questions:
how will the Gaussian filter be, should it be symmetric or asymmetric?
what if the size number equals to 2?
Thank you.
There really is no such choice to be made.
A Gaussian filtering kernel that is shifted will result in a smoothing + a shift of the image. If you want a filter that doesn’t shift the image, the filter must have the origin of the Gaussian at the origin of the kernel, typically the central pixel of an odd-sized kernel.
Once we have established that, using an even-sized filter must lead to an asymetrical kernel. It is not really desirable to have an asymmetrical smoothing filter (unless we’re talking about adaptive filtering) because the asymmetry introduces a bias.
So, we’re stuck with an odd-sized filter. An even-sized filter will introduce either a bias or a shift of half a pixel.
A 2-pixel kernel cannot be a Gaussian filter because it takes at least 5 samples to represent a Gaussian kernel with sufficient detail for it to present the positive aspects of the Gaussian filter. With fewer samples, the filter will not behave like a Gaussian filter.
For more information about Gaussian filtering, I recommend that you read this blog post that I wrote 10 years ago.
这篇关于如果滤波器窗口大小在高斯滤波中为偶数怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!