Ejemplo n.º 1
0
        /*****************************************************/

        /******************    相机操作     ******************/
        /// <summary>
        /// 打开相机
        /// </summary>
        public bool OpenCam()
        {
            try
            {
                camera.Open();
                imageWidth  = camera.Parameters[PLCamera.Width].GetValue();              // 获取图像宽
                imageHeight = camera.Parameters[PLCamera.Height].GetValue();             // 获取图像高
                GetMinMaxExposureTime();
                GetMinMaxGain();
                camera.StreamGrabber.ImageGrabbed += OnImageGrabbed;                      // 注册采集回调函数
                camera.ConnectionLost             += OnConnectionLost;
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }