Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
I'm extracting frames of selected events from an avi file (5 GB). The way I did it is saving all frames as images, creating avi after that. Worked with few events, more events now. Can I store frames in workspace (as array), then create avi?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
numArrays = numel(FrameNumbersEvents); %assign variable to different green water events
A = cell(numArrays,1);
for n = 1:numArrays;
A{n} =FrameNumbersEvents(n);
end
for k = (cell2mat(A(1))-15) : (cell2mat(A(1))+15);
this_frame = read(obj, k);
thisfig = figure();
thisax = axes('Parent', thisfig);
image(this_frame, 'Parent', thisax);
title(thisax, sprintf('Frame #%d', k));
end
for i=1:2
saveas(figure(i),fullfile('C:\Users\syward.vanwijnbergen\Desktop\Model test analysis\Frames from videos\Video 003_001',['EventFrame' num2str((i-1)) '.jpg']));
end
clear this_frame
clear thisax
for i=4:30
saveas(figure(i),fullfile('C:\Users\syward.vanwijnbergen\Desktop\Model test analysis\Frames from videos\Video 003_001',['EventFrame' num2str((i-1)) '.jpg']));
end
0 commentaires
Réponses (2)
Dasharath Gulvady
le 21 Août 2015
I assume you are using "VideoWriter" to create an avi file from the images. I understand that you would like to not convert the frames to the image files, instead use the frames directly to create an avi file.
You can achieve this by using "getframe" function first to get the frames, store them in the workspace and then pass it to "writeVideo" function. Refer to the below documentation page example which shows this:
0 commentaires
Image Analyst
le 21 Août 2015
See my attached demo. It starts with an avi file, then writes out all the individual frames to disk. The it preallocates a cell array for all the frames (like you want). Then it writes out the individual frames to a new video in the loop over frames. If you want, you could move the writeVideo() out of the loop and write the whole video in one shot. Feel free to adapt this demo.
0 commentaires
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!