Ejemplo n.º 1
0
 /// <summary>
 /// Returns a reference to a storage for the tracked objects, each object corresponds to one tracker algorithm
 /// </summary>
 /// <returns></returns>
 public Rect2d[] GetObjects()
 {
     using var bbVec = new VectorOfRect2d();
     NativeMethods.HandleException(
         NativeMethods.tracking_MultiTracker_getObjects(ptr, bbVec.CvPtr));
     GC.KeepAlive(this);
     return(bbVec.ToArray());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Update the current tracking status.
        /// </summary>
        /// <param name="image">input image</param>
        /// <param name="boundingBox">the tracking result, represent a list of ROIs of the tracked objects.</param>
        /// <returns></returns>
        public bool Update(InputArray image, out Rect2d[] boundingBox)
        {
            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            using var bbVec = new VectorOfRect2d();
            NativeMethods.HandleException(
                NativeMethods.tracking_MultiTracker_update2(ptr, image.CvPtr, bbVec.CvPtr, out var ret));
            boundingBox = bbVec.ToArray();

            GC.KeepAlive(image);
            GC.KeepAlive(this);

            return(ret != 0);
        }