Пример #1
0
        public Camera(ICogAcqFifo acqFifo)
        {
            if (acqFifo == null)
            {
                return;
            }
            cogAcqFifo = acqFifo;

            cogROIParams = cogAcqFifo.OwnedROIParams;

            cogContrast   = cogAcqFifo.OwnedContrastParams;
            cogExposure   = cogAcqFifo.OwnedExposureParams;
            cogBrightness = cogAcqFifo.OwnedBrightnessParams;
            cogAcqTrigger = cogAcqFifo.OwnedTriggerParams;

            GrabTime = DateTime.MinValue;
        }
        public override void InitializeFrameGrabber()
        {
            if (_frameGrabber != null)
            {
                if (string.IsNullOrEmpty(VideoFormat))
                {
                    return;
                }
                // Confirm video format
                lock (_lockAcqFifo)
                {
                    try
                    {
                        if (_cogAcqFifo != null)
                        {
                            _cogAcqFifo.Flush();
                        }

                        bool b16FGrey      = _frameGrabber.GetSupportsPixelFormat(CogAcqFifoPixelFormatConstants.Format16Grey);
                        bool b32RGB        = _frameGrabber.GetSupportsPixelFormat(CogAcqFifoPixelFormatConstants.Format32RGB);
                        bool bFormat3Plane = _frameGrabber.GetSupportsPixelFormat(CogAcqFifoPixelFormatConstants.Format3Plane);
                        bool bFormat565RGB = _frameGrabber.GetSupportsPixelFormat(CogAcqFifoPixelFormatConstants.Format565RGB);

                        _cogAcqFifo = _frameGrabber.CreateAcqFifo(VideoFormat, CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);
                        //_cogAcqFifo.OutputPixelFormat = CogImagePixelFormatConstants.PlanarRGB8;
                        _cogAcqFifo.Prepare();
                        _cogAcqFifo.Flush();
                        ICogAcqTrigger mTrigger = _cogAcqFifo.OwnedTriggerParams;
                        if (mTrigger != null && ExternalTrigger)
                        {
                            mTrigger.TriggerModel     = CogAcqTriggerModelConstants.Auto;
                            mTrigger.TriggerLowToHigh = false;
                            _cogAcqFifo.Complete     += _delCogCompleteHandler;
                        }
                    }
                    catch (Exception ex)
                    {
                        U.LogPopup(ex.Message);
                    }
                }
                OnChangedTriggerMode(TriggerMode);
            }
        }
Пример #3
0
        public PhotoModeUI(CogAcqFifoTool acqFifoTool1, MyDisPlayUI myDisPlayUI1, CogAcqFifoTool acqFifoTool2, MyDisPlayUI myDisPlayUI2, string name1, string name2)
        {
            InitializeComponent();

            rdoAutoRun1.Checked = true;
            rdoAutoRun2.Checked = true;

            Camera1ImageQueue = new Queue <CogImage8Grey>();
            Camera2ImageQueue = new Queue <CogImage8Grey>();
            AcqFifoTool1      = acqFifoTool1;
            AcqFifoTool2      = acqFifoTool2;
            if (acqFifoTool1.Operator != null)
            {
                AcqTriggerMode1 = acqFifoTool1.Operator.OwnedTriggerParams;
            }
            if (acqFifoTool2.Operator != null)
            {
                AcqTriggerMode2 = acqFifoTool2.Operator.OwnedTriggerParams;
            }
            MyDisPlayUI1 = myDisPlayUI1;
            MyDisPlayUI2 = myDisPlayUI2;
            ReLoadLanguage(name1, name2);
        }
Пример #4
0
        // 2014.12.16
        //public void InitTrigger(IntPtr hMain, int nPoint, ADisplay aDisplay, bool bUseTirgger)
        // 2016.02.22 by kdi. public void InitTrigger(IntPtr hMain, int nPoint)
        public void InitTrigger(IntPtr hMain, int nPoint, bool bShowMessage)
        {
            string strMsg = "";

            m_hMain  = hMain;
            m_nPoint = nPoint;
            // 2014.12.16
            //m_aDisplayTrigger = aDisplay;

            try
            {
                // 1. Assign the CogAcqFifo CogAcqTrigger
                // 2014.12.15
                //ICogAcqTrigger m_cogAcqTrigger = m_cogAcqFifoTool.Operator.OwnedTriggerParams;
                m_cogAcqTrigger = m_cogAcqFifoTool.Operator.OwnedTriggerParams;

                if (m_cogAcqTrigger == null)
                {
                    // 2016.02.22 by kdi. MessageBox.Show("This board type does not support trigger mode !");

                    strMsg     = string.Format("InitTrigger: This board type does not support trigger mode !", ".AcqFifo.err.txt");
                    m_strError = strMsg;
                    AVisionProBuild.WriteLogFile(strMsg, ".AcqFifo.err.txt");

                    if (bShowMessage == true)
                    {
                        MessageBox.Show(strMsg);
                    }

                    return;
                }

                SetTrigger(false);
            }
            catch (CogException ex)
            {
                // 2016.02.22 by kdi. MessageBox.Show(ex.Message);

                strMsg     = string.Format("InitTrigger: CogException. {0}", ex.Message);
                m_strError = strMsg;
                AVisionProBuild.WriteLogFile(strMsg, ".AcqFifo.err.txt");

                if (bShowMessage == true)
                {
                    MessageBox.Show(strMsg);
                }
            }
            catch (System.Exception ex)
            {
                // 2016.02.22 by kdi. MessageBox.Show(ex.Message);

                strMsg     = string.Format("InitTrigger: Exception. {0}", ex.Message);
                m_strError = strMsg;
                AVisionProBuild.WriteLogFile(strMsg, ".AcqFifo.err.txt");

                if (bShowMessage == true)
                {
                    MessageBox.Show(strMsg);
                }
            }
        }