Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Haar Wavelet Transform on 8x8 matrix

Subject: Haar Wavelet Transform on 8x8 matrix

From: Shetul Saksena

Date: 23 Apr, 2010 14:06:04

Message: 1 of 1

I am new to matlab coding...
I have coded haar wavelet transformation of a 8x8 matrix.
I was hoping if someone could help me write a code which will iterate this code for an entire image (lets say 512x512 or any MxN resolution image)

heres the code:

clc;
clear all;

% P is the 8x8 matrix which I want to replace with any MxN image matrix
P=[576 704 1152 1280 1344 1472 1536 1536;
   704 640 1156 1088 1344 1408 1536 1600;
   768 832 1216 1472 1472 1536 1600 1600;
   832 832 960 1344 1536 1536 1600 1536;
   832 832 960 1216 1536 1600 1536 1536;
   960 896 896 1088 1600 1600 1600 1536;
   768 768 832 832 1280 1472 1600 1600;
   448 768 704 640 1280 1408 1600 1600];

W=[1/8 1/8 1/4 0 1/2 0 0 0;
   1/8 1/8 1/4 0 -1/2 0 0 0;
   1/8 1/8 -1/4 0 0 1/2 0 0;
   1/8 1/8 -1/4 0 0 -1/2 0 0;
   1/8 -1/8 0 1/4 0 0 1/2 0;
   1/8 -1/8 0 1/4 0 0 -1/2 0;
   1/8 -1/8 0 -1/4 0 0 0 1/2;
   1/8 -1/8 0 -1/4 0 0 0 -1/2];

for i=1:8
    Qr(i,:)= P(i,:)*W;
end
Q=round(Qr);

for i=1:8
    Tr(:,i)= W'*Q(:,i);
end
T=round(Tr)
% T is the output haar wavelet transform of the matrix

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us