Jen*_*enn 14 python numpy gaussian scipy smoothing
我对python中的编程非常陌生,我仍然试图解决所有问题,但我在尝试高斯平滑或卷积图像时遇到问题.这可能是一个简单的解决方案,但我花了很多时间试图弄明白我开始变得疯狂.我有一组3d .fits文件中的一组星系,并删除了某个星系并将其保存到png with aplpy.基本上,它需要作为高斯光束平滑到更大的光束尺寸(即通过扩展FWHM但使输出变暗来使整个事物更大).我知道有些东西像scipy.ndimage.convolve和类似的numpy函数我可以使用,但我很难将它翻译成有用的东西.如果有人能够帮助我,并指出我正确的方向,那将是一个巨大的帮助.
Jai*_*ime 23
也许这样的事情?
import numpy as np
import scipy.ndimage as ndimage
import matplotlib.pyplot as plt
img = ndimage.imread('galaxies.png')
plt.imshow(img, interpolation='nearest')
plt.show()
# Note the 0 sigma for the last axis, we don't wan't to blurr the color planes together!
img = ndimage.gaussian_filter(img, sigma=(5, 5, 0), order=0)
plt.imshow(img, interpolation='nearest')
plt.show()
Run Code Online (Sandbox Code Playgroud)

(原始图片来自这里)