1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4% Optionen für Mode:
'stretch',
'original',
'repeat'
6% Projekt:
"Hologrammsoftware 2.0"
9% Zuletzt bearbeitet: 28.09.2022
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12%Passt ein Bild an eine andere Auflösung an.
13% Verschiedene Anpassungsoptionen wählbar,
s.u.
20elseif (mode ==
"stretch")
22 image = imresize(input, [x y],
'nearest');
24elseif (mode ==
"original")
25 %Beibehalten der Originalauflösung.
26 %Ist das Bild größer als die Zielauflösung, wird es mittig
28 %Ist das Bild kleiner als die Zielauflösung, werden Nullen um das Bild
29 %ergänzt (vgl. Zero-Padding)
32 image(floor((x-x0)/2)+1:floor((x+x0)/2),floor((y-y0)/2)+1:floor((y+y0)/2))=input;
33 elseif(x0>=x && y0>=y)
34 image = input(floor((x0-x)/2)+1:floor((x0+x)/2),floor((y0-y)/2)+1:floor((y0+y)/2));
35 elseif(x0<=x && y0>=y)
37 image(floor((x-x0)/2)+1:floor((x+x0)/2),:)= input(:,floor((y0-y)/2)+1:floor((y0+y)/2));
38 elseif(x0>=x && y0<=y)
40 image(:,floor((y-y0)/2)+1:floor((y+y0)/2))=input(floor((x0-x)/2)+1:floor((x0+x)/2),:);
43elseif (mode ==
"repeat")
44 %Ist das Bild kleiner als die Zielauflösung, so wird ein sich
45 %wiederholendes Muster des Bildes erzeugt
49 image(ki,kj) = input(mod(ki,x0)+1,mod(kj,y0)+1);
56 disp(
'ERROR - Unknown Image ResizeMode');
function ResizeImage(in input, in x, in y, in mode)
Passt ein Bild an eine andere Auflösung an. Verschiedene Anpassungsoptionen wählbar.