how to select two webcams using webcamlist if the cameras have the same name?
5 views (last 30 days)
Show older comments
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 Comments
Answers (3)
Image Analyst
on 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
0 Comments
Junaid Bashir
on 18 Aug 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
0 Comments
See Also
Categories
Find more on Matrox Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!