Hi, need help combing these two codes. One shifts an image horizontally and one shifts an image vertically. Been tinkering with the codes for hours now and cannot figure out how to combine the two so they both do their respective shifts at the same time on the same image. Thank you!
X=imread('photo1.jpg');
X_double=double(X);
X_gray = 0.3*X_double(:,:,1) + 0.3*X_double(:,:,2) + 0.3*X_double(:,:,3);
imagesc(uint8(X_gray))
colormap('gray')
[m,n]=size(X1);
r=240;
E=eye(n);
T=zeros(n,n);
T(:,1:r)=E(:,n-(r-1):n);
T(:,r+1:n)=E(:,1:n-r);
X_shift=X1*T;
imagesc(uint8(X_shift));
colormap('gray');
[m,n] = size(X_gray);
r = 100;
E = eye(m);
T = zeros(m);
T(1:r,:) = E(m-(r-1):m,:);
T(r+1:m,:) = E(1:m-r,:);
X_shift = T*X_gray
imagesc(uint8(X_shift));
colormap('gray');