使用内核大小计算高斯滤波器的sigma [英] Calculate the Gaussian filter's sigma using the kernel's size

查看:779
本文介绍了使用内核大小计算高斯滤波器的sigma的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在适用于cvSmooth的OpenCV文档中找到了sigma可以从内核大小计算如下: sigma = 0.3(n/2-1)+ 0.8

I find on the OpenCV documentation for cvSmooth that sigma can be calculated from the kernel size as follows: sigma = 0.3(n/2 - 1) + 0.8

我想知道这个方程的理论背景.

I would like to know the theoretical background of this equation.

谢谢.

推荐答案

使用这样的sigma值,即在y=0x=n/2-1,是:

Using such a value for sigma, the ratio between the value at the centre of the kernel and on the edge of the kernel, found for y=0 and x=n/2-1, is:

g_edge / g_center = exp(-(x²+y²)/(2σ²))
                  = exp(-(n/2-1)²/(2*(0.3(n/2-1)+0.8)²))

随着n的增加,该值的限制为:

The limit of this value as n increases is:

exp(-1/(2*0.3²)) = 0.00386592

请注意,1/2560.00390625.图像通常以256个值的范围编码.选择0.3可确保内核考虑可能会严重影响结果值的所有像素.

Note that 1/256 is 0.00390625. Images are often encoded in 256-value ranges. The choice of 0.3 ensures that the kernel considers all pixels that may significantly influence the resulting value.

恐怕我没有对0.8部分的解释,但是我想这是为了确保n较小时的合理值.

I am afraid I do not have an explanation for the 0.8 part, but I imagine it is here to ensure reasonable values when n is small.

这篇关于使用内核大小计算高斯滤波器的sigma的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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