# Electronics and Electrical Engineering Design Forum

## General

## MATLAB Image Compression using Haar Wavelet Transform

How can I write a Matlab function haar_dec.m for computing the J-level, J = 1, 2, . . . , log2N, Haar wavelet transform of an N x N image, where N is a power of 2? The function can repeatedly call the function haar.m (see below) which computes 1-level of the 2-D Haar wavelet transform. The function should take two arguments: an input image im and the number of levels J, and output an array of N x N wavelet coefficients C in the arrangement as illustrated in the figure attached.

function [w1,w2,w3,w4] = haar(x)

n = length(x);

for i=1:n/2
for j=1:n/2
i0 = 2*(i-1);
j0 = 2*(j-1);
w1(i,j) = 1/2*(x(i0+1,j0+1)+x(i0+1,j0+2)+x(i0+2,j0+1)+x(i0+2,j0+2));
w2(i,j) = 1/2*(x(i0+1,j0+1)+x(i0+1,j0+2)-x(i0+2,j0+1)-x(i0+2,j0+2));
w3(i,j) = 1/2*(x(i0+1,j0+1)-x(i0+1,j0+2)+x(i0+2,j0+1)-x(i0+2,j0+2));
w4(i,j) = 1/2*(x(i0+1,j0+1)-x(i0+1,j0+2)-x(i0+2,j0+1)+x(i0+2,j0+2));
end

end

(+53), 1 year agoI dont know a great deal about differrnciation and intergration In fact I find maths difficult at the best of times but I do undertand matrices and how they work with image manipulation

So ive done some searching on the net for you and some of the notes I have here might explain some of this for you As for applying this to c programming you will have to use matrices to resolve the problem which are nothing except muti dimension arrays with your image bits stored in the arraySorry I cant be of more assistance to you but I would dearly like to know how to differntiate and intergrate together with far more knowledge of j notation.

I would be able to do so much more

Unfortunately much to all our disgust The universities decided for some unkown reason in the UK that maths lecturers were not a requirement and subsequently made many of them redundant

Personally I disagree with this but then our hands are tied when it comes to this

Cutting costs they term this and then wonder why english maths standards are not good also why we see a reduction in univerities from 100 000 to 70 000 each year as charges for colleges,univerisities are increased tenfold Sad state of affiars

Need I say any more regards this