2

我需要将两个图像添加到 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')
4

0 回答 0