How can I import 2 cameras at the same time?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hey guys, i have 2 cameras including laptop cam and webcam.
But when I code in Command Window, that result just show 1 device while I was open 2 cam.
So, how can i code to show 2 cams at the same time.
My code in editor:
% show webcam
cam1 = videoinput('winvideo', 1,'MJPG_640x480');
% only capture one frame per trigger, we are not recording a video
cam1.FramesPerTrigger = 1;
% output would image in RGB color space
cam1.ReturnedColorspace = 'rgb';
% tell matlab to start the webcam on user request, not automatically
triggerconfig(cam1, 'manual');
% we need this to know the image height and width
vidRes1 = get(cam1, 'VideoResolution');
% image width
imWidth1 = vidRes1(1);
% image height
imHeight1 = vidRes1(2);
% number of bands of our image (should be 3 because it's RGB)
nBands1 = get(cam1, 'NumberOfBands');
% create an empty image container and show it on axPreview
hImage1 = image(zeros(imHeight1, imWidth1, nBands1), 'parent', handles.axes3);
% begin the webcam preview
preview(cam1, hImage1);
handles.vid1=cam1;
guidata(hObject, handles);
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su MATLAB Support Package for IP Cameras in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!