Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposte (3)

Antonio Santos
Antonio Santos il 15 Mar 2015
Thank you, but I already did it more simple using webcam(1) and webcam(2).

Image Analyst
Image Analyst il 14 Mar 2015
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 il 18 Ago 2017
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