Main Content

vr.utils.stereo3d class

Superclasses:

Stereoscopic vision settings forvr.canvasandvr.figureobjects

描述

Tip

Use thevr.utils.stereo3dclass for advanced tuning of stereoscopic viewer and canvas properties. You can select and use basic stereoscopic settings from the Viewer menu.

Specifies these stereoscopic vision properties:

  • Active, anaglyph, or no stereoscopic vision

  • Camera offset

  • Camera angle

  • Color filter for the left and right cameras

  • Horizontal image translation (HIT)

Use avr.utils.stereo3dobject to set theStereo3D,Stereo3DCameraOffset, andStereo3DHITstereoscopic vision properties ofvrfigureandvr.canvasobjects. Specifying avr.utils.stereo3dobject to set onevrfigureandvr.canvasproperty also sets the other stereoscopic vision properties. Using avr.utils.stereo3d对象还指定了颜色过滤器for the left and right cameras. You cannot set camera color filters directly using thevrfigure/setmethod orvr.canvasproperties.

Construction

stereoVision= vr.utils.stereo3d.OFFdisables stereoscopic vision.

stereoVision= vr.utils.stereo3d.ACTIVEenables active stereoscopic vision.

stereoVision= vr.utils.stereo3d.ANAGLYPHenables red-cyan anaglyph stereoscopic vision.

example

stereoVision= vr.utils.stereo3d.RED_CYANenables red-cyan anaglyph stereoscopic vision.

stereoVision= vr.utils.stereo3d.ANAGLYPH_GREEN_MAGENTAenables green-magenta anaglyph stereoscopic vision.

stereoVision= vr.utils.stereo3d.ANAGLYPH_RED_GREENenables red-green anaglyph stereoscopic vision.

stereoVision= vr.utils.stereo3d.ANAGLYPH_RED_BLUEenables red-blue anaglyph stereoscopic vision.

stereoVision= vr.utils.stereo3d.ANAGLYPH_YELLOW_BLUEenables yellow-blue anaglyph stereoscopic vision.

Output Arguments

expand all

Stereoscopic vision settings forvr.canvasandvrfigureobjects, represented by avr.utils.stereo3dobject.

Properties

expand all

Camera angle, specified using the predefinedDEFAULT_CAMERA_ANGLEor in radians. This property is in effect when you enable stereoscopic vision.

This property does not apply tovr.canvasorvrfigureobjects.

Camera offset, specified as a number representing the distance in virtual world units of left/right camera from parallax. The parallax is the difference in the apparent position of an object viewed from two cameras.

This property sets theStereo3DCameraOffset财产的vr.canvasorvrfigureobject.

Horizontal image translation, specified as either the predefinedDEFAULT_HITor as a floating-point number from 0 through 1, inclusive. The number of pixels for stereo 3D horizontal image translation (HIT) derives from this number. Horizontal image translation is the horizontal relationship of the two stereo images. By default, the background image is at zero and the foreground image appears to pop out from the monitor toward the person viewing the virtual world. The larger the value, the further back the background appears to be.

This property sets theStereo3DHIT财产的vr.canvasorvrfigureobject.

Color filter of the left camera, specified as a row vector of nine floating-point numbers or using a predefined filter.

If you specify a row vector, use floating-point numbers from 0 through 1. The first three numbers represent the red value, the second three numbers represent the green value, and the last three numbers represent the blue value. For example, specifying1for the first three numbers and zeros for the other numbers produces a pure red filter.

The predefined filters are:

  • CAMERA_FILTER_FULL

  • CAMERA_FILTER_RED

  • CAMERA_FILTER_CYAN

  • CAMERA_FILTER_GREEN

  • CAMERA_FILTER_MAGENTA

  • CAMERA_FILTER_YELLOW

  • CAMERA_FILTER_BLUE

This property specifies the left camera filter forvr.canvasorvrfigureobjects.

Example:stereo3d_object.LeftCameraFilter = [0.1 0.5 0.5 0.0 0.0 0.0 1.0 0.5 0.5];

Example:stereo3d_object.LeftCameraFilter = stereo3d_object.CAMERA_FILTER_RED

Stereoscopic vision mode. Read only.

  • STEREO3D_OFF— No stereoscopic vision.

  • STEREO3D_ACTIVE— Active stereoscopic vision. Stereoscopic vision uses quad-buffered rendering. You can use a graphics card driver to output stereoscopic vision. This mode allows active stereoscopic vision via shutter glasses.

  • STEREO3D_ANAGLYPH— Anaglyph stereoscopic vision. Stereoscopic vision is enabled using red-cyan anaglyph. Use appropriate anaglyph 3D glasses to see the effect.

This property sets theStereo3D财产的vr.canvasorvrfigureobject.

Color filter of the right camera, specified as a row vector of nine floating-point numbers or using a predefined filter.

If you specify a row vector, use floating-point numbers from 0 through 1. The first three numbers represent the red value, the second three numbers represent the green value, and the last three numbers represent the blue value. For example, specifying1for the first three numbers and zeros for the other numbers produces a pure red filter.

The predefined filters are:

  • CAMERA_FILTER_FULL

  • CAMERA_FILTER_RED

  • CAMERA_FILTER_CYAN

  • CAMERA_FILTER_GREEN

  • CAMERA_FILTER_MAGENTA

  • CAMERA_FILTER_YELLOW

  • CAMERA_FILTER_BLUE

This property specifies the right camera filter forvr.canvasorvrfigureobjects.

Example:stereo3d_object.RightCameraFilter = [0.1 0.5 0.5 0.0 0.0 0.0 1.0 0.5 0.5];

Example:stereo3d_object.RightCameraFilter = stereo3d_object.CAMERA_FILTER_RED

Examples

collapse all

Create a virtual world.

w = vrworld('octavia_scene'); open(w); c = vr.canvas(w);

Specify stereoscopic vision settings.

s3d = vr.utils.stereo3d.ANAGLYPH_RED_CYAN; s3d.CameraOffset = 0.05; s3d.CameraAngle = pi/128;

Modify the red component of filter for the left camera.

s3d.LeftCameraFilter(1:3) = s3d.LeftCameraFilter(1:3)...+ [0.1 -0.05 -0.05];

Apply stereoscopic vision settings ofvr.utils.stereo3dobjects3dtovr.canvasobjectc.

set(c,'Stereo3D',s3d)

Version History

Introduced in R2015a