Skip to content

v0.8.0

Compare
Choose a tag to compare
@tdurand tdurand released this 08 Sep 09:17
· 20 commits to master since this release
474f50a

v0.8.0 is a @vsaw contribution

see #19

Features: Reset idDisplay, configurable fast delete and custom distance function

1. Reset idDisplay

Resetting the tracker did not affect the item ID. Therefore multiple tests runs on the same file were difficult to evaluate as one had to offset the later runs to get the actual number of the items tracked.

This pull request fixes this. As it introduces a new reset function for ItemsTracked.

To prove it is working, jasmine tests with GitHub Actions are included. As GitHub does not run the checks in the opendatacam repository see the passing checks in my fork here: https://github.com/vsaw/node-moving-things-tracker/actions/runs/202256302

2. Configurable Fast Delete

This allows to configure if detections should be removed quickly in cases where they were detected and could not be matched afterwards.

Fast deletion can be enabled/disabled via:

Tracker.setParams({ fastDelete: false });

Again passing tests can be see here https://github.com/vsaw/node-moving-things-tracker/pull/2/checks

3. Custom Distance Function

In cases where one wants to try with a custom distance function it can now be passed to the Tracer as follows:

// See https://en.wikipedia.org/wiki/Taxicab_geometry
function l1metric(item1, item2) {
  // Get the x and y distance, in relation to the item size
  const xDist = Math.abs(item1.x - item2.x) / ((item1.w + item2.w) / 2);
  const yDist = Math.abs(item1.y - item2.y) / ((item1.h + item2.h) / 2);
  return xDist + yDist;
}

Tracker.setParams({ distanceFunc: l1metric });