Пример #1
0
        /// <summary>
        /// Attempts to find a camera by its name and device path.
        ///
        /// If both name and devicePath do not match, it will fall back to
        /// identifying the camera by name alone.
        /// </summary>
        /// <param name="name">The name of the camera</param>
        /// <param name="devicePath">The device path for the camera</param>
        /// <returns>A matching camera descriptor, or null if the camera is not found</returns>
        public static CameraDescriptor Find(string name, string devicePath)
        {
            var cameraDescriptors = CameraDescriptor.GetAll();
            var exactMatch        = cameraDescriptors.FirstOrDefault(c => c.Name == name && c.DevicePath == devicePath);
            var nameMatch         = cameraDescriptors.FirstOrDefault(c => c.Name == name);

            return(exactMatch ?? nameMatch);
        }
Пример #2
0
 public static List <CameraDescriptor> GetAll()
 {
     DsDevice[] cameraDevices = null;
     try
     {
         return(DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice).Select(d => CameraDescriptor.FromDsDevice(d)).ToList());
     }
     finally
     {
         DisposeDevices(cameraDevices);
     }
 }
Пример #3
0
 public static IList <CameraDescriptor> GetAll()
 {
     return(CameraDescriptor.GetAll());
 }