f = torch.fft.fft2(image) # 计算频率 freqs = torch.fft.fftfreq(image.shape[-1]) print(freqs) # 设定阈值,用于分离高频和低频信息 threshold = 0.1 # 创建掩码,用于分离高频和低频信息 mask = (freqs.abs() < threshold).float() # 应用掩码,分离高频和低频信息 low_freq = torch.fft.ifft2(f * mask) high_freq = image - low_freq
标签:torch,fpl2,image,fft,freqs,低频,freq From: https://www.cnblogs.com/yyhappy/p/17577540.html