MATLAB Answers

0

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 at 15:45

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.

  2 Comments

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 which uses MATLAB function block https://www.mathworks.com/help/supportpkg/android/examples/control-lego-mindstorms-ev3-robot-using-android-device.html

You can refer to the following example to get camera frames and display https://www.mathworks.com/help/supportpkg/android/examples/color-replacement.html

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.

https://play.google.com/store/apps/details?id=com.pas.webcam

2. Run the following code in MATLAB:

%% Acquire one frame
I = imread('http://192.168.2.100:8080/photo.jpg'); % IP address should be modified
figure, imshow(I)

  4 Comments

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.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today