Aquiring images from mobile camera is too slow

8 views (last 30 days)

Hi, I am trying to aquire images from my mobile phone's camera using Matlab mobile. Is there any way I can get images from the camera faster ?

 clc;clear;close all;
%% Connect to device
m = mobiledev;
%% Create camera
cam = camera(m,'back');
cam.Resolution = '640x480';
%% Get images
for i=1:1000
    [img,t] = snapshot(cam,"immediate");
    imshow(img)
    t
end
%% Delete object
delete(m)

Answers (2)

Matt J
Matt J on 12 May 2025
Edited: Matt J on 12 May 2025
Yes, you can postpone the image display until after the acquisition.
N=1000;
[img,t]=deal(cell(1,N));
for i=1:N
[img{i},t{i}] = snapshot(cam,"immediate");
end
for j=1:N
imshow(img{j}); drawnow
t{j}
end
Or, display the images at less frequent intervals, instead of at every i.

Walter Roberson
Walter Roberson on 12 May 2025
Possibly. You might be able to use the IP Camera support
(there does not appear to be an IOS specific page)
You can probably expect that preview() would be faster than snapshot().
However, if you need to capture frames then you end up using snapshot() anyhow even for IP cameras. The question then becomes whether using snapshot() through mobiledev() is faster or slower than using snapshot() through ipcam(). I do not know the answer to that... I would tend to suspect that ipcam() would be faster, but I do not know.

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!