How do I disply an image for example a .jpg in an android app using simulink?

2 ビュー (過去 30 日間)
Matthew Bigelow
Matthew Bigelow 2018 年 10 月 25 日
回答済み: Matthew Bigelow 2018 年 10 月 30 日
Hi I want to display an image in an android app designed using the simulink support package to enhance the visual appearance. Do I just download a jpg to the workspace convert extract the RGB channels and then use attach it to the video display block for android? How do I bring the image into the model? Im using 2018b.

採用された回答

Sruthi Yenugula
Sruthi Yenugula 2018 年 10 月 26 日
Hi Matthew,
Can you let us know, where exactly you want to show that image in the generated app.(app Tab or Info Tap etc.)
Q ) Do I just download a jpg to the workspace convert extract the RGB channels and then use attach it to the video display block for android? How do I bring the image into the model?
A) Check this example
https://www.mathworks.com/help/supportpkg/android/ref/color-detection.html
In this example, task 1 shows how to read from image and extracts R, G, B. Instead of using color detection sub system, directly connect to Video display block. This will show the image on the app screen.
%Reading image
RGB_image = imread('peppers.png') Execute the above command in MATLAB before building the model or add the command in Simulink model :
File -> Model Porperties -> Callbacks ->InitFcn
In constant block, use RGB_image(:,:,1)' to get red, RGB_image(:,:,2)' to get green, RGB_image(:,:,3)' to get blue

その他の回答 (1 件)

Matthew Bigelow
Matthew Bigelow 2018 年 10 月 30 日
Hello Sruthi I want it to show on the app tab. I will try your suggestion and get back to you if I have problems. Thankyou

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by