LAT Hologramm-Software 2.0
Loading...
Searching...
No Matches
OffsetImage.m
Go to the documentation of this file.
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2% Funktion
3%
4%
5% Projekt: "Hologrammsoftware 2.0"
6%
7% Autor: Jan Marx
8% Zuletzt bearbeitet: 29.09.2022
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10function [image] = OffsetImage(input, x,y,pixelPitch)
11
12offset_px_x = int16(abs(round(x/pixelPitch)));
13offset_px_y = int16(abs(round(y/pixelPitch)));
14image = input;
15
16%Fallunterscheidung, auf welcher Seite Nullen ergänzt werden müssen.
17if(x<0)
18 image = [image(:,offset_px_x+1:end) zeros(size(image,1),offset_px_x)];
19elseif(x>0)
20 image = [zeros(size(image,1),offset_px_x) image(:,1:end-offset_px_x)];
21end
22if(y<0)
23 image = [image(offset_px_y+1:end,:); zeros(offset_px_y,size(image,2))];
24elseif(y>0)
25 image = [zeros(offset_px_y,size(image,2)); image(1:end-offset_px_y,:)];
26end
27end
28
function OffsetImage(in input, in x, in y, in pixelPitch)
Verschiebt eine Matrix um einen Abstand x,y und füllt die Ränder mit Nullen auf.