detect method

  1. @Deprecated('Use detectImageFile or detectPixels instead')
List<YoloxResults> detect({
  1. String? imagePath,
  2. Uint8List? pixels,
  3. PixelFormat pixelFormat = PixelFormat.rgb,
  4. int? width,
  5. int? height,
})

Detect with YOLOX Run it after initYolox

When detecting from an image file, specify imagePath. The imagePath should be the path to the image, such as "assets/image.jpg". The Orientation in the Exif of the image file is ignored. You may need to rotate the image if the object is not detected successfully.

When detecting from an image byte array, specify pixels, pixelFormat, height and width. pixels is pixel data of the image. pixelFormat is the pixel format. width and height are the width and height of the image.

Return a list of YoloxResults.

Implementation

@Deprecated('Use detectImageFile or detectPixels instead')
List<YoloxResults> detect({
  String? imagePath,
  Uint8List? pixels,
  PixelFormat pixelFormat = PixelFormat.rgb,
  int? width,
  int? height,
}) {
  if (imagePath != null) {
    return detectImageFile(
      imagePath,
    );
  }

  if (width != null && height != null && pixels != null) {
    return detectPixels(
      pixels: pixels,
      pixelFormat: pixelFormat,
      width: width,
      height: height,
    );
  }

  return [];
}