How to plot plot Intensity vs pixel values using simulink xy graph?

Hi,
I am using Simulink support package for Android to design an application. I need to get the grayscale intensity values from the live camera and plot it against the pixel count. I have used a MATLAB function to get grayscale intensity with R,G,B matrix from the camera. I need to plot the column vector grayIntensity (size: 1x720 due to the camera resolution) against the vector pixel_count. Is there any way to use the XY graph block to do this?
function [r_out, g_out, b_out,grayIntensity, pixel_count] = Grayscale(r_in,g_in, b_in)
%#codegen
%%Get RGB Color
r = r_in;
g = g_in;
b = b_in;
gray= (r+g+b)/3;
G = sum(gray)*0.004;
grayIntensity = G';
pixel_count=0:size(grayIntensity);
%% RGB output
r_out = uint8(r);
g_out = uint8(g);
b_out = uint8(b);

답변 (1개)

Sutanu Maiti
Sutanu Maiti 2020년 3월 24일

1 개 추천

XY graph is not there for Android Deplpooyment.
But you can use Arrayplot block on Android device.
Please have a look at below example that plots signal on android screen:

댓글 수: 1

Hi Sutanu,
I have tried using array plot but the problem is it is not plotting all the values in the x-axis. The camera resolution is 1920x1080 but when I tried to plot the grayIntensity vs pixel_count then it is showing some random values. Please find attached the screenshots. I have also tried to setup the axes correctly in the array plot. Checked both with custom [] and sample increment. Still getting the error, the x-axis should show the values from 0:1080 but it is very different. I don't know why it is missing values in both the sides.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Modeling에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2020년 3월 23일

댓글:

2020년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by