@Bruce1Tone
2020-05-21T10:39:12.000000Z
字数 907
阅读 362
学生姓名:唐智崴
学号:2017110801028
指导教师:徐行
图片融合
对不同的图像进行高通滤波和低通滤波,然后融合图像
掌握图像滤波、傅里叶变换和傅里叶逆变换
对不同图像进行高通滤波和低通滤波,然后融合图像
def FT(self):f = np.fft.fft2(self.img)self.fshift = np.fft.fftshift(f)
其中,sefl.fshift存储频谱矩阵
def HighPass(self,size):crow = int(self.rows/2)ccol = int(self.cols/2)self.fshift[crow-size:crow+size, ccol-size:ccol+size] = 0
即将频谱图中的部分数值清除为0
def IFT(self):ishift = np.fft.ifftshift(self.fshift)iimg = np.fft.ifft2(ishift)self.iimg = np.abs(iimg)
其中,self.iimg存储的是滤波后的图像
def HybridImage(high,low,size):temp_high = img_array(high)temp_high.FT()temp_high.HighPass(size)temp_low = img_array(low)temp_low.FT()temp_low.LowPass(size)hybrid = img_array(high)hybrid.fshift = temp_high.fshift + temp_low.fshifthybrid.IFT()result = Image.fromarray(hybrid.iimg)return result
得到高频和低频融合的图像
得到的图像如图所示

通过对图像进行高低频滤波,再进行融合得到的图像就是结果