/// <summary> /// Process a new video frame. /// </summary> public void ProcessFrame(UnmanagedImage frame) { filterImage = filter.Apply(frame); Blob blob = extractBlob(); if (blob == null) { trackingObject.Reset(); return; } trackingObject.Rectangle = blob.Rectangle; trackingObject.Center = (IntPoint)blob.CenterOfGravity; if (rotation) { // Locate moments CentralMoments moments = new CentralMoments(); moments.Compute(filterImage, blob.Rectangle); trackingObject.Angle = moments.GetOrientation(); } if (extract) { blobCounter.ExtractBlobsImage(filterImage, blob, false); trackingObject.Image = blob.Image; } }