VideoWriter create an empty video
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a problem with VideoWriter, after create the plot with the scatter function, Matlab create a new .avi file but it is empty, why?
figure ,hold on
xlim([25 31])
ylim([0 31])
c = colormap(jet(length(temp_discesa_i)));
for i = 1:length(temp_discesa_i)
pause(0.1)
scatter(temp_discesa_i(i), spazio_discesa_i(i),30,c(i,:),'filled');
pause(0.01);
end
video = VideoWriter('newfile2.avi', 'Uncompressed AVI');
open(video)
writeVideo(video,rand(300))
close(video)
Can someone help me? Thank you
Michela
1 Commento
Geoff Hayes
il 4 Lug 2017
Michela - what are you expecting to see in the video? When I run your code (or at least the last four lines), the newfile2.avi is created (roughly 335 kilobytes) with a single frame...since that is all that is being written to the video (a single 300x300 matrix). Are you expecting to see each frame of the updated plot? If so, then you have to create the video writer before your for loop and then, on each iteration of the loop, grab the frame from the plot and write it to file.
Please clarify what you are attempting to do.
Risposte (1)
Image Analyst
il 4 Lug 2017
You're only writing a single image to the video - it's all random numbers, plus it's floating point in the range 0-1 instead of the expected uint8 in the range 0-255.
To see how to do it, see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_create_a_movie_from_my_MATLAB_figures.3F
Also, see my attached demos.
0 Commenti
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!