/// <summary>
 /// Return the blob given the specific index
 /// </summary>
 /// <param name="i">The index of the blob</param>
 /// <returns>The blob in the specific index</returns>
 public override MCvBlob this[int i]
 {
    get
    {
       return (MCvBlob)Marshal.PtrToStructure(BlobTrackerAutoInvoke.CvBlobTrackerAutoGetBlob(_ptr, i), typeof(MCvBlob));
    }
 }
 /// <summary>
 /// Create a default auto blob tracker 
 /// </summary>
 public BlobTrackerAuto()
 {
    BlobTrackerAutoParam<TColor> param = new BlobTrackerAutoParam<TColor>();
    param.FGDetector = new FGDetector<TColor>(Emgu.CV.CvEnum.FORGROUND_DETECTOR_TYPE.FGD);
    _param = param;
    MCvBlobTrackerAutoParam1 p = _param.MCvBlobTrackerAutoParam1;
    _ptr = BlobTrackerAutoInvoke.CvCreateBlobTrackerAuto1(ref p);
 }
 /// <summary>
 /// Process a frame
 /// </summary>
 /// <param name="currentFrame">The frame to be processed</param>
 /// <param name="foregroundMask">the foreground mask to be used</param>
 public void Process(Image<TColor, Byte> currentFrame, Image<Gray, Byte> foregroundMask)
 {
    BlobTrackerAutoInvoke.CvBlobTrackerAutoProcess(_ptr, currentFrame.Ptr, foregroundMask == null ? IntPtr.Zero : foregroundMask.Ptr);
 }
 /// <summary>
 /// Create a auto blob tracker using the specific parameters
 /// </summary>
 /// <param name="param">The parameters for this blob tracker auto</param>
 public BlobTrackerAuto(BlobTrackerAutoParam<TColor> param)
 {
    _param = param;
    MCvBlobTrackerAutoParam1 p = _param.MCvBlobTrackerAutoParam1;
    _ptr = BlobTrackerAutoInvoke.CvCreateBlobTrackerAuto1(ref p);
 }
 /// <summary>
 /// Release the blob tracker auto
 /// </summary>
 protected override void DisposeObject()
 {
    BlobTrackerAutoInvoke.CvBlobTrackerAutoRelease(ref _ptr);
 }
 /// <summary>
 /// Get the blob with the specific id
 /// </summary>
 /// <param name="blobID">The id of the blob</param>
 /// <returns>The blob of the specific id, if it doesn't exist, MCvBlob.Empty is returned</returns>
 public override MCvBlob GetBlobByID(int blobID)
 {
    IntPtr blobPtr = BlobTrackerAutoInvoke.CvBlobTrackerAutoGetBlobByID(_ptr, blobID);
    if (blobPtr == IntPtr.Zero) return MCvBlob.Empty;
    return (MCvBlob)Marshal.PtrToStructure(blobPtr, typeof(MCvBlob));
 }