Effacer les filtres
Effacer les filtres

SPMD Video Writing with dynamic frames

7 vues (au cours des 30 derniers jours)
Deepika Gupta
Deepika Gupta le 4 Mai 2023
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.

Réponses (1)

Raymond Norris
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;
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)
function writeImageToFrame(v,an_image)
Fill in the code above, post it (what's working, what's not) and we can refine it.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by