DWT Image compression basics
This page of MATLAB source code covers DWT image compression. It explains basic steps for DWT based image compression matlab source code.
Before we move to image compression basics let us go through lossless and lossy data compression techniques. This is needed as in order to compress the image, initially input image of size 256x256 pixels is converted to raw data information.
Input image for DWT based compression
There are four basic steps for image compression and image restoration as outlined below.
STEP-1. Applying the transform (Haar or Daubechies-6 wavelet)
STEP-2. Choosing a soft threshold or hard threshold
STEP-3. Compression methods-Run Length Coding referred as RLE or DPCM(Differential Pulse Code Modulation)
STEP-4. Applying the Inverse Transform to recover the compressed image
DWT image compression MATLAB Code
% CLOSE ALL closes all the open figure windows.
% STEP-1: wavelet transform (rowwise) ...haar wavelet...traditional approach...
f(i,j+k) = X(i,2*j) - X(i,2*j-1);
X = f;
k=m/2; %wavelet transform column wise
X(i,j) = uint8((f(2*i,j)+f(2*i-1,j))/2);
Image compression output after step-1
%Y(i,j)=Y(i,j); % HARD THRESHOLD
Y(i,j)=sign(Y(i,j))*(abs(Y(i,j))-threshold);% SOFT THRESHOLD
Image compression output after step-2
Similarly perform step-3 to further apply compression to the image data obtained in step-2
%%STEP-3: Compression using coding technique(RLC Coding)
%%Coding Run Length coding
%%Original image data(8 bit)
%%127 127 127 127 129 129 129
%%Run length encoded image data
%%127 4 129 3
%%IMPLEMENT: Every such sequence we replace with a zero value followed by it's length.
At last perform the reverse operation as carried out in step1 to step-3 to recover the compressed image back to its input shape. This is referred as Inverse Transform.
Useful Links to MATLAB codes
Refer following as well as links mentioned on left side panel for useful MATLAB codes.
PTS for PAPR reduction
OFDM Preamble generation
Time off estimation corr
Freq off estimation corr
11a WLAN channel
11g WLAN channel
15.3 UWB channel