I'm trying to understand translation of an image (from one spatial point to another) and wrote some code in order to do so however the image isn't translating/moving.
I read that a translation matrix would typically be [1 0 tx; 0 1 ty; 0 0 1] where (tx, ty) would be the new spatial co-ordinates that the image would move to,and you would multiply the translation matrix by the C = imread(image), however how would that work if the size of the image was for example 684 X 1024 ?
I tried to do it this way instead.
Can someone please tell me where I'm going wrong ?
PS: I don't want to use imtranslate MATLAB function.
axis([-1 1 -1 1])
S = [1 -1 -1 1; 1 1 -1 -1; 1 1 1 1]
T = [5;4];
new_x = size(S,1) + T(1,1);
new_y = size(S,2) + T(2,1);
Z = zeros(new_x,new_y);
M = Z(T(1,1):end-1, T(2,1):end-1) + S(:,:);