コード例 #1
0
 public SImageProcessor(SySal.Imaging.IImageProcessor iproc)
 {
     IProc   = iproc;
     Enabled = false;
 }
コード例 #2
0
        private void CameraDisplayRefresh()
        {
            System.Threading.WaitHandle[] waiths = new System.Threading.WaitHandle[] { m_TerminateEvent, m_DisplayMutex };
            int waitresult = -1;

            while ((waitresult = System.Threading.WaitHandle.WaitAny(waiths)) == 1)
            {
                try
                {
                    try
                    {
                        SySal.Imaging.IImageProcessor iproc = null;
                        foreach (SImageProcessor ipr in iGPU)
                        {
                            if (ipr.IProc != null)
                            {
                                iproc = ipr.IProc;
                                break;
                            }
                        }
                        if (m_CameraDisplay.ImageProcessor != iproc)
                        {
                            m_CameraDisplay.ImageProcessor = iproc;
                        }
                    }
                    catch (Exception x)
                    {
                        Log(DisplayLog, x.ToString());
                    }
                    object seq = null;
                    SySal.Imaging.LinearMemoryImage im = null;
                    try
                    {
                        System.DateTime start = System.DateTime.Now;
                        seq = iGrab.GrabSequence();
                        im  = (SySal.Imaging.LinearMemoryImage)iGrab.MapSequenceToSingleImage(seq);
                        System.DateTime end1 = System.DateTime.Now;
                        m_CameraDisplay.ImageShown = im;
                        System.DateTime end2 = System.DateTime.Now;
                        iGrab.ClearMappedImage(im);
                        System.DateTime end3 = System.DateTime.Now;
                        iGrab.ClearGrabSequence(seq);
                        seq = null;
                        System.DateTime end4 = System.DateTime.Now;
                        //Log(DisplayLog, (end1 - start).TotalMilliseconds.ToString() + " " + (end2 - end1).TotalMilliseconds.ToString() + " " + (end3 - end2).TotalMilliseconds.ToString() + " " + (end4 - end3).TotalMilliseconds.ToString());
                        im = null;
                    }
                    catch (Exception x)
                    {
                        Log(DisplayLog, x.ToString());
                    }
                    finally
                    {
                        if (im != null)
                        {
                            try
                            {
                                iGrab.ClearMappedImage(im);
                                im = null;
                            }
                            catch (Exception x)
                            {
                                Log(DisplayLog, x.ToString());
                            }
                        }
                        if (seq != null)
                        {
                            try
                            {
                                iGrab.ClearGrabSequence(seq);
                                seq = null;
                            }
                            catch (Exception x)
                            {
                                Log(DisplayLog, x.ToString());
                            }
                        }
                    }
                }
                catch (Exception xc)
                {
                    Log("OnCameraDisplayTimer_Elapsed", xc.ToString());
                }
            }