在做答辩PPT和看看DTCWT后图像到底长什么样之间,毫不犹豫选择了后者。
使用了python的DTCWT;据说小波变换域细节信息提取很好。
目标:
提取图片的DT-CWT分解后的6个高频小波子带的幅值最大值
SM(x, y) = max{Bi(x, y), i=1,2,3,4,5,6}
原图:
参考:
代码:
import matplotlib.image as mpimg from matplotlib.pylab import * import numpy as np # Show image fryPic = mpimg.imread('fry.jpg') figure(1) fryPic=fryPic[:,:,0] imshow(fryPic, cmap=cm.gray) show() import dtcwt transform = dtcwt.Transform2d() # Compute one levels of dtcwt with the defaul wavelet family fryPic_t = transform.forward(fryPic, nlevels=1) # Show the absolute images for each direction in level 1. # Note that the 2nd level has index 1 since the 1st has index 0. figure(2) for slice_idx in range(fryPic_t.highpasses[0].shape[2]): subplot(2, 3, slice_idx+1) imshow(np.abs(fryPic_t.highpasses[0][:,:,slice_idx]), cmap=cm.gray) # abs: the amplitude of a complex show() # Show maximun amplitude of six high frequency sub-bands figure(3) amplitude0 = np.abs(fryPic_t.highpasses[0][:,:,0]) amplitude1 = np.abs(fryPic_t.highpasses[0][:,:,1]) amplitude2 = np.abs(fryPic_t.highpasses[0][:,:,2]) amplitude3 = np.abs(fryPic_t.highpasses[0][:,:,3]) amplitude4 = np.abs(fryPic_t.highpasses[0][:,:,4]) amplitude5 = np.abs(fryPic_t.highpasses[0][:,:,5]) temp1 = np.maximum(amplitude0, amplitude1) temp2 = np.maximum(temp1, amplitude2) temp3 = np.maximum(temp2, amplitude3) temp4 = np.maximum(temp3, amplitude4) SM = np.maximum(temp4, amplitude5) imshow(SM, cmap=cm.gray) show() # Show the phase images for each direction in level 2. figure(4) for slice_idx in range(fryPic_t.highpasses[0].shape[2]): subplot(2, 3, slice_idx+1) imshow(np.angle(fryPic_t.highpasses[0][:,:,slice_idx]), cmap=cm.hsv, clim=(-np.pi, np.pi)) show()
结果:
灰度图
六个小波带
合成的spatial masking图(等待填坑)
相位图
文章来源: DTCWT双树复数小波变换