Example #1
0
 public IHardwareProxy LoadFromHardwareId(string hardwareId)
 {
     try
     {
         string[]     part    = hardwareId.Split("|".ToCharArray());
         DSCameraInfo camInfo = GetCamInfo(part[0]);
         Resolution   res     = GetResolution(camInfo, part[1]);
         return(new DSCameraProxy(camInfo, res, null));
     }
     catch { return(null); }
 }
Example #2
0
 public static List<DSCameraInfo> GetAvailableCamera()
 {
     List<DSCameraInfo> ret = new List<DSCameraInfo>();
     DsDevice[] capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
     for (int i = 0; i < capDevices.Length; i++)
     {
         DSCameraInfo cam = new DSCameraInfo(i, capDevices[i]);
         ret.Add(cam);
     }
     return ret;
 }
Example #3
0
        public static List <DSCameraInfo> GetAvailableCamera()
        {
            List <DSCameraInfo> ret = new List <DSCameraInfo>();

            DsDevice[] capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
            for (int i = 0; i < capDevices.Length; i++)
            {
                DSCameraInfo cam = new DSCameraInfo(i, capDevices[i]);
                ret.Add(cam);
            }
            return(ret);
        }
Example #4
0
        Resolution GetResolution(DSCameraInfo camInfo, string resolutionAsString)
        {
            List <Resolution> list = camInfo.GetAvailableResolution();

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].ToString() == resolutionAsString)
                {
                    return(list[i]);
                }
            }
            return(null);
        }
Example #5
0
        DSCameraInfo GetCamInfo(string uniqueId)
        {
            List <DSCameraInfo> camInfos = DSCameraInfo.GetAvailableCamera();

            for (int i = 0; i < camInfos.Count; i++)
            {
                if (camInfos[i].UniqueId == uniqueId)
                {
                    return(camInfos[i]);
                }
            }
            return(null);
        }
Example #6
0
        // Zero based device index and device params and output window
        public DSCameraProxy(DSCameraInfo caminfo, Resolution resolution, Control hControl)
        {
            _Caminfo    = caminfo;
            _Resolution = resolution;
            int   iDeviceNum = caminfo.Index;
            int   iWidth     = resolution.Width;
            int   iHeight    = resolution.Height;
            short iBPP       = resolution.BitCount;

            DsDevice [] capDevices;

            // Get the collection of video devices
            capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

            if (iDeviceNum + 1 > capDevices.Length)
            {
                throw new Exception("No video capture devices found at that index!");
            }

            try
            {
                // Set up the capture graph
                SetupGraph(capDevices[iDeviceNum], iWidth, iHeight, iBPP, hControl);

                // tell the callback to ignore new images
                m_PictureReady = new ManualResetEvent(false);


                int exposure = Settings.Get <Settings>().Read(Settings.CAMERA, CameraControlProperty.Exposure.ToString(), int.MaxValue);
                this.SetControlProperty(CameraControlProperty.Exposure, exposure);
            }
            catch
            {
                Dispose();
                throw;
            }
        }