Aquiring images from mobile camera is too slow

6 vues (au cours des 30 derniers jours)
Saitarun
Saitarun le 12 Mai 2025

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)

Réponses (2)

Matt J
Matt J le 12 Mai 2025
Modifié(e) : Matt J le 12 Mai 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 le 12 Mai 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.

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by