示例#1
0
        private void LiveDisplayGrab()
        {
            while (isRealDisplay)
            {
                try
                {
                    int     ticketCount    = System.Environment.TickCount;
                    HObject ho_OutputImage = null;

                    ho_OutputImage = SafeAsyncGrabImage();
                    HalImage8Grey        image         = new HalImage8Grey(ref ho_OutputImage);
                    int                  triggerNumber = System.Environment.TickCount;
                    HalCompleteEventArgs eventArgs     = new HalCompleteEventArgs(ticketCount, triggerNumber, image);
                    Complete?.Invoke(this, eventArgs);

                    // Console.WriteLine("Grab one Image");
                }
                catch (Exception ex)
                {
                    isRealDisplay = false;

                    Console.WriteLine(ex.ToString());
                    //throw ex;
                }
            }
        }
示例#2
0
        /// <summary>
        /// 运行取像
        /// </summary>
        public void Run()
        {
            if (isRealDisplay)
            {
                return;
            }
            int     ticketCount = System.Environment.TickCount;
            HObject ho_OutputImage;

            HOperatorSet.GenEmptyObj(out ho_OutputImage);
            if (asyncGrab)
            {
                ho_OutputImage = SafeAsyncGrabImage();
            }
            else
            {
                ho_OutputImage = SafeSyncGrabImage();
            }
            int triggerNumber = System.Environment.TickCount;

            m_outputImage = new HalImage8Grey(ref ho_OutputImage);
            HalCompleteEventArgs eventArgs = new HalCompleteEventArgs(ticketCount, triggerNumber, m_outputImage);

            if (Complete != null)
            {
                Complete(this, eventArgs);
            }
        }