From: Shetul Saksena on
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