Main Content

displayImage

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

Add-On Required: This feature requires the MATLAB Support Package for Raspberry Pi Hardware add-on.

Description

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.

example

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 the 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 an image to be displayed. The supported values of orientation are 0, 90, 180, and 270.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

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

Version History

Introduced in R2016b