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.

displayImage

Display an image on the Raspberry Pi hardware or on the LED Matrix of SenseHAT

Syntax

displayImage (mypi,img) %Raspberry Pi
displayImage (mypi,img,Name,Value) %Raspberry Pi
displayImage (mysh,img) %SenseHAT
displayImage (mysh,img,orientation) %SenseHAT

Description

example

For Raspberry Pi: displayImage (mypi,img) %Raspberry Pi displays the specified image on the Raspberry Pi™ hardware. During simulation, this function displays the image on the computer.

example

For Raspberry Pi: displayImage (mypi,img,Name,Value) %Raspberry Pi displays the specified image with a window title on the Raspberry Pi hardware. During simulation, this function displays the image on the computer.

example

For SenseHAT: displayImage (mysh,img) %SenseHAT displays an image of 8 * 8 * 3 dimension on the LED Matrix of SenseHAT.

example

For SenseHAT: displayImage (mysh,img,orientation) %SenseHAT displays an image of 8 * 8 * 3 dimension on the LED Matrix of SenseHAT with the specified orientation. The supported values for orientation are: 0, 90, 180, and 270 degrees.

The following image shows the orientations of the LED Matrix.

Examples

collapse all

Display image on the Raspberry Pi hardware

img=imread('edge_detection.png');
displayImage(mypi,img); 

Displays an image on the hardware.

Display image with the specified title on the image window of the Raspberry Pi hardware

img=imread('edge_detection.png');
displayImage(mypi,img,'Title','Edge Detection'); 

Displays an image with the title, Edge Detection, on the image window of the hardware.

Display image on the LED Matrix

img=imread('senseHAT_demo.png');
displayImage(mysh,img); 

Displays an image of 8 * 8 * 3 dimension on the LED Matrix.

Display image with orientation

img = imread('senseHAT_demo.png');
displayImage(mysh,img,90); 

Displays an image of 8 * 8 * 3 dimension on the LED Matrix with the specified orientation of 90 degrees.

Input Arguments

collapse all

Connection to a specific Raspberry Pi hardware board, specified as a raspi object.

Connection to a SenseHAT board, specified as a sensehat object.

The image object for display on the LED Matrix of 8 x 8 x 3 dimension or on the Raspberry Pi hardware.

The orientation to be applied for the image to be displayed. The supported values of orientation are 0, 90, 180, and 270.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: displayImage(mypi,inputImage,'Title','Webcam Output')

Title of the image window displayed on the Raspberry Pi hardware, specified as the comma-separated pair consisting of 'Title' and the title of the image window.

Example: displayImage(mypi,img,'Title','Edge Detection');

Data Types: string

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2016b