Vision Canny Edge Vision Color Threshold navigation bar

Table of Contents

Vision Capture Image

Beta

This block is currently a beta version. If you are using this block, we would appreciate any feedback at tech@quanser.com.

Captures images from a USB camera.

Library

QUARC Targets Beta/Image Processing/Open Source Computer Vision

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library_beta/Image Processing/Open Source Computer Vision')

Description

Vision Capture Image

The Vision Capture Image block initializes the USB camera attached to the target and grabs images at the specified sampling rate. Note that the Vision blocks use OpenCV to implement the vision algorithms. OpenCV is subject to the following license agreement.

The Vision blocks are currently only supported on the linux_verdex and linux_overo targets. Furthermore, a model containing a Vision block may only be built using the CodeSourcery Lite cross-compiler on the host PC. Use of the CodeSourcery Lite cross-compiler results in much faster compilations, but requires that the CodeSourcery Lite cross-compiler be installed. Refer to Installing CodeSourcery for details on how to install this freely available compiler.

The default compiler when building for the gumstix targets is an LLVM-GCC based cross-compiler. To change the compiler to use CodeSourcery Lite, open the Configuration Parameters dialog by selecting Configuration Parameters from the Simulation menu of the model. Then select the Code Generation/QUARC item in the treeview. Choose either the LLVM-GCC based on CodeSourcery Lite or CodeSourcery Lite option for the Compiler field.

To use CodeSourcery Lite, the Language setting must also be changed for the model. Go to the Code Generation pane in the Configuration Parameters dialog and change the Language setting to C++. The C++ language is required because OpenCV is a C++ library.

Warning The Vision Capture Image block supports only one USB camera attached to the target.

Limitations

Platform Support

Warning The Vision blocks are currently only supported on the linux_verdex and linux_overo targets.

Compiler Support

Warning Since OpenCV is a C++ library, the LLVM-GCC based cross-compilers cannot be used with the Vision blocks because they only support the C language. Instead, select either CodeSourcery Lite or Native GCC (compiles on target) for the Compiler setting on the Code Generation/QUARC pane of the Configuration Parameters dialog for the model. Note that use of the CodeSourcery Lite compiler requires that it be installed. Refer to Installing CodeSourcery for details on how to install this freely available compiler.

Language Support

Warning Since OpenCV is a C++ library, the Language setting on the Code Generation/General tab of the Configuration Parameters for the model must be set to C++ when using the CodeSourcery cross-compiler. Otherwise the model will fail to build during the linking stage.

Input Ports

This block has no input ports.

Output Ports

image

A handle to an output image either in a matrix form or in an OpenCV (Open Source Computer Vision) IplImage structure. It uses 24 bit BGR (Blue-Green-Red) format to store image data.

new

A flag that indicates availability of a new image.

err

The error signal returns a negative value in case of failure to initialize and grab an image from the camera.

Parameters and Dialog Box

Vision Capture Image

Image dimension

The options for source image diemnsion (width x height) are: 800 x 600, 640 x 480, 320 x 240, and 160 x 120.

Get output image as a matrix

The output image is an unsigned 8-bit matrix when this flag is selected.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time. A sample time of -1 indicates that the block inherits its sample time.

Warning Use 0.1 or higher for image size 320 x 240 and 160 x 120, and 0.5 or higher for 800 x 600 and 640 x 480.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

No

No

Not supported.

QUARC Win64 Target

No

No

Not supported.

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

No

No

Not supported.

Rapid Simulation (RSIM) Target

No

No

Not supported.

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.

 

navigation bar