public override void ContinuousShot()
        {
            if (framegrabber == null || framegrabber.IsInitialized() == false)
            {
                return;
            }
            try
            {
                Command = Command.Video;

                IsContinuousShot = true;
                threadRunSignal.Set();
            }
            catch (Exception ex)
            {
                Util.WriteLog(this.GetType(), ex);
                Util.Notify("相机连续采集开始异常");
            }
        }
 public override HImage GrabImage(int delayMs)
 {
     if (framegrabber == null || framegrabber.IsInitialized() == false)
     {
         Util.Notify("图像采集设备打开异常");
         return(null);
     }
     GetImage();
     if (hPylonImage == null || hPylonImage.IsInitialized() == false)
     {
         reTryCount++;
         if (reTryCount < 3)
         {
             GrabImage(1);
         }
     }
     else
     {
         //帧率统计增加
         fps.IncreaseFrameNum();
     }
     reTryCount = 0;
     return(hPylonImage);
 }
Esempio n. 3
0
 public void CloseDevice()
 {
     if (frameGrabber != null)
     {
         if (frameGrabber.IsInitialized())
         {
             // if device performs image acquisition, then stop it
             if (GrabOn)
             {
                 StopGrabThread();
             }
             imCounter = 0;
             // close connection to IA device
             frameGrabber.Dispose();
             frameGrabber = null;
         }
     }
 }
        //

        /// <summary>
        /// 設定 HFramegrabber 參數
        /// </summary>
        private void setHFramegrabber()
        {
            if (_hFrameGrabber == null || !_hFrameGrabber.IsInitialized())
            {
                _hFrameGrabber = new HFramegrabber(_FGArgs.Name,
                                                   _FGArgs.HorizontalResolution,
                                                   _FGArgs.VerticalResolution,
                                                   _FGArgs.ImageWidth,
                                                   _FGArgs.ImageHeight,
                                                   _FGArgs.StartRow,
                                                   _FGArgs.StartColumn,
                                                   _FGArgs.Field,
                                                   new HTuple(_FGArgs.BitsPerChannel),
                                                   new HTuple(_FGArgs.ColorSpace),
                                                   new HTuple(_FGArgs.Generic),
                                                   _FGArgs.ExternalTrigger,
                                                   new HTuple(_FGArgs.CameraType),
                                                   new HTuple(_FGArgs.Device),
                                                   new HTuple(_FGArgs.Port),
                                                   new HTuple(_FGArgs.LineIn));
            }
        }