Display

View Streaming Video in MATLAB

Video Player System Object

Use the video player System object when you require a simple video display in MATLAB.

For more information about the video player object, see the vision.VideoPlayer reference page.

Deployable Video Player System Object

Use the deployable video player object as a basic display viewer designed for optimal performance. This block supports code generation for the Windows® platform.

For more information about the Deployable Video Player block, see the vision.DeployableVideoPlayer object reference page.

Preview Video in MATLAB using MPlay Function

The MPlay function enables you to view videos represented as variables in the MATLAB® workspace.

You can open several instances of the MPlay function simultaneously to view multiple video data sources at once. You can also dock these MPlay GUIs in the MATLAB desktop. Use the figure arrangement buttons in the upper-right corner of the Sinks window to control the placement of the docked GUIs.

The MPlay GUI enables you to view videos directly from files without having to load all the video data into memory at once. The following procedure shows you how to use the MPlay GUI to load and view a video one frame at a time:

  1. On the MPlay GUI, click open file icon,

  2. Use the Connect to File dialog box to navigate to the multimedia file you want to view in the MPlay window.

    Click Open. The first frame of the video appears in the MPlay window.

      Note:   The MPlay GUI supports AVI files that the VideoReader supports.

  3. Experiment with the MPlay GUI by using it to play and interact with the video stream.

View Video with Simulink Blocks

Video Viewer Block

Use the Video Viewer block when you require a wired-in video display with simulation controls in your Simulink® model. The Video Viewer block provides simulation control buttons directly from the GUI. The block integrates play, pause, and step features while running the model and also provides video analysis tools such as pixel region viewer.

For more information about the Video Viewer block, see the Video Viewer block reference page.

To Video Display Block

Use the To Video Display block in your Simulink model as a simple display viewer designed for optimal performance. This block supports code generation for the Windows platform.

For more information about the To Video Display block, see the To Video Display block reference page.

View Video with MPlay

The MPlay GUI enables you to view video signals in Simulink models without adding blocks to your model.

You can open several instances of the MPlay GUI simultaneously to view multiple video data sources at once. You can also dock these MPlay GUIs in the MATLAB desktop. Use the figure arrangement buttons in the upper-right corner of the Sinks window to control the placement of the docked GUIs.

Set Simulink simulation mode to Normal to use mplay . MPlay does not work when you use Accelerating Simulink Models.

The following procedure shows you how to use MPlay to view a Simulink signal:

  1. Open a Simulink model. At the MATLAB command prompt, type

    vipmplaytutvipmplaytut

  2. Open an MPlay GUI by typing mplay on the MATLAB command line.

  3. Run the model.

  4. Select the signal line you want to view. For example, select the bus signal coming out of the Rotate block.

  5. On the MPlay GUI, click Connect to Simulink Signal GUI element,

    The video appears in the MPlay window.

  6. Change to floating-scope mode by clicking the persistent connect GUI element, button.

  7. Experiment with selecting different signals and viewing them in the MPlay window. You can also use multiple MPlay GUIs to display different Simulink signals.

    Note:   During code generation, the Simulink Coder™ does not generate code for the MPlay GUI.

MPlay

The following figure shows the MPlay GUI containing an image sequence.

The following sections provide descriptions of the MPlay GUI toolbar buttons and equivalent menu options.

 Toolbar Buttons

 Playback Toolbar — Workspace and File Sources

 Playback Toolbar — Simulink Sources

 Configuration

 Configuration Core Pane

 Configuration Sources Pane

 Configuration Visuals Pane

 Configuration Tools Pane

 Video Information

 Color Map for Intensity Video

 Frame Rate

 Saving the Settings of Multiple MPlay GUIs

 Message Log

 Status Bar

Was this topic helpful?