0
我有一个JPG图像文件夹,我想将它们转换成电影,但我也想在电影上有轴(图像没有轴)。我的图像是灰度.i我做了一些事情,但这是不正确的。命令电影(F,1);显示电影,但轴不固定在电影上。我保存的AVI仅显示没有轴的电影(图像的运动)。这是我的代码:使用图像轴制作电影matlab
vidObj = VideoWriter('sample.avi');
open(vidObj);
for num_frame=1:40
%find filename of the image
filename = sprintf('%s_%d.jpg','new_image/sample_image',num_frame);
cmap = colormap(gray);
res = grs2rgb(filename,cmap);%convert image from grayscale to rgb
F(num_frame)=im2frame(res);
end
imshow('new_image/sample_image_1.jpg');%show the first image
set(gca,'FontSize',14);
xlabel('Lateral distance [mm]');
ylabel('Axial distance [mm]');
xlim([-50 50]);
ylim([20 105]);
axis([-50 50 20 105]);
axis ('on');
movie(F,1);
writeVideo(vidObj,F);
close(vidObj);
是什么错误?
你有预分配
F
尝试[getFrame](http://uk.mathworks.com/help/matlab/ref/getframe.html?nocookie=true)? – kkuilla 2014-11-24 13:00:19