cvUpdateMotionHistory() приватный Метод

private cvUpdateMotionHistory ( IntPtr silhouette, IntPtr mhi, double timestamp, double duration ) : void
silhouette IntPtr
mhi IntPtr
timestamp double
duration double
Результат void
Пример #1
0
        /// <summary>
        /// Update the motion history with the specific image and the specific timestamp
        /// </summary>
        /// <param name="foregroundMask">The foreground of the image to be added to history</param>
        /// <param name="timestamp">The time when the image is captured</param>
        public void Update(Image <Gray, Byte> foregroundMask, DateTime timestamp)
        {
            _lastTime = timestamp;
            TimeSpan ts = _lastTime.Subtract(_initTime);

            _foregroundMask = foregroundMask;
            if (_mhi == null)
            {
                _mhi = new Image <Gray, float>(foregroundMask.Size);
            }
            if (_mask == null)
            {
                _mask = foregroundMask.CopyBlank();
            }
            if (_orientation == null)
            {
                _orientation = new Image <Gray, float>(foregroundMask.Size);
            }

            CvInvoke.cvUpdateMotionHistory(foregroundMask.Ptr, _mhi, ts.TotalSeconds, _mhiDuration);
            double scale = 255.0 / _mhiDuration;

            CvInvoke.cvConvertScale(_mhi.Ptr, _mask.Ptr, scale, (_mhiDuration - ts.TotalSeconds) * scale);

            CvInvoke.cvCalcMotionGradient(_mhi.Ptr, _mask.Ptr, _orientation.Ptr, _maxTimeDelta, _minTimeDelta, 3);
        }