如何在Matlab中获得2d高斯核 [英] how to obtain 2d Gaussian kernel in matlab

查看:904
本文介绍了如何在Matlab中获得2d高斯核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取采样到3个
标准偏差(3 x 3)并重新缩放为单位体积的2D圆对称
高斯加权函数?

解决方案

尝试



该功能已标准化为单位体积。要对此进行检查,请注意采样步骤为 1 ,因此逼近积分的黎曼总和就是所有函数值的总和:

 >> sum(z(:))
ans =
1.0000


How do I obtain 2D circularly symmetric Gaussian weighting function sampled out to 3 standard deviations (3 x 3) and re scaled to unit volume?

解决方案

Try fspecial (Image Processing Toolbox) with the 'gaussian' option. For example,

z = fspecial('gaussian', [30 30], 4);

generates values on a 30×30 grid with sampling step 1 and standard deviation 4.

surf(z)

produces the graph

The function is normalized to unit volume. To check this, note that the sampling step is 1, so that the Riemann sum approximating the integral is just the sum of all function values:

>> sum(z(:))
ans =
    1.0000

这篇关于如何在Matlab中获得2d高斯核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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