how to select two webcams using webcamlist if the cameras have the same name?

7 ビュー (過去 30 日間)
Antonio Santos
Antonio Santos 2015 年 3 月 14 日
回答済み: Junaid Bashir 2017 年 8 月 18 日
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

回答 (3 件)

Antonio Santos
Antonio Santos 2015 年 3 月 15 日
Thank you, but I already did it more simple using webcam(1) and webcam(2).

Image Analyst
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

Junaid  Bashir
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

Community Treasure Hunt

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

Start Hunting!

Translated by