SPMD Video Writing with dynamic frames
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Raymond Norris
2023년 5월 4일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!