Emgu.CV.MotionHistory.MotionInfo C# (CSharp) Метод

MotionInfo() публичный Метод

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
public MotionInfo ( System motionRectangle, double &angle, double &motionPixelCount ) : void
motionRectangle System The rectangle area of the motion
angle double The orientation of the motion
motionPixelCount double Number of motion pixels within silhoute ROI
Результат void
        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);
        }