cv2ext.tracking.cv_trackers package

Module contents

Contains the wrapped OpenCV trackers.

Classes

BoostingTracker

A class for tracking objects in videos using the Boosting tracker.

CSRTTracker

A class for tracking objects in videos using the CSRT tracker.

KCFTracker

A class for tracking objects in videos using the KCF tracker.

MedianFlowTracker

A class for tracking objects in videos using the MedianFlow tracker.

MILTracker

A class for tracking objects in videos using the MIL tracker.

MOSSETracker

A class for tracking objects in videos using the MOSSE tracker.

TLDTracker

A class for tracking objects in videos using the TLD tracker.

class cv2ext.tracking.cv_trackers.BoostingTracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the Boosting tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

Raises:

ValueError – If the image is not 3-channel.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

Raises:

ValueError – If the image is not 3-channel.

class cv2ext.tracking.cv_trackers.CSRTTracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the CSRT tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

class cv2ext.tracking.cv_trackers.KCFTracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the KCF tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

Raises:

ValueError – If the image is not 3-channel.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

Raises:

ValueError – If the image is not 3-channel.

class cv2ext.tracking.cv_trackers.MILTracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the MIL tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

class cv2ext.tracking.cv_trackers.MOSSETracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the MOSSE tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

class cv2ext.tracking.cv_trackers.MedianFlowTracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the MedianFlow tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

class cv2ext.tracking.cv_trackers.TLDTracker[source]

Bases: CVTrackerInterface

A class for tracking objects in videos using the TLD tracker.

init(image: np.ndarray, bbox: tuple[int, int, int, int]) None[source]

Initialize the tracker with an image and bounding box.

Parameters:
  • image (np.ndarray) – The image to use for tracking.

  • bbox (tuple[int, int, int, int]) – The bounding box of the object to track. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.

update(image: np.ndarray) tuple[bool, tuple[int, int, int, int]][source]

Update the tracker with a new image.

Parameters:

image (np.ndarray) – The new image to use for tracking.

Returns:

  • bool – Whether the update was successful.

  • tuple[int, int, int, int] – The bounding box of the tracked object. Bounding box is format (x, y, x, y), where (x, y) is the top-left/bottom-right corner of the box.