Video Display Video3D Capture navigation bar

Table of Contents

Video Simulation

Simulates an RGB camera.

Library

QUARC Targets/Multimedia

Description

Video Simulation

The Video Simulation block simulates an RGB camera for use by the Video blocks.

The block is able to simulate RGB camera sensors. Sensor data is fed to the input of the block and this sensor data is propagated to any clients which are using the simulated device.

The Video Simulation block listens on the URI specified in the dialog parameters. Any clients which connect to that URI will be able to use the simulated device. The Device identifier parameter provides the device identifier to use for the device.

To use the simulated RGD camera from the Video blocks, simply add the URI preceded by an '@' character to the Device identifier field of the Video Capture block. For example, instead of specifying a Device identifier of "0", enter an identifier of "0@tcpip://camhost:18001", where the Video Simulation block is running in a model on the machine "camhost" and serving on port 18001. Other than this small change, the simulated camera should be indistinguishable from an actual device.

The URI may be specified in the dialog parameters or via an input port. Which option is used is determined by the Source of URI parameter. When the URI is specified via an input, the input is typically driven by a Model Argument block, which allows a model argument to be used to assign the URI at runtime.

Warning

If the URI is specified via an input port, the Video Simulation block only samples the input when the model is first started. Hence, the URI cannot be changed while the model is running.

Helpful Hints

Firewall

Hint If remote clients will be communicating with the Video Simulation then be sure to configure the server machine's firewall to allow incoming access on the port being used.

Input Ports

rgb0

The RGB image for the simulated camera. RGB images are typically MATLAB RGB images (HxWx3) with a data type of uint8. The input image must be either a MATLAB RGB or MATLAB grayscale image. The image will be converted to whatever format, data type and resolution is required by the Video Capture block using the simulated camera.

Each port inherits its own sample time. The frame rate will also be converted to match the frame rate requested by the Video Capture block using the simulated camera.

uri

A string specifying the URI upon which to listen and service client connections. The string must be a null-terminated vector of characters represented as a vector of uint8 quantities. It may be variable-sized. This string is typically provided either directly or indirectly by a Model Argument block or String Constant block.

This input is only available if the Source of URI parameter is set to External input port. Refer to the documentation below on the Source of URI parameter for details.

Output Ports

rgb0?

An optional port that outputs whether the simulated camera is currently in use by a client. This port is only present if the Show if camera is in use option is checked.

err

The current error status of the simulation. The sample time of this port is specified in the Output sample time parameter.

Parameters and Dialog Box

Video Simulation

Source of URI

Indicates whether the URI should be determined from the dialog parameters or an input port. If this field is set to Specify via dialog (do not evaluate) then the URI is specified via the URI upon which to listen parameter. In this case, the URI is not evaluated as a MATLAB expression but is interpreted as a literal string. However, format specifiers are recognized. Refer to qc_perform_substitutions for a list of the format specifiers available.

Warning If format specifiers which change frequently, such as '%{time}' or '%{instance}', are used in the URI then the Video Simulation block cannot be placed in a referenced model, because the URI will change from the time the code is built to when the code is run. As a result, Simulink will insist that the code be rebuilt because block parameters in referenced models are inlined. Instead, specify the source of the URI as External input port and pass the URI from the top-level model. Use a String Constant block in the top-level model to generate the URI.

If this field is set to Specify via dialog (evaluate) then the URI is also specified via the URI upon which to listen parameter. However, in this case, the URI is evaluated as a MATLAB expression. This option is convenient for using a variable in the MATLAB workspace for the URI.

If this field is set to External input port then the URI upon which to listen parameter is ignored and an extra input port is provided which determines the URI.

URI on which to listen

Identifies the URI upon which to listen. This parameter identifies the communication protocol and associated parameters. For example, a URI of tcpip://localhost:18001 will cause the Video Simulation block to use TCP/IP and listen for connections on port 18001. Refer to Universal Resource Identifiers for more information about URIs and the communications protocols supported by QUARC.

Device identifier

This parameter provides the identifier of the device that will be simulated. This parameter is typically "0" unless multiple devices are being simulated or a mix of physical and simulated devices are being used.

Output sample time

The sample time of the err output of the block. This sample time does not affect the inputs of the block, which can each inherit their own sample time. A sample time of 0 indicates that the status output will be output continually. A positive sample time indicates that the output will have a discrete sample time.

To set the sample time to the fundamental sampling time of the model, use the qc_get_step_size function, which is a QUARC function that returns the fundamental sampling time of the model. The fundamental sampling time of the model is the sampling time entered in the Fixed step size field of the Solver pane of the Configuration parameters dialog.

Show if camera is in use

When this option is checked, an extra output will be provided that indicates whether the simulated camera is in use by a client. This information can be useful for reducing computation time when images are being generated by indicating which computations are actually necessary.

Active during normal simulation (tunable offline)

Indicates whether this block should simulate the device during normal simulation.

Widths (tunable offline)

The supported image resolution widths for the RGB stream. The image resolution and frame rate are HxW @ FPS where H, W and FPS are corresponding elements in the Widths, Heights and Maximum frame rates parameters.

Heights (tunable offline)

The supported image resolution heights for the RGB stream. The image resolution and frame rate are HxW @ FPS where H, W and FPS are corresponding elements in the Widths, Heights and Maximum frame rates parameters.

Maximum frame rates (tunable offline)

The supported maximum frame rates for each resolution for the RGB stream. The image resolution and frame rate are HxW @ FPS where H, W and FPS are corresponding elements in the Widths, Heights and Maximum frame rates parameters.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar