SPMD Video Writing with dynamic frames
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to write a video as follows:
- extract a plot of signal 1 (at given frame number) by calling another function
- extract a plot of signal 2 (at given frame number) by calling another function
- extract (at given frame number) the frame from a video object
- stitch the three together into a single image
- write (at given frame number) the image as a frame in a write video object
This has to be done for about 1500000 frames which is making the process very long. I have tried looking up spmd answers but I am unable to figure out how I would use it to write the video.
0 commentaires
Réponses (1)
Raymond Norris
le 4 Mai 2023
This might be an approach. Quite a bit of this is pseudo code and probably needs refining to synchronize the images into correct order.
Create a data queue (q) which is sent the image from the workers and writes the image into a video object.
v = VideoWriter(filename);
q = parallel.pool.DataQueue;
afterEach(q,@(an_image)writeImageToFrame(v,an_image));
parfor fidx = 1:1500000
signal_1 = fnc1(fidx);
signal_2 = fcn2(fidx);
frame = video_obj(fidx);
% Stitch the three together into a single image
the_image = signal_1 + signal_2 + frame;
send(q, the_image)
end
function writeImageToFrame(v,an_image)
v.writeVideo(v,an_image)
end
Fill in the code above, post it (what's working, what's not) and we can refine it.
0 commentaires
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!