Search This Blog

Wednesday, 22 March 2017

Data Compression using 2D Wavelet Analysis

(Type this code in editor then run it)

load woman;              % Load original image.
image(X)
title('Original Image')
colormap(map)
x = X(100:200,100:200);  % Select ROI
n = 5;                   % Decomposition Level
w = 'sym8';              % Near symmetric wavelet


[c l] = wavedec2(x,n,w); % Multilevel 2-D wavelet decomposition.
opt = 'gbl'; % Global threshold
thr = 20;    % Threshold
sorh = 'h';  % Hard thresholding
keepapp = 1; % Approximation coefficients cannot be thresholded
[xd,cxd,lxd,perf0,perfl2] = wdencmp(opt,c,l,w,n,thr,sorh,keepapp);
image(x)
title('Original Image')
colormap(map)
figure('Color','white'),image(xd)
title('Compressed Image - Global Threshold = 20')

colormap(map)

Output:


No comments:

Post a Comment