MATLAB Answers


connecting android with matlab i.e sending camera frames from android phone to the input image of matlab code.

Asked by Priyanshi Saxena on 16 Feb 2017
Latest activity Edited by Walter Roberson
on 18 May 2018
I am computing the distance of the detected object from the camera. For this I am using the code of measuring planar objects after camera calibration. Now instead of giving single image as input I want continuous camera frames from an android camera.


Hi Priyanshi, I am doing something similar for lane detection. I need continuous frames from android camera going to my matlab function block which has code for image processing. can u tell me how to get these frames to be processed continuously?
Hi Anuja,
You can use Simulink Support Package for Android Devices to convert a Simulink Model to Android Application. You can embed your MATLAB code in MATLAB function block and use this with other Android Blocks and create Android Applications with one Click.
To get camera frames use Android Camera Block and to display it on Phone screen, use Android Video Display Block. Connect camera Block output with input of MATLAB function block and input of Video Display block with output of MATLAB function block.
You can refer to the following example to get camera frames and display

Sign in to comment.

1 Answer

Answer by Tohru Kikawada on 21 Feb 2017

Try this.
1. Install "IPwebcam" app from the link and connect your Android to your host PC through WiFi.
2. Run the following code in MATLAB:
%%Acquire one frame
I = imread(''); % IP address should be modified
figure, imshow(I)


Show 1 older comment
No, it can be done with a local wired network or with WiFi; it can also work over cellular data, if you know the proper public IP address for your phone.
I keep getting Can't read URL error message. How could it be solved?
Beril Sirmacek: are you using a local wired network, or WiFi, or cellular data, or udsr, or zigbee, or bluetooth ?

Sign in to comment.