我正在尝试对使用 Python 生成的一些形状进行傅立叶分析。我设法在图像上获得二维傅立叶变换并应用高斯滤波器,但是使用高斯滤波器的图像的逆图像正在移动,我不知道如何解决它。我试图采用真实的值只是希望它能解决这个问题,但没有任何改变。我在下面演示我的代码,有人对我能做什么有任何想法吗?
#importing necessary libraries
from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
import numpy as np
from scipy.ndimage import gaussian_filter
#function to apply Gaussian filter to the Fourier transform
def apply_gaussian_filter(fourier_transform, sigma):
return gaussian_filter(fourier_transform, sigma)
##code to produce an image of a box and perform Fourier analysis on it
#defining the size bounds of the box
w, h = 65, 65
box = [(50, 29), (w-50, h-30)]
#creating the image with a white background
im = Image.new("I", …Run Code Online (Sandbox Code Playgroud)