Image if the forward mapping is inefficient, does not complete such shortcomings, so generally we use backward mapping.
(1) Pan:
i = imread (' apostles.jpg '); i = double (i); B = zeros (Size (I)); H = size (I); move_x = 100;move_y = 150; B (move_y + 1:h (1), Move_x+1:h (2), 1:h (3)) = ... I (1:h (1)-move_y, 1:h (2)-Move_x, 1:h (3)), subplot (1,2,1), Subimage (Uint8 (I)) title (' Original image ') subplot (1,2,2), Subimage ( Uint8 (B)) title (' Translational Transform ');
I = Imread (' apostles.jpg '); Se=translate (Strel (1), [150 100]); B = Imdilate (I,se), Figure;subplot (1,2,1), Subimage (I), title (' Original image '), subplot (1,2,2), Subimage (B); title (' Translational Transformation ');
(2) Image:
I = Imread (' apostles.jpg ');
[Height, width, dim]=size (I);% horizontal Mirror Transform tform = maketform (' affine ', [-1 0 0;0 1 0; Width 0 1]); B=imtransform (I, Tform, ' nearest ');% vertical mirror Transform Tform2 = maketform (' affine ', [1 0 0; 0-1 0; 0 height 1]); C=imtransform (i, Tform2, ' nearest '); subplot (1,3,1), Imshow (I); title (' Original image '); subplot (1,3,2), Imshow (B); title (' Horizontal image ') ; subplot (1,3,3), Imshow (C); title (' Vertical image ');
A = Imread (' apostles.jpg ');
A = double (a); figure (1), Imshow (Uint8 (a)); h = size (A); figure (2), B (1:h (1), 1:h (2), 1:h (3)) =a (H (1): -1:1,1:h (2), 1:h (3)),% vertical mirror imshow (uint8 (B)); figure (3), C (1:h (1 ), 1:h (2), 1:h (3)) =a (1:h (1), H (2): -1:1,1:h (3)),% horizontal mirror imshow (Uint8 (C));
(3) Transpose:
I = Imread (' apostles.jpg '); tform = Maketform (' affine ', [0 1 0; 1 0 0; 0 0 1]);% definition transpose matrix B = Imtransform (I, Tform, ' nearest '); s Ubplot (1,2,1), Imshow (I) title (' Original image '), subplot (1,2,2), Imshow (B) title (' Transpose image ');
(4) Zoom:
I = Imread (' C:\apostles.jpg '); A = Imresize (i, 1.5, ' nearest ');% recent interpolation method B = imresize (i, 1.5, ' bilinear ');% bilinear interpolation c = imresize (i, 1.5, ' bicubic ');% two cubic interpolation method subp Lot (2,2,1), Imshow (I), title (' original '), subplot (2,2,2), Imshow (A), title (' nearest '), subplot (2,2,3), Imshow (B), Title (' bilinear '); subplot (2,2,4), Imshow (C), title (' Bicubic '); A = Imresize (I, [a b], ' nearest '),% difference in different directions
(5) Rotation:
I = Imread (' apostles.jpg '); A = Imrotate (i, +, ' nearest '),% rotated 30 degrees, nearest interpolation figure (1), Imshow (A) B = Imrotate (i, A, ' bilinear ', ' loose ');% rotates 45 degrees, Two-time linear interpolation figure (2), Imshow (B)
The geometric transformation of MATLAB image