Aquiring images from mobile camera is too slow
조회 수: 6 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
답변 (2개)
Matt J
2025년 5월 12일
편집: Matt J
2025년 5월 12일
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.
댓글 수: 0
Walter Roberson
2025년 5월 12일
Possibly. You might be able to use the IP Camera support
Android: https://www.mathworks.com/help/matlab/supportpkg/acquire-images-from-an-ip-camera-android-app.html
(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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!