Beispiel #1
0
 public void Dispose()
 {
     if (camera.IsConnected())
     {
         camera.StopCapture();
         camera.Disconnect();
     }
 }
 private void Window_Closing(object sender, EventArgs e)
 {
     m_continue = false;
     try
     {
         m_Done.WaitOne(100);
         m_cam.StopCapture();
         m_cam.Disconnect();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
     finally
     {
         Application.Current.Shutdown();
     }
 }
Beispiel #3
0
        private void stopCaptureLoop()
        {
            m_grabImages = false;

            try
            {
                m_camera.StopCapture();
            }
            catch (FC2Exception ex)
            {
                Debug.WriteLine("Failed to stop camera: " + ex.Message);
            }
            catch (NullReferenceException)
            {
                Debug.WriteLine("Camera is null");
            }

            toolStripButtonStart.Enabled = true;
            toolStripButtonStop.Enabled  = false;
        }
Beispiel #4
0
        /// <summary>
        /// 关闭相机,停止抓取相机并断开相机连接
        /// </summary>
        public override bool CloseCamera()
        {
            try
            {
#if (SDK)
                if (g_BaseParCamera.BlUsingTrigger)
                {
                    SetSoftTrriger(false);//关闭软触发
                }
                g_ManagedCameraBase.StopCapture();
                g_ManagedCameraBase.Disconnect();
#endif
                return(true);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
                return(false);
            }
        }
Beispiel #5
0
        public Bitmap GrabImage()
        {
            try
            {
                if (m_camera.IsConnected())
                {
                    m_camera.StartCapture();
                    m_camera.RetrieveBuffer(m_rawImage);
                    m_rawImage.Convert(PixelFormat.PixelFormatBgr, m_processedImage);
                    m_camera.StopCapture();
                    imageSize.Width  = (int)m_rawImage.cols;
                    imageSize.Height = (int)m_rawImage.rows;
                    timeStamp        = m_rawImage.timeStamp;
                }
            }
            catch (FC2Exception ex)
            {
                Debug.WriteLine("Error: " + ex.Message);
            }

            return(m_processedImage.bitmap);
        }