Matlab中没有直接用于图像平移的函数,代码是基于灰度形态学的图像平移实现
%图像平移
A=imread('example.jpg');
%translate(SE, [y x])在结构元素SE上进行y和x方向的位移 正数对应右移和下移
se=translate(strel(1),[100 80]);
B=imdilate(A,se);%形态学膨胀
figure;
subplot(1,2,1),subimage(A);
title('原图像')
subplot(1,2,2),subimage(B);
title('图像平移')
结果如下