function [dev_PS3Eye,dev_Quickcam,dev_other]=CamAutodetect10() %% CAMERA AUTODETECT % Retrieve information about the cameras and output the device numbers % depending on type in dev_PS3Eye, dev_Quickcam, dev_other for easy later % assignment. % imaqhwinfo % lists the adaptors available % imaqhwinfo('winvideo') % lists the properties of the adaptor winvideo and shows the DeviceIDs % imaqhwinfo('winvideo',1) % lists the properties of device 1 winvid_info=imaqhwinfo('winvideo'); dev_nb=length(winvid_info.DeviceIDs); clear winvid_info if dev_nb>0 dev_PS3Eye=[]; dev_Quickcam=[]; dev_other=[]; for i=1:dev_nb dev_info=imaqhwinfo('winvideo',i); switch dev_info.DeviceName case 'PS3Eye Camera' dev_PS3Eye=[dev_PS3Eye,i]; case 'Logitech QuickCam Zoom' dev_Quickcam=[dev_Quickcam,i]; otherwise dev_other=[dev_other,i]; end clear dev_info i end %warning('Found and listed: %d PS3Eye',length(dev_PS3Eye)) disp(' ') disp('Cam Autodetect') disp(sprintf('Found and listed: %d PS3Eye',length(dev_PS3Eye))) disp(sprintf(' %d Logitech QuickCam Zoom',length(dev_Quickcam))) disp(sprintf(' %d other winvideo devices',length(dev_other))) else msgbox('No winvideo device was detected please make sure your camera is properly attached','Camera autodetect','error') end