我试着用两个不同的标准差来绘制二维高斯曲线。他们给出了关于mathworld的方程:http://mathworld.wolfram.com/GaussianFunction.html,但我似乎无法得到一个合适的二维数组,它的中心是零。
我知道了,但不太管用。
x = np.array([np.arange(size)])
y = np.transpose(np.array([np.arange(size)]))
psf = 1/(2*np.pi*sigma_x*sigma_y) * np.exp(-(x**2/(2*sigma_x**2) + y**2/(2*sigma_y**2)))
高斯是以(0,0)为中心的,所以围绕这个原点设置轴。例如
函数的中心是零,但坐标向量不是。尝试:
可能这个答案对于@Coolcrab来说已经太迟了,但是我想把它留在这里以供将来参考。
可以使用多元高斯公式,如下所示
更改平均元素将更改原点,而更改协方差元素将更改形状(从圆到椭圆)。
代码如下:
相关问题 更多 >
编程相关推荐