Main Content

capture

Class: vr.canvas

(To be removed) Capture virtual reality canvas image

vr.canvas.capture will be removed in a future release. For more information, see Version History.

Syntax

image_capture = capture(canvas)

Description

image_capture = capture(canvas) captures a virtual reality canvas into a TrueColor RGB image. You can display this image using the image command.

Input Arguments

expand all

Virtual reality canvas, specified as a vr.canvas object.

Output Arguments

expand all

Virtual reality canvas image, captured as an array. The array is an m-by-n-by-3 data array that defines red, green, and blue color components for each individual pixel.

Examples

expand all

Create and open a vrworld object and associate it with the virtual world vrlights.x3d.

lights_world = vrworld('vrlights');
open(lights_world);

Create a vr.canvas object for lights_world.

f = figure;
c = vr.canvas(lights_world, f, [30 30 300 200]);  

vrdrawnow;

Capture an image of the canvas.

image_capture = capture(c); 

Display an RGB image of the canvas in a MATLAB® figure window.

figure;
image(image_capture);

Version History

Introduced before R2006a

collapse all

R2023b: To be removed

The capture will be removed in a future release. Instead, use sim3d classes and Simulation 3D blocks to interface MATLAB® and Simulink® with the Unreal Engine® 3D simulation environment. To get started, see Create 3D Simulations in Unreal Engine Environment.