Why actual resolution of the image from Simulink Android camera is different from the resolution set on the camera block ?

3 次查看(过去 30 天)
Hi,
I am working on a project to acquire Android camera image from an Android app developed with Simulink support package from Android devices. I am using Samsung galaxy S10, which was supported for the development. I set the resolution in the camera block as 1920x1080. After that using .MAT file logging, I have imported the recorded camera frames to MATLAB workspace. The actual resolution in the image seems to be 640x480. As you can see in the attached image, the overall frame is 1920x1080 but the acutal camera output is ~640x480. For reference I am also attaching the model. Please let me know how to solve this issue.
%% Code to access .MAT files logged from the Simulink phone application
%% Copy the MAT-files from the Android device into MATLAB
% results = displays the status of copy operation
% matfiles = displays the list of the MAT-files copied to MATLAB
% input the Simulink model name "getFiles"
[result, matfiles] = codertarget.android.internal.getFiles('octSignalLogging')
%% Load the variables in the MAT-file into MATLAB workspace variables
% load the specific .MAT files
OCTSignal = load('octSignalLogging_2_1.mat');
OCTSignal = OCTSignal.rt_interferogram;
OCTSignal = mean(OCTSignal,3);
imshow(uint8(OCTSignal));

回答(1 个)

Sutanu Maiti
Sutanu Maiti 2022-5-17
This has been noticed and we have found that this behavior is due to Android itself. The camera frame we receive is equal to the that of its preview size on screen. Even though we request a particular frame size, if the previewed size on the screen is lesser than that, then only the preview size is returned. And this restriction is applied from OS (Operating System) to increase security and privacy.
One workaround could be to increase the camera size on the application. You may import the generated code into android studio and modify that to maximize the camera preview size.

类别

Help CenterFile Exchange 中查找有关 Android Devices 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by