image thumbnail
from Non-Redundant Shift-Invariant Complex Wavelet Transform by Reshad Hosseini
2 m-file functions for applying complex wavelet and inverse complex wavelet transforms.

example.m
clear all
% This is a simple test function to examine the proposed wavelet transform
if ~exist('conv3','file')
     mex conv3.c
end

X=double(imread('moon.tif'))/255; % Loading an image
level=2; % this is the index of the level

figure(1),imshow(X);
[yout,Sizes]=CWT_downcoef(X,level); % Applying the transform
figure(2);
for orient=1:4
    for recom=1:2
        num_sub=(orient-1)*2+recom; %This is the index of the subband
        indexb=sum(ones(1,(level-1)).*Sizes.sum_subbands(1:(level-1)))*8;
        indexb=indexb+(num_sub-1)*Sizes.sum_subbands(level)+1;
        indexe=indexb+Sizes.sum_subbands(level)-1;
        if recom==1
            Xcut_Re=reshape(yout(indexb:indexe),[Sizes.subbands(level,1) Sizes.subbands(level,2)]);
        else
            Xcut_Im=reshape(yout(indexb:indexe),[Sizes.subbands(level,1) Sizes.subbands(level,2)]);
        end
    end
    subplot(4,3,(orient-1)*3+1),imshow(abs(Xcut_Re));
    if orient==1
        ylabel('135^{0}');
    elseif orient==2
        ylabel('45^{0}');
    elseif orient==3
        ylabel('0^{0}');
    elseif orient==4
        ylabel('90^{0}');
    end
    if orient==1
    title('Real part');
    end
    subplot(4,3,(orient-1)*3+2),imshow(abs(Xcut_Im));
    if orient==1
    title('Imaginary part');
    end
    subplot(4,3,(orient-1)*3+3),imshow(sqrt(Xcut_Im.^2+Xcut_Re.^2));
    if orient ==1
    title('Absolute Value');
    end
end
X2=CWT_upcoef(yout,Sizes);
figure(3),imshow(X2);

Contact us at files@mathworks.com