/// <summary> /// Calculates the optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids. /// </summary> /// <param name="prev">First frame.</param> /// <param name="curr">Second frame.</param> /// <param name="prevPyr"> /// Buffer for the pyramid for the first frame. If it is not <b>null</b>, the buffer must have a sufficient /// size to store the pyramid from level 1 to level <paramref name="level"/>; the total size of /// (width + 8) * height / 3 bytes is sufficient. /// </param> /// <param name="currPyr"> /// The same as <paramref name="prevPyr"/>, for the second frame. /// </param> /// <param name="prevFeatures">Array of points for which the flow needs to be found.</param> /// <param name="currFeatures"> /// Array of 2D points containing the calculated new positions of the input features in the second image. /// </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="status"> /// Every element of the status array is set to either 1, if the flow for the corresponding feature has been /// found, or 0 otherwise. /// </param> /// <param name="trackError"> /// Array of numbers containing the difference between patches around the original and moved points. /// Optional parameter; can be <b>null</b>. /// </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">Specifies operation flags.</param> public static void CalcOpticalFlowPyrLK( Arr prev, Arr curr, Arr prevPyr, Arr currPyr, Point2f[] prevFeatures, Point2f[] currFeatures, Size winSize, int level, byte[] status, float[] trackError, TermCriteria criteria, LKFlowFlags flags) { NativeMethods.cvCalcOpticalFlowPyrLK( prev, curr, prevPyr, currPyr, prevFeatures, currFeatures, prevFeatures.Length, winSize, level, status, trackError, criteria, flags); }
internal static extern void cvCalcOpticalFlowPyrLK( Arr prev, Arr curr, Arr prev_pyr, Arr curr_pyr, Point2f[] prev_features, [In, Out] Point2f[] curr_features, int count, Size win_size, int level, [Out] byte[] status, [Out] float[] track_error, TermCriteria criteria, LKFlowFlags flags);