필터 지우기
필터 지우기

How can I import 2 cameras at the same time?

조회 수: 1 (최근 30일)
Diec Thuan
Diec Thuan 2021년 9월 17일
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개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by