2012-04-23 71 views
2

我需要将两个图像添加到一个matlab图形,并将它们移动到设置路径中。但是当我调整它的大小时,我的图像加载了完整的大小,它只是对它进行了像素化处理,而当我尝试移动它时,它失败了。继承人我的代码:MATLAB,移动图像

close all 
clc 
clear all 

fh = figure; 
bgh = uibuttongroup('Parent',fh,'Title',... 
    'John''s Animation','Position',[.1 .2 .8 .6]); 
set(bgh,'FontName','Trebuchet MS','FontSize',15) 
rbh1 = uicontrol(bgh,'Style','radiobutton','String','START CAR!',... 
    'Units','normalized','Position',[.1 .6 .3 .2]); 
rbh2 = uicontrol(bgh,'Style','radiobutton','String','STOP!',... 
    'Units','normalized','Position',[.1 .4 .3 .2]); 
set(rbh1,'FontName','Trebuchet MS', ... 
    'FontSize',15,'ForegroundColor','r') 
set(rbh2,'FontName','Trebuchet MS', ... 
    'FontSize',15,'ForegroundColor','g') 

% axis ([2 1 2 1]) 
axis square off 
car = imread('car.jpg'); 
carg = rgb2gray(car); 
% carg = imresize(car,1); 
h = imshow(carg); 

steps = linspace(0,2,1000); 

set(rbh1,'CallBack','for i = 1:200, set(h,''XData'',steps(i)),pause(0.0001),end') 

回答