Display image on a raspberry pi

13 views (last 30 days)
Karen Miller
Karen Miller on 29 Jan 2020
Commented: Prasanth Sunkara on 29 Jan 2020
Hello
I'm trying to use the 'displayimage' function seen here: https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/displayimage.html
I'm simply trying to display a .png image on a monitor connected to my raspberry pi. I have installed MATLAB Support Package for the Raspberry Pi as well as MATLAB coder. I am able to communicate with my pi, and my script runs just fine on MATLAB. The image pops up on in a MATLAB window but nothing shows up on the monitor attached to my pi. Here's my code:
function ImageDisplayTest()%#codegen directive
% Create a Raspberry Pi object
r=raspi();
img = imread('image.png');
displayImage(r,img);
end
What am I doing wrong? Am I misunderstanding the function of 'displayImage'?
Thank you!
  3 Comments
Karen Miller
Karen Miller on 29 Jan 2020
Hi Prasanth,
Thanks for your response. I am able to successfully deploy the 'BlinkLED' function from the first example to my pi. Unfortunately I don't have a camera to actually work through the second example.
When I try to use 'deploy' function with 'ImageDisplayTest()' I get the error seen in the attached picture. The image I'm trying to display is a png I got from the internet that's stored in the same folder as my script. In your second example 'displayImage' is used to display an image that comes from the Raspberry Pi camera. Could it be an issue that I'm trying to display a picture from the web rather than something the pi processsed?
MATLAB error.PNG
Prasanth Sunkara
Prasanth Sunkara on 29 Jan 2020
Hello Karen,
Thanks for the clarification.
There are a couple of observations from my side.
1) imread is not codegen supported.
2) Trying to display an image stored from your host pc on pi is not supported. That is why you are seeing those errors.
3) However if the image is orginated from your pi through webcam or cameraboard, it possible to display that live image using "displayImage". I see that currently you do not have any image acquisition devices.
If you could share more details on the motivation to display a static image from PC on Pi, probably we could explore some other options.
-Prasanth

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!