%This program implements fringe pattern demodulation using the continuous %wavelet transform algorithm and employs the phase estimation method and %maximum ridge extraction algorithms. The Shannon mother wavelet is used %This program is written By Munther Gdeisat at The General Engineering %Research Institute at Liverpool John Moores University (UK) on 8th %Febraury 2009. clear; close all; clc; S=256; x=-S+1:1:S; [X, Y] = meshgrid(x,x); aa = size(X); noise = randn(aa(1), aa(2)); shape=peaks(2*S); figure(1) mesh(shape) fo = 1./16; Beta=1; fringes = cos(2.*pi.*fo.*X + Beta*shape) + 0*noise; figure(2) colormap(gray(256)) imagesc(fringes) xlabel('Pixels'); ylabel('Pixels') for k=1:2*S y = fringes(k,:); c=cwt(y,1:1:64, 'shan1-1.5'); A=abs(c); psi=angle(c); [maximum,row_index]=max(A); for m=1:2*S wrappedPhase(k,m)=psi(row_index(1,m),m); end end %Itoh Phase unwrapper unwrappedPhase = unwrap(unwrap(wrappedPhase)')'; unwrappedPhase = -(unwrappedPhase + 2*pi*fo.*X); error=unwrappedPhase-shape; error=error-mean(mean(error)); figure(3); colormap(gray(256));imagesc(wrappedPhase) figure(4);mesh(unwrappedPhase);xlabel('Pixels'); ylabel('Pixels'); zlabel('Phase (rad)') figure(5);mesh(error);xlabel('Pixels'); ylabel('Pixels'); zlabel('error (rad)')