This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

imageDisplay

NVIDIA display object

Description

This object is used to display images on the NVIDIA® DRIVE or Jetson target desktop. To create this object, use the imageDisplay function. To interact with the web camera, use this object with the functions listed in Object Functions.

Creation

imageDisplay

Properties

expand all

This property is read-only.

Display name, returned as a constant.

Example: 'NVIDIA Display'

Data Types: char

Object Functions

imageDisplay image

Examples

collapse all

This example shows how to use imageDisplay to display images on the NVIDIA Jetson TX2 target. This example requires a USB camera connected to the NVIDIA target.

Create a live hardware connection from the MATLAB® software to the NVIDIA hardware by using the jetson function. To create a live hardware connection object, provide the host name or IP address, user name, and password of the target board. For example:

hwobj = jetson('192.168.1.15','ubuntu','ubuntu');

Create a MATLAB function liveCapture.m that connects to the webcam on a Jetson TX2 board and displays the image on the board. This function acts as the entry-point for code generation.

function liveCapture() %#codegen

% To enable code generation for hardware interfaces
hwobj = jetson;
w = webcam(hwobj,1,[1280 800]);
d = imageDisplay(hwobj);

for k = 1:2000
    % Capture the image from the webcam on hardware.
    img = snapshot(w);
    % Display image.
    image(d,img);
end

Create a GPU code configuration object for generating an executable. Use the coder.hardware function to create a configuration object for the Jetson platform and assign it to the Hardware property of the code configuration object cfg.

cfg = coder.gpuConfig('exe');
cfg.GenerateReport = true;
cfg.Hardware = coder.hardware('NVIDIA Jetson');
cfg.CustomInclude = fullfile('codegen','exe','liveCapture','examples');
cfg.CustomSource  = fullfile('codegen','exe','liveCapture','examples','main.cu');

The main.cu file is generated as part of code generation process. For this example, this file can be used without any modification.

To generate CUDA code, use the codegen command and pass the GPU code configuration object along with the liveCapture entry-point function. After the code generation takes place on the host, the generated files are copied over and built on the target.

codegen -config cfg liveCapture

Use the runApplication function to launch the executable on the TX2 board.

hwobj.runApplication('liveCapture');

Introduced in R2018b