function [RR,DH,DV,DO]=Haar(input); 

[M,N] = size(input);
AUX1 = input(1:2:M,1:2:N); 
AUX2 = input(1:2:M,2:2:N); 
AUX3 = input(2:2:M,1:2:N); 
AUX4 = input(2:2:M,2:2:N); 
RR=(AUX1+AUX2+AUX3+AUX4)/2;
DH=(AUX1+AUX2-AUX3-AUX4)/2;
DV=(AUX1+AUX3-AUX2-AUX4)/2; 
DO=(AUX1-AUX2-AUX3+AUX4)/2;
