Emgu.CV.CvInvoke.cvCalcMotionGradient C# (CSharp) Method

cvCalcMotionGradient() private method

private cvCalcMotionGradient ( IntPtr mhi, IntPtr mask, IntPtr orientation, double delta1, double delta2, int apertureSize ) : void
mhi IntPtr
mask IntPtr
orientation IntPtr
delta1 double
delta2 double
apertureSize int
return void
        public static extern void cvCalcMotionGradient(
          IntPtr mhi,
          IntPtr mask,
          IntPtr orientation,
          double delta1,
          double delta2,
          int apertureSize);

Usage Example

コード例 #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);
        }
CvInvoke