图像高斯滤波的最佳西格玛?
当对图像应用高斯模糊时,通常 sigma 是一个参数(示例包括 Matlab 和 ImageJ)。
人们如何知道西格玛应该是多少?有没有数学方法可以计算出最佳西格玛?就我而言,图像中的一些对象与背景相比更亮,我需要通过计算找到它们。我将应用高斯滤波器使这些物体的中心更加明亮,希望这有助于找到它们。我如何确定最佳西格玛?
When applying a Gaussian blur to an image, typically the sigma is a parameter (examples include Matlab and ImageJ).
How does one know what sigma should be? Is there a mathematical way to figure out an optimal sigma? In my case, i have some objects in images that are bright compared to the background, and I need to find them computationally. I am going to apply a Gaussian filter to make the center of these objects even brighter, which hopefully facilitates finding them. How can I determine the optimal sigma for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有公式可以为您确定它;最佳西格玛取决于图像因素 - 主要是图像的分辨率和其中对象的大小(以像素为单位)。
另请注意,高斯滤镜实际上并不是为了使任何东西变亮;而是为了使任何东西变亮。您可能想研究对比度最大化技术 - 听起来像直方图拉伸这样简单的技术可能很适合您。
编辑:更多解释 - sigma 基本上控制着你的核函数的“胖”程度;西格玛值越高,半径越宽。由于您正在处理图像,因此更大的西格玛还会迫使您使用更大的内核矩阵来捕获足够的函数能量。对于您的具体情况,您希望内核足够大以覆盖大部分对象(以便它足够模糊),但又不能太大以至于一次开始重叠多个相邻对象 - 所以实际上,对象分离 与尺寸一样也是一个因素。
既然您提到了 MATLAB - 您可以使用
fspecial('gaussian', hsize, sigma)
函数查看具有不同参数的各种高斯核,其中hsize
是大小内核的 sigma 是 sigma。尝试改变参数以查看其变化情况。There's no formula to determine it for you; the optimal sigma will depend on image factors - primarily the resolution of the image and the size of your objects in it (in pixels).
Also, note that Gaussian filters aren't actually meant to brighten anything; you might want to look into contrast maximization techniques - sounds like something as simple as histogram stretching could work well for you.
edit: More explanation - sigma basically controls how "fat" your kernel function is going to be; higher sigma values blur over a wider radius. Since you're working with images, bigger sigma also forces you to use a larger kernel matrix to capture enough of the function's energy. For your specific case, you want your kernel to be big enough to cover most of the object (so that it's blurred enough), but not so large that it starts overlapping multiple neighboring objects at a time - so actually, object separation is also a factor along with size.
Since you mentioned MATLAB - you can take a look at various gaussian kernels with different parameters using the
fspecial('gaussian', hsize, sigma)
function, wherehsize
is the size of the kernel andsigma
is, well, sigma. Try varying the parameters to see how it changes.我使用这个约定作为经验法则。如果
k
是内核的大小,则sigma=(k-1)/6
。这是因为高斯 pdf 的 99% 的长度是 6sigma。I use this convention as a rule of thumb. If
k
is the size of kernel thansigma=(k-1)/6
. This is because the length for 99 percentile of gaussian pdf is 6sigma.您必须找到函数 G 的最小值/最大值,使得 G(X,sigma) 其中 X 是您的观察结果的集合(在您的情况下,是您的图像灰度值),该函数可以是维持“顺序”的任何函数例如,图像的强度,这可以通过图像的一阶导数(如 G)来完成,
这给你图像的一阶导数的结果,现在你想通过以下方式找到最大西格玛
最大化 G(X,sigma),这意味着您正在尝试几个 sigma(比如说,按递增顺序),直到达到使 G 最大的 sigma。这也可以通过二阶导数来完成。
You have to find a min/max of a function G such that G(X,sigma) where X is a set of your observations (in your case, your image grayscale values) , This function can be anything that maintain the "order" of the intensities of the iamge, for example, this can be done with the 1st derivative of the image (as G),
this gives you the result of first derivative of an image, now you want to find max sigma by
maximzing G(X,sigma), that means that you are trying a few sigmas (let say, in increasing order) until you reach a sigma that makes G maximal. This can also be done with second derivative.
假设核的中心值等于 1,保证最外层值小于极限(例如 1/100)的维度如下:
Given the central value of the kernel equals 1 the dimension that guarantees to have the outermost value less than a limit (e.g 1/100) is as follows: