function wavedec2Test(percent)
 
 % Bild einlesen
 I = imread('plane.png');
 I = double(I);
 
 % Matrizen von Farben definieren 
 R = I(:, :, 1);  % Rot
 G = I(:, :, 2);  % Grün
 B = I(:, :, 3);  % Blau
 
 % Anzahl Levels berechnen
 N = ceil(log2(length(R)));
 
 % Analyse: WAVELET-Koeffizienten berechnen
 [RC, RS] = wavedec2(R, N, 'haar');  				    
 [GC, GS] = wavedec2(G, N, 'haar');
 [BC, BS] = wavedec2(B, N, 'haar');
 
 % Anzahl Koeffizienten nach der Kompression definieren
 DIM = floor(length(RC)*(percent*0.01));
 
 % Kleine Koeffizienten weglassen
 [~,idx]=sort(abs(RC(:)),'descend');
 RC(idx(DIM+1:end)) = 0;
 [~,idx]=sort(abs(GC(:)),'descend');
 GC(idx(DIM+1:end)) = 0;
 [~,idx]=sort(abs(BC(:)),'descend');
 BC(idx(DIM+1:end)) = 0;
 
 % Synthese: Farben neu definieren
 RR = waverec2(RC, RS, 'haar');   
 GR = waverec2(GC, GS, 'haar');
 BR = waverec2(BC, BS, 'haar');
 
 % Neues Bild speichern
 IR = cat(3, RR, GR, BR);
 IR = uint8(IR);
 imshow(IR);
 imwrite(IR, sprintf('test%02d.png', percent), 'png');
end

% In 1D: 
% [C,L] = wavedec(X,N,'haar') -- decomposition, X - input vector, C - output wavelet coeff, L - output "bookkeeping vector"
% X = waverec(C,L,'haar') -- reconstruction, C - input coeff, X - output vector

% In 2D: 
% [C,L] = wavedec2(X,N,'haar') -- decomposition, X - input matrix, C - wavelet coeff
% X = waverec2(C,L,'haar') -- reconstruction, C - input coeff, X - output matrix

% In 3D: wavedec3, waverec3


