Ejemplo n.º 1
0
 /// <summary>
 /// Release the unmanaged memory associated with this multi-tracker.
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         TrackingInvoke.cveMultiTrackerRelease(ref _ptr);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Release the unmanaged resources associated with this tracker
 /// </summary>
 protected override void DisposeObject()
 {
     if (IntPtr.Zero != _ptr)
     {
         TrackingInvoke.cveTrackerMedianFlowRelease(ref _ptr, ref _sharedPtr);
     }
     base.DisposeObject();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns the tracked objects, each object corresponds to one tracker algorithm.
 /// </summary>
 /// <returns>The tracked objects, each object corresponds to one tracker algorithm.</returns>
 public Rectangle[] GetObjects()
 {
     using (VectorOfRect vr = new VectorOfRect())
     {
         TrackingInvoke.cveMultiTrackerGetObjects(_ptr, vr);
         return(vr.ToArray());
     }
 }
Ejemplo n.º 4
0
 /// <summary>Create a median flow tracker</summary>
 /// <param name="pointsInGrid">Points in grid, use 10 for default.</param>
 /// <param name="winSize">Win size, use (3, 3) for default</param>
 /// <param name="maxLevel">Max level, use 5 for default.</param>
 /// <param name="termCriteria">Termination criteria, use count = 20 and eps = 0.3 for default</param>
 /// <param name="winSizeNCC">win size NCC, use (30, 30) for default</param>
 /// <param name="maxMedianLengthOfDisplacementDifference">Max median length of displacement difference</param>
 public TrackerMedianFlow(
     int pointsInGrid,
     Size winSize,
     int maxLevel,
     MCvTermCriteria termCriteria,
     Size winSizeNCC,
     double maxMedianLengthOfDisplacementDifference = 10)
 {
     TrackingInvoke.cveTrackerMedianFlowCreate(pointsInGrid, ref winSize, maxLevel, ref termCriteria, ref winSizeNCC, maxMedianLengthOfDisplacementDifference, ref _trackerPtr, ref _sharedPtr);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Create a Boosting Tracker
 /// </summary>
 /// <param name="numClassifiers">The number of classifiers to use in a OnlineBoosting algorithm</param>
 /// <param name="samplerOverlap">Search region parameters to use in a OnlineBoosting algorithm</param>
 /// <param name="samplerSearchFactor">search region parameters to use in a OnlineBoosting algorithm</param>
 /// <param name="iterationInit">The initial iterations</param>
 /// <param name="featureSetNumFeatures">Number of features, a good value would be 10*numClassifiers + iterationInit</param>
 public TrackerBoosting(
     int numClassifiers        = 100,
     float samplerOverlap      = 0.99f,
     float samplerSearchFactor = 1.8f,
     int iterationInit         = 50,
     int featureSetNumFeatures = 100 *10 + 50)
 {
     TrackingInvoke.cveTrackerBoostingCreate(
         numClassifiers,
         samplerOverlap,
         samplerSearchFactor,
         iterationInit,
         featureSetNumFeatures,
         ref _trackerPtr,
         ref _sharedPtr);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Update the tracker, find the new most likely bounding box for the target.
 /// </summary>
 /// <param name="image">The current frame</param>
 /// <param name="boundingBox">The bounding box that represent the new target location, if true was returned, not modified otherwise</param>
 /// <returns>True means that target was located and false means that tracker cannot locate target in current frame. Note, that latter does not imply that tracker has failed, maybe target is indeed missing from the frame (say, out of sight)</returns>
 public bool Update(Mat image, out Rectangle boundingBox)
 {
     boundingBox = new Rectangle();
     return(TrackingInvoke.cveLegacyTrackerUpdate(_trackerPtr, image, ref boundingBox));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initialize the tracker with a know bounding box that surrounding the target.
 /// </summary>
 /// <param name="image">The initial frame</param>
 /// <param name="boundingBox">The initial bounding box</param>
 /// <returns>True if successful.</returns>
 public bool Init(Mat image, Rectangle boundingBox)
 {
     return(TrackingInvoke.cveLegacyTrackerInit(_trackerPtr, image, ref boundingBox));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Create a MOSSE tracker
 /// </summary>
 public TrackerMOSSE()
 {
     _ptr = TrackingInvoke.cveTrackerMOSSECreate(ref _trackerPtr, ref _sharedPtr);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a TLD tracker
 /// </summary>
 public TrackerTLD()
 {
     _ptr = TrackingInvoke.cveTrackerTLDCreate(ref _trackerPtr, ref _sharedPtr);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Update the current tracking status. The result will be saved in the internal storage.
 /// </summary>
 /// <param name="image">Input image</param>
 /// <param name="boundingBox">the tracking result, represent a list of ROIs of the tracked objects.</param>
 /// <returns>True id update success</returns>
 public bool Update(Mat image, VectorOfRect boundingBox)
 {
     return(TrackingInvoke.cveMultiTrackerUpdate(_ptr, image, boundingBox));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Add a new object to be tracked. The defaultAlgorithm will be used the newly added tracker.
 /// </summary>
 /// <param name="tracker">The tracker to use for tracking the image</param>
 /// <param name="image">Input image</param>
 /// <param name="boundingBox">A rectangle represents ROI of the tracked object</param>
 /// <returns>True if successfully added</returns>
 public bool Add(Tracker tracker, IInputArray image, Rectangle boundingBox)
 {
     using (InputArray iaImage = image.GetInputArray())
         return(TrackingInvoke.cveMultiTrackerAdd(_ptr, tracker, iaImage, ref boundingBox));
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Constructor. In the case of trackerType is given, it will be set as the default algorithm for all trackers.
        /// </summary>

        public MultiTracker()
        {
            _ptr = TrackingInvoke.cveMultiTrackerCreate();
        }