create method

void create({
  1. int algorithm = ailia_tracker_dart.AILIA_TRACKER_ALGORITHM_BYTE_TRACK,
  2. int flags = ailia_tracker_dart.AILIA_TRACKER_FLAG_NONE,
  3. double scoreThreshold = 0.1,
  4. double nmsThreshold = 0.7,
  5. double trackThreshold = 0.5,
  6. int trackBuffer = 30,
  7. double matchThreshold = 0.8,
})

Creates a tracker instance.

algorithm is AILIA_TRACKER_ALGORITHM_, flags is a logical OR of AILIA_TRACKER_FLAG_. Settings default to the values documented in ailia_tracker.h and can be overridden individually.

Implementation

void create({
  int algorithm = ailia_tracker_dart.AILIA_TRACKER_ALGORITHM_BYTE_TRACK,
  int flags = ailia_tracker_dart.AILIA_TRACKER_FLAG_NONE,
  double scoreThreshold = 0.1,
  double nmsThreshold = 0.7,
  double trackThreshold = 0.5,
  int trackBuffer = 30,
  double matchThreshold = 0.8,
}) {
  close(); // for reopen

  ailiaTracker = ailia_tracker_dart.ailiaTrackerFFI(
    ailiaCommonGetLibrary(ailiaCommonGetTrackerPath()),
  );
  ppAiliaTracker = malloc<Pointer<ailia_tracker_dart.AILIATracker>>();

  final Pointer<ailia_tracker_dart.AILIATrackerSettings> settings =
      malloc<ailia_tracker_dart.AILIATrackerSettings>();
  settings.ref.score_threshold = scoreThreshold;
  settings.ref.nms_threshold = nmsThreshold;
  settings.ref.track_threshold = trackThreshold;
  settings.ref.track_buffer = trackBuffer;
  settings.ref.match_threshold = matchThreshold;

  int status = ailiaTracker.ailiaTrackerCreate(
    ppAiliaTracker,
    algorithm,
    settings,
    ailia_tracker_dart.AILIA_TRACKER_SETTINGS_VERSION,
    flags,
  );

  malloc.free(settings);

  if (status != ailiaStatusSuccess) {
    throw Exception("ailiaTrackerCreate error $status");
  }

  available = true;
}