addTarget method

void addTarget(
  1. AiliaTrackerTarget target
)

Registers one detection result of the current frame.

Implementation

void addTarget(AiliaTrackerTarget target) {
  if (!available) {
    throw Exception("Tracker not created");
  }

  final Pointer<ailia_tracker_dart.AILIADetectorObject> detectorObject =
      malloc<ailia_tracker_dart.AILIADetectorObject>();
  detectorObject.ref.category = target.category;
  detectorObject.ref.prob = target.prob;
  detectorObject.ref.x = target.x;
  detectorObject.ref.y = target.y;
  detectorObject.ref.w = target.w;
  detectorObject.ref.h = target.h;

  int status = ailiaTracker.ailiaTrackerAddTarget(
    ppAiliaTracker!.value,
    detectorObject,
    ailiaDetectorObjectVersion,
  );

  malloc.free(detectorObject);

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