Emgu.CV.CvInvoke.cvCalcGlobalOrientation C# (CSharp) Метод

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

private cvCalcGlobalOrientation ( IntPtr orientation, IntPtr mask, IntPtr mhi, double timestamp, double duration ) : double
orientation IntPtr
mask IntPtr
mhi IntPtr
timestamp double
duration double
Результат double
        public static extern double cvCalcGlobalOrientation(
                  IntPtr orientation,
                  IntPtr mask,
                  IntPtr mhi,
                  double timestamp,
                  double duration);

Usage Example

Пример #1
0
        /// <summary>
        /// Given a rectagle area of the motion, output the angle of the motion and the number of pixels that are considered to be motion pixel
        /// </summary>
        /// <param name="motionRectangle">The rectangle area of the motion</param>
        /// <param name="angle">The orientation of the motion</param>
        /// <param name="motionPixelCount">Number of motion pixels within silhoute ROI</param>
        public void MotionInfo(System.Drawing.Rectangle motionRectangle, out double angle, out double motionPixelCount)
        {
            TimeSpan ts = _lastTime.Subtract(_initTime);

            // select component ROI
            CvInvoke.cvSetImageROI(_foregroundMask, motionRectangle);
            CvInvoke.cvSetImageROI(_mhi, motionRectangle);
            CvInvoke.cvSetImageROI(_orientation, motionRectangle);
            CvInvoke.cvSetImageROI(_mask, motionRectangle);

            // calculate orientation
            angle = CvInvoke.cvCalcGlobalOrientation(_orientation.Ptr, _mask.Ptr, _mhi.Ptr, ts.TotalSeconds, _mhiDuration);
            angle = 360.0 - angle; // adjust for images with top-left origin

            // caculate number of points within silhoute ROI
            motionPixelCount = CvInvoke.cvNorm(_foregroundMask.Ptr, IntPtr.Zero, CvEnum.NORM_TYPE.CV_L1, IntPtr.Zero); // calculate number of points within silhouette ROI

            // reset the ROI
            CvInvoke.cvResetImageROI(_mhi);
            CvInvoke.cvResetImageROI(_orientation);
            CvInvoke.cvResetImageROI(_mask);
            CvInvoke.cvResetImageROI(_foregroundMask);
        }
CvInvoke