Display image on a raspberry pi
Show older comments
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
Prasanth Sunkara
on 29 Jan 2020
Hello Karen,
displayImage function when used in "simulation", ie, just click run button in MATLAB, displays the image on host PC.
It displays the image on raspberry pi only if the function is "deployed" to the board.
Just wanted to confirm if you have followed the steps as highlighted in the below doc page for generating and deploying code from matlab functions to raspberry pi.
Please see:
Additionally, you may want to explore the below example as well.
Thanks,
Prasanth
Karen Miller
on 29 Jan 2020
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
Answers (0)
Categories
Find more on Image and Video Processing 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!