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
}