Clear Filters
Clear Filters

Capturing VR canvas in figure with plots.

1 view (last 30 days)
I am running a simulink vr-sink block and an S-function to display a vr.canvas on a figure with plots.(Modified version of the 'Vehicle Dynamics Visualization with Graphs' example).
I want to record the whole figure in to a video -> canvas with the plots.
To initialize the figure I use:
vr_world = vrworld(filePath);
open(vr_world);
FigHandle = figure();
c1 = vr.canvas(vr_world, 'Parent', FigHandle);
v = VideoWriter('newfile.avi');
set(v,'FrameRate',20,'Quality',90);
open(v)
Then when I update the figure plots and try to capture a frame:
F = getframe(FigHandle);
writeVideo(v,F);
After closing the videowriter, the video will play back, but without the canvas. The video will show the plots updating and a white square where the canvas was. To combat this I tried using:
c1P = capture(c1); % c1 is created in another similar figure
imshow(c1P, 'Parent', c1_Axes)
F = getframe(FigHandle);
writeVideo(v,F);
While this works it is very slow, and for a couple hour capture it can be a problem. Is there a more direct/ time efficient way to do this type of capture? Thanks.

Answers (0)

Categories

Find more on View and Analyze Simulation Results in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!