function Hauptwavelet2D
%Hauptprogramm Anwendung der zweidimensionalen periodischen Wavelet-Transformation auf Bilder
clf reset
clc
clear all;
close all;
echo off


%input image
input_s=0;

if input_s==0              %Shannon-Bild
    a=imread ('Shannon_2.jpg');
	b=a(1:256,1:256);
	a=double(b);
	f=a/256;
[N1,N2] = size(f)
elseif input_s==1          %Duisburger UniversitŠt
    a= imread ('duisburg.jpg');
	b=a(1:400,1:300);
    a=double(b);
    f=a/256;
end

figure,imagesc(f); axis image
set(gca,'FontSize',15);
colormap(gray);

% Filterkoeffizienten
input2=2;

if input2==1 
% Daubechies Wavelets
h=[(1+sqrt(3))/4/sqrt(2), (3+sqrt(3))/4/sqrt(2), (3-sqrt(3))/4/sqrt(2), (1-sqrt(3))/4/sqrt(2)]
k0=0; k00=0; %Index des Anfangskoeffizienten
g=[(1-sqrt(3))/4/sqrt(2), -(3-sqrt(3))/4/sqrt(2), (3+sqrt(3))/4/sqrt(2), -(1+sqrt(3))/4/sqrt(2)]
k1=-2; k11=-2; %Index des Anfangskoeffizienten
[M1,M2]= size(g);  % L2 LŠnge des Filters g
h1=h;
g1=g;

elseif input2==2
%7-9 Filterbank
h=[-0.045635881557,-0.028771763114,0.295635881557,0.557543526229,0.295635881557,-0.028771763114,-0.045635881557];
k0=-3  %Index des Anfangskoeffizienten
h1=2*[0.026748757411,-0.016864118443,-0.078223266529,0.266864118443,0.602949018236,0.266864118443,-0.078223266529,-0.016864118443,0.026748757411];
k00=-4;
g=2*[0.026748757411,0.016864118443,-0.078223266529,-0.266864118443,0.602949018236,-0.266864118443,-0.078223266529,0.016864118443,0.026748757411];
k1=-3;
g1=[0.045635881557,-0.028771763114,-0.295635881557,0.557543526229,-0.295635881557,-0.028771763114,0.045635881557];
k11=-2;  

end;


g=Wavelettrans2D(f,h,k0,g,k1);
[N1,N2]= size(g);
g1=g(1:N1/2+2,1:N2/2+2);
g2=g(N1/2+3:N1,1:N2/2+2);
g3=g(1:N1/2+2,N2/2+3:N2);
g4=g(N1/2+3:N1,N2/2+3:N2);
 
figure,imagesc(g1); axis image
set(gca,'FontSize',15);
colormap(gray);

 
figure,imagesc(1-abs(g2)); axis image
set(gca,'FontSize',15);
colormap(gray);

 
figure,imagesc(1-abs(g3)); axis image
set(gca,'FontSize',15);
colormap(gray);
 
figure,imagesc(1-abs(g4)); axis image
set(gca,'FontSize',15);
colormap(gray);

