MATLAB Community

MATLAB, community & more

Acquire Images from Your Device Camera with MATLAB Mobile

Bringing Your Images and MATLAB Mobile Closer Together

In our last blog post, we started laying out our first phase of features that brought your images and MATLAB Mobile closer together. By enabling direct uploads to MATLAB Drive from your image gallery (and any application that has a ‘Share’ affordance), processing your images using MATLAB just became easier.

While this provided a way to get your images into the app, we still had no ways to support in-app workflows, especially for acquiring live images (as opposed to the ones already in your gallery). Don’t take my word for it, this was the first comment we got on that blog post:

In today’s blog, we would like to describe phase two of our camera integration: access to the device camera from within the app.

Acquire Images from the ‘Files’ Tab

One way to acquire images is to do so through our UI affordance. This can be accomplished through 4 simple steps, as illustrated below. To begin, select the ‘+’ affordance from the ‘Files’ tab and then select ‘Camera’.

When you tap on ‘Use Photo’ in step 4, your image is automatically saved to your MATLAB Drive (in the same folder as you were on in step 1). This post focuses on images, but as you can see in Step 3, you can acquire videos as well.

To use images from your Image Gallery, you need just a small tweak: in step 2, select ‘Photos’ and follow the UI navigation.

Acquire Images Using MATLAB Code

The workflow we described works if you want to take a photo and then plug it into your code. But what if you want the image acquisition to be a part of your code? We have you covered. The existing sensor functionality has been broadened to include access to your front- and rear-facing cameras. I can share a similar workflow diagram as the previous section… but a video is worth a thousand images (I think)! Here’s one created by my colleague, Carlos Sanchis, that covers this functionality:

In a nutshell: the ‘mobiledev’ object also allows you to connect to your device camera, and the SNAPSHOT command lets you acquire a single frame from your device camera.

Your Turn

How are you using MATLAB Mobile to acquire and process your images? Built any image classifiers yet? Let us know in the comments below.

 

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.