how to select two webcams using webcamlist if the cameras have the same name?
조회 수: 1 (최근 30일)
이전 댓글 표시
I got two identical cameras, when I use webcamlist, the names for both two are the same, so, how can I select one of them? or both? is for stereo vision
댓글 수: 0
답변 (3개)
Image Analyst
2015년 3월 14일
They should have a different device ID. Look at this snippet where I find my Lumenera camera and get the device ID. I have only 1 though, but you will probably have 2.
adaptorNames = hardwareInfo.InstalledAdaptors
% Might look something like:
% InstalledAdaptors: {'dcam' 'gentl' 'gige' 'lumeneraimaqw64' 'matrox' 'winvideo'}
matches = strfind(adaptorNames, 'lumenera');
% Find out which index is the Lumenera Camera.
LumeneraIndex = find(~cellfun(@isempty, matches))
if isempty(LumeneraIndex)
% No camera is attached.
UserSettings.useSamplePictures = true;
errorMessage = sprintf('Error in function InitializeVideoCamera().\nMATLAB does not see the Lumenera video camera adapter software.');
ME = MException('CameraDetect:LumeneraSoftwareMissing', errorMessage);
throw(ME);
end
% If we get to here, MATLAB has the lumenera adapter installed.
theLumeneraAdaptor = adaptorNames{LumeneraIndex}
hardwareInfo2 = imaqhwinfo(theLumeneraAdaptor)
devInfo = hardwareInfo2.DeviceInfo
if size(devInfo, 2) == 0
% No camera is attached.
UserSettings.useSamplePictures = true;
errorMessage = sprintf('Error in function InitializeVideoCamera().\nWindows does not see a Lumenera video camera attached.\nIf you think there is, then use Device Manager to check\nthe "Imaging Devices" category.');
ME = MException('CameraDetect:NoLumeneraCameraPresent', errorMessage);
% Launch Device Manager. Use trailing ampersand, otherwise program does not continue until user closes Device Manager.
system('C:\Windows\System32\devmgmt.msc &')
throw(ME);
end
devName = devInfo.DeviceName
devID = devInfo.DeviceID
supportedFormats = devInfo.SupportedFormats
댓글 수: 0
Junaid Bashir
2017년 8월 18일
hello friends !! can anyone post the code for using two webcams for stereo vision in matlab. i have connected both cams and i have already got vision for both the cameras seprately but i don't know how to combine both visions to get the stereo vision
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!