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

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

private cvCalcOpticalFlowPyrLK ( IntPtr prev, IntPtr curr, IntPtr prevPyr, IntPtr currPyr, [ prevFeatures, [ currFeatures, int count, Size winSize, int level, Byte status, float trackError, MCvTermCriteria criteria, CvEnum flags ) : void
prev IntPtr
curr IntPtr
prevPyr IntPtr
currPyr IntPtr
prevFeatures [
currFeatures [
count int
winSize Size
level int
status Byte
trackError float
criteria MCvTermCriteria
flags CvEnum
Результат void
        public static extern void cvCalcOpticalFlowPyrLK(
         IntPtr prev,
         IntPtr curr,
         IntPtr prevPyr,
         IntPtr currPyr,
         [In]
         PointF[] prevFeatures,
         [Out]
         PointF[] currFeatures,
         int count,
         Size winSize,
         int level,
         Byte[] status,
         float[] trackError,
         MCvTermCriteria criteria,
         CvEnum.LKFLOW_TYPE flags);

Same methods

CvInvoke::cvCalcOpticalFlowPyrLK ( IntPtr prev, IntPtr curr, IntPtr prevPyr, IntPtr currPyr, float prevFeatures, float currFeatures, int count, Size winSize, int level, Byte status, float trackError, MCvTermCriteria criteria, CvEnum flags ) : void

Usage Example

Пример #1
0
        /// <summary>
        /// Calculates optical flow for a sparse feature set using iterative Lucas-Kanade method in pyramids
        /// </summary>
        /// <param name="prev">First frame, at time t</param>
        /// <param name="curr">Second frame, at time t + dt </param>
        /// <param name="prevPyrBuffer">Buffer for the pyramid for the first frame. If it is not NULL, the buffer must have a sufficient size to store the pyramid from level 1 to level #level ; the total size of (image_width+8)*image_height/3 bytes is sufficient</param>
        /// <param name="currPyrBuffer">Similar to prev_pyr, used for the second frame</param>
        /// <param name="prevFeatures">Array of points for which the flow needs to be found</param>
        /// <param name="winSize">Size of the search window of each pyramid level</param>
        /// <param name="level">Maximal pyramid level number. If 0 , pyramids are not used (single level), if 1 , two levels are used, etc</param>
        /// <param name="criteria">Specifies when the iteration process of finding the flow for each point on each pyramid level should be stopped</param>
        /// <param name="flags">Flags</param>
        /// <param name="currFeatures">Array of 2D points containing calculated new positions of input features in the second image</param>
        /// <param name="status">Array. Every element of the array is set to 1 if the flow for the corresponding feature has been found, 0 otherwise</param>
        /// <param name="trackError">Array of double numbers containing difference between patches around the original and moved points</param>
        public static void PyrLK(
            Image <Gray, Byte> prev,
            Image <Gray, Byte> curr,
            Image <Gray, Byte> prevPyrBuffer,
            Image <Gray, Byte> currPyrBuffer,
            PointF[] prevFeatures,
            Size winSize,
            int level,
            MCvTermCriteria criteria,
            Emgu.CV.CvEnum.LKFLOW_TYPE flags,
            out PointF[] currFeatures,
            out Byte[] status,
            out float[] trackError)
        {
            Image <Gray, Byte> prevPyrBufferParam = prevPyrBuffer ?? new Image <Gray, byte>(prev.Width + 8, prev.Height / 3);
            Image <Gray, Byte> currPyrBufferParam = currPyrBuffer ?? prevPyrBufferParam.CopyBlank();

            status     = new Byte[prevFeatures.Length];
            trackError = new float[prevFeatures.Length];

            currFeatures = new PointF[prevFeatures.Length];

            CvInvoke.cvCalcOpticalFlowPyrLK(
                prev,
                curr,
                prevPyrBufferParam,
                currPyrBufferParam,
                prevFeatures,
                currFeatures,
                prevFeatures.Length,
                winSize,
                level,
                status,
                trackError,
                criteria,
                flags);

            #region Release buffer images if they are create within this function call
            if (!object.ReferenceEquals(prevPyrBufferParam, prevPyrBuffer))
            {
                prevPyrBufferParam.Dispose();
            }
            if (!object.ReferenceEquals(currPyrBufferParam, currPyrBuffer))
            {
                currPyrBufferParam.Dispose();
            }
            #endregion
        }
CvInvoke