CODE:
clear all;
close all;
clc;
a=imread('cameraman.tif');
c=a;
b=imread('coins.png');
b=imresize(b,[256 256]);
d=b;
x=0;
y=0;
for i=1:128
x=x+1;
y=0;
for j=1:256
y=y+1;
t(x,y)=a(j,i);
a(j,i)=b(y,x);
b(y,x)=t(x,y);
end
end
subplot(2,2,1);
imshow(c);
title('image of
cameramen','color','r');
subplot(2,2,2);
imshow(d);
title('image of
coins','color','m');
subplot(2,2,3);
imshow(a);
title('image of half
coins and cameramen','color','r');
subplot(2,2,4);
imshow(b);
title('image of half
coins and cameramen','color','m');
OUTPUT: