ethoscope.trackers package

Module contents

ethoscope.trackers.trackers module

class ethoscope.trackers.trackers.BaseTracker(roi, data=None)[source]

Bases: ethoscope.utils.description.DescribedObject

Template class for video trackers. A video tracker locate animal in a ROI. Derived class must implement the _find_position method.

Parameters:
  • roi (ROI) – The Region Of Interest the the tracker will use to locate the animal.
  • data – An optional data set. For instance, it can be used for pre-trained algorithms
Returns:

last_time_point
Returns:The last time point that the tracker used. This is updated even when position is inferred/no animal is found
Return type:int
positions
Returns:The last few positions found by the tracker. Positions are kept for a certain duration defined by the _max_history_length attribute.
Return type:deque
times
Returns:The last few time points corresponding to positions.
Return type:deque
track(t, img)[source]

Locate the animal in a image, at a given time.

Parameters:
  • t (int) – time in ms
  • img (ndarray) – the whole frame.
Returns:

The position of the animal at time t

Return type:

DataPoint

xy_pos(i)[source]
exception ethoscope.trackers.trackers.NoPositionError[source]

Bases: exceptions.Exception

Used to abort tracking. When it is raised within the _find_position method, data is inferred from previous position.

ethoscope.trackers.single_roi_tracker module

class ethoscope.trackers.single_roi_tracker.AdaptiveBGModelOneObject(roi, data=None)[source]

Bases: ethoscope.trackers.trackers.BaseTracker

ethoscope.trackers.adaptive_bg_tracker module

class ethoscope.trackers.adaptive_bg_tracker.AdaptiveBGModel(roi, data=None)[source]

Bases: ethoscope.trackers.trackers.BaseTracker

An adaptive background subtraction model to find position of one animal in one roi.

TODO more description here :param roi: :param data: :return:

fg_model = <ethoscope.trackers.adaptive_bg_tracker.ObjectModel object>
class ethoscope.trackers.adaptive_bg_tracker.BackgroundModel(max_half_life=500000.0, min_half_life=5000.0, increment=1.2)[source]

Bases: object

A class to model background. It uses a dynamic running average and support arbitrary and heterogeneous frame rates

bg_img
decrease_learning_rate()[source]
increase_learning_rate()[source]
update(img_t, t, fg_mask=None)[source]
class ethoscope.trackers.adaptive_bg_tracker.ObjectModel(history_length=1000)[source]

Bases: object

A class to model, update and predict foreground object (i.e. tracked animal).

compute_features(img, contour)[source]
distance(features, time)[source]
features_header
is_ready
update(img, contour, time)[source]