detectImageFile method

List<YoloxResults> detectImageFile(
  1. String imagePath
)

Detect with YOLOX Run it after initYolox

Read the image from the file path and execute Detect.

The imagePath should be the path to the image, such as "assets/image.jpg". Returns the results of a YOLOX run as a List of YoloxResults.

Implementation

List<YoloxResults> detectImageFile(
  String imagePath,
) {
  assert(imagePath.isNotEmpty, 'imagePath is empty');

  if (imagePath.isEmpty) {
    return [];
  }

  final imagePathNative = imagePath.toNativeUtf8();

  final results = YoloxResults.create(
    _detectWithImagePathYoloxFunction(
      imagePathNative,
      nmsThresh,
      confThresh,
      targetSize,
    ).toDartString(),
  );
  calloc.free(imagePathNative);
  return results;
}