www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/CompareIsotropicandAnisotropicWaveletsExample.m
%% Compare Isotropic and Anisotropic Wavelets % Shows how an isotropic wavelet does not discern the orientation of % features while an anisotropic wavelet does. The example uses the Mexican % hat isotropic wavelet and the directional (anisotropic) Cauchy wavelet. % % Load and view the hexagon image. Im = imread('hexagon.jpg'); imagesc(Im); colormap(jet); %% % Obtain the scale-one 2-D CWT with both the Mexican hat and Cauchy wavelets. % Specify a vector of angles going from 0 to 15π/8 in π/8 increments. cwtcauchy = cwtft2(Im,'wavelet','cauchy','scales',1,... 'angles',0:pi/8:2*pi-pi/8); cwtmexh = cwtft2(Im,'wavelet','mexh','scales',1,... 'angles',0:pi/8:2*pi-pi/8); %% % Visualize the scale-one 2-D CWT coefficient magnitudes at each angle. angz = {'0', 'pi/8', 'pi/4', '3pi/8', 'pi/2', '5pi/8', '3pi/4', ... '7pi/8','pi', '9pi/8', '5pi/4', '11pi/8', '3pi/2', ... '13pi/8' '7pi/4', '15pi/8'}; for angn = 1:length(angz) subplot(211) imagesc(abs(cwtmexh.cfs(:,:,1,1,angn))); title(['Mexican hat at ' angz(angn) 'radians']); subplot(212) imagesc(abs(cwtcauchy.cfs(:,:,1,1,angn))); title(['Cauchy wavelet at ' angz(angn) 'radians']); pause(1); end