印度舞培训:图像位平面移位在Matlab中如何实现吗?[图像图形(图象)论坛]

来源:百度文库 编辑:中财网 时间:2024/04/27 22:40:12

>> help move

move.mnot found.

>> help immove

immove.m not found.

>>help imove

imove.m not found.

>> 所以就得自己动手了

也不难吗,

clc;
clear;

I = imread('E:\test\chinalake.bmp','bmp');
I= double(I);

[height,width] = size(I);
Size = height*width;

xmove= input('请输入x方向的平移量:');
ymove = input('请输入y方向的平移量:');

I_moveresult= zeros(height,width);           % Apply the new array to store theresult image

if (xmove > width | xmove < -width)
   imshow(uint8(I_moveresult));
end

if (ymove > height | ymove< -height)
    imshow(uint8(I_moveresult));
end

if (ymove> 0 & xmove > 0)
   I_mvoeresult(ymove:height,xmove:width) =I(1:height-ymove+1,1:width-xmove+1);
elseif(ymove > 0 & xmove< 0)
    ...
elseif(ymove < 0 & xmove > 0)
    ...
elseif(ymove< 0 & xmove < 0)
    ...
end

figure;
imshow(uint8(I_moveresult));