Exemplo n.º 1
0
        //public override bool ReadyForControl()
        //{
        //    return validTrackPoint;
        //}


        public override void Clean()
        {
            if (eyeLocator != null)
            {
                eyeLocator.Dispose();
                eyeLocator = null;
            }


            _flowflags = 0;
            if (this._curFrame != null)
            {
                CvImageWrapper.ReleaseImage(_curFrame);
            }
            if (_grey != null)
            {
                CvImageWrapper.ReleaseImage(_grey);
            }
            if (_prev_grey != null)
            {
                CvImageWrapper.ReleaseImage(_prev_grey);
            }
            if (_pyramid != null)
            {
                CvImageWrapper.ReleaseImage(_pyramid);
            }
            if (_prev_pyramid != null)
            {
                CvImageWrapper.ReleaseImage(_prev_pyramid);
            }
            if (_swap_temp != null)
            {
                CvImageWrapper.ReleaseImage(_swap_temp);
            }
        }
Exemplo n.º 2
0
        public override void Init(Size [] imageSizes)
        {
            Clean();

            int imageWidth  = imageSizes[0].Width;
            int imageHeight = imageSizes[0].Height;

            eyeLocator = new EyeLocator(3);
            eyeLocator.Reset();
            eyeLocatorTickCount = Environment.TickCount;

            _flowflags      |= CMSConstants.CV_LKFLOW_PYR_A_READY;
            validTrackPoint  = false;
            _pwinsz          = new CvSize(10, 10);
            _status          = new byte[1];
            imageSize.Width  = imageWidth;
            imageSize.Height = imageHeight;

            _last_track_points    = new CvPoint2D32f[1];
            _current_track_points = new CvPoint2D32f[1];

            _criteria = new CvTermCriteria(CMSConstants.CV_TERMCRIT_ITER | CMSConstants.CV_TERMCRIT_EPS, 20, 0.03);

            _curFrame = CvImageWrapper.CreateImage(imageSize, PIXEL_DEPTH, PIXEL_COLOR_CHANNELS);

            _grey = CvImageWrapper.CreateImage(imageSize, PIXEL_DEPTH, PIXEL_CHANNELS);

            _prev_grey = CvImageWrapper.CreateImage(imageSize, PIXEL_DEPTH, PIXEL_CHANNELS);

            _pyramid = CvImageWrapper.CreateImage(imageSize, PIXEL_DEPTH, PIXEL_CHANNELS);

            _prev_pyramid = CvImageWrapper.CreateImage(imageSize, PIXEL_DEPTH, PIXEL_CHANNELS);

            _swap_temp = CvImageWrapper.CreateImage(imageSize, PIXEL_DEPTH, PIXEL_CHANNELS);

            CMSTrackingSuiteAdapter.SendMessage(CMSConstants.PLEASE_CLICK_TF);
        }