|
| 1 | +ObjectTracker |
| 2 | +============= |
| 3 | + |
| 4 | +Object tracker tracks detected objects from the :ref:`ImgDetections` using Kalman filter and hungarian algorithm. |
| 5 | + |
| 6 | +How to place it |
| 7 | +############### |
| 8 | + |
| 9 | +.. tabs:: |
| 10 | + |
| 11 | + .. code-tab:: py |
| 12 | + |
| 13 | + pipeline = dai.Pipeline() |
| 14 | + objectTracker = pipeline.createObjectTracker() |
| 15 | + |
| 16 | + .. code-tab:: c++ |
| 17 | + |
| 18 | + dai::Pipeline pipeline; |
| 19 | + auto objectTracker = pipeline.create<dai::node::ObjectTracker>(); |
| 20 | + |
| 21 | + |
| 22 | +Inputs and Outputs |
| 23 | +################## |
| 24 | + |
| 25 | +.. code-block:: |
| 26 | +
|
| 27 | + ┌───────────────────┐ |
| 28 | + inputDetectionFrame │ │passthroughDetectionFrame |
| 29 | + ───────────────────►│-------------------├─────────────────────────► |
| 30 | + │ │ out |
| 31 | + │ Object ├─────────────────────────► |
| 32 | + inputTrackerFrame │ Tracker │ passthroughTrackerFrame |
| 33 | + ───────────────────►│-------------------├─────────────────────────► |
| 34 | + inputDetections │ │ passthroughDetections |
| 35 | + ───────────────────►│-------------------├─────────────────────────► |
| 36 | + └───────────────────┘ |
| 37 | +
|
| 38 | +**Message types** |
| 39 | + |
| 40 | +- :code:`inputDetectionFrame` - :ref:`ImgFrame` |
| 41 | +- :code:`inputTrackerFrame` - :ref:`ImgFrame` |
| 42 | +- :code:`inputDetections` - :ref:`ImgDetections` |
| 43 | +- :code:`out` - :ref:`Tracklets` |
| 44 | +- :code:`passthroughDetectionFrame` - :ref:`ImgFrame` |
| 45 | +- :code:`passthroughTrackerFrame` - :ref:`ImgFrame` |
| 46 | +- :code:`passthroughDetections` - :ref:`ImgDetections` |
| 47 | + |
| 48 | +Usage |
| 49 | +##### |
| 50 | + |
| 51 | +.. tabs:: |
| 52 | + |
| 53 | + .. code-tab:: py |
| 54 | + |
| 55 | + pipeline = dai.Pipeline() |
| 56 | + objectTracker = pipeline.createObjectTracker() |
| 57 | + |
| 58 | + objectTracker.setDetectionLabelsToTrack([15]) # Track only person |
| 59 | + # Possible tracking types: ZERO_TERM_COLOR_HISTOGRAM, ZERO_TERM_IMAGELESS |
| 60 | + objectTracker.setTrackerType(dai.TrackerType.ZERO_TERM_COLOR_HISTOGRAM) |
| 61 | + # Take the smallest ID when new object is tracked, possible options: SMALLEST_ID, UNIQUE_ID |
| 62 | + objectTracker.setTrackerIdAssigmentPolicy(dai.TrackerIdAssigmentPolicy.SMALLEST_ID) |
| 63 | + |
| 64 | + # You have to use Object tracker in combination with detection network |
| 65 | + # and an image frame source - mono/color camera or xlinkIn node |
| 66 | + |
| 67 | + .. code-tab:: c++ |
| 68 | + |
| 69 | + dai::Pipeline pipeline; |
| 70 | + auto objectTracker = pipeline.create<dai::node::ObjectTracker>(); |
| 71 | + |
| 72 | + objectTracker->setDetectionLabelsToTrack({15}); // Track only person |
| 73 | + // Possible tracking types: ZERO_TERM_COLOR_HISTOGRAM, ZERO_TERM_IMAGELESS |
| 74 | + objectTracker->setTrackerType(dai::TrackerType::ZERO_TERM_COLOR_HISTOGRAM); |
| 75 | + // Take the smallest ID when new object is tracked, possible options: SMALLEST_ID, UNIQUE_ID |
| 76 | + objectTracker->setTrackerIdAssigmentPolicy(dai::TrackerIdAssigmentPolicy::SMALLEST_ID); |
| 77 | + |
| 78 | + // You have to use Object tracker in combination with detection network |
| 79 | + // and an image frame source - mono/color camera or xlinkIn node |
| 80 | + |
| 81 | +Examples of functionality |
| 82 | +######################### |
| 83 | + |
| 84 | +- :ref:`29.1 - Object tracker on RGB camera` |
| 85 | +- :ref:`29.2 - Spatial object tracker on RGB camera` |
| 86 | +- :ref:`29.3 - Object tracker on video` |
| 87 | + |
| 88 | +Reference |
| 89 | +######### |
| 90 | + |
| 91 | +.. tabs:: |
| 92 | + |
| 93 | + .. tab:: Python |
| 94 | + |
| 95 | + .. autoclass:: depthai.ObjectTracker |
| 96 | + :members: |
| 97 | + :inherited-members: |
| 98 | + :noindex: |
| 99 | + |
| 100 | + .. tab:: C++ |
| 101 | + |
| 102 | + .. doxygenclass:: dai::node::ObjectTracker |
| 103 | + :project: depthai-core |
| 104 | + :members: |
| 105 | + :private-members: |
| 106 | + :undoc-members: |
| 107 | + |
| 108 | +.. include:: ../../includes/footer-short.rst |
0 commit comments