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