SPMD Video Writing with dynamic frames
4 views (last 30 days)
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.
Raymond Norris on 4 May 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;
Fill in the code above, post it (what's working, what's not) and we can refine it.