MATLAB: How move locations of each pixels in an image to another location

Image Processing Toolboxmove pixels

hai i have a jpg image . now i am trying to move each pixels to new locations. please help me

Best Answer

I = imread('peppers.png') ;
figure(1)
imshow(I)
% indices to move
idx0 = 10:100 ;
idy0 = 10:100 ;
% indices move here
idx1 = 210:300 ;
idy1 = 210:300 ;
% move these pixels
T0 = I(idx0,idx1,:) ;
T1 = I(idx1,idy1,:) ;
% replace
I(idx0,idy0,:) = T1 ;
I(idx1,idy1,:) = T0 ;
figure(2)
imshow(I)
Related Question