This example shows how to perform a translation
operation on an image using the
A translation operation shifts an image by a specified number of pixels
in either the x or y direction,
Read image. The size of the image is 256-by-256 pixels.
imshow displays the image with the
corner at 0,0.
I = imread('cameraman.tif'); imshow(I)
Translate the image, shifting the image by 15 pixels in
the x direction and 25 pixels in the y direction.
Note that, by default,
imtranslate displays the
translated image within the boundaries (or limits) of the original
256-by-256 image. This results in some of the translated image being
clipped. To see the entire translated image, use the
(shown in the following step).
J = imtranslate(I,[15, 25]); figure; imshow(J);
'OutputView' parameter set
'full' to adjust the display to show the entire
J = imtranslate(I,[15, 25],'OutputView','full'); figure; imshow(J);