detectPixels method

List<YoloxResults> detectPixels({
  1. required Uint8List pixels,
  2. PixelFormat pixelFormat = PixelFormat.rgb,
  3. required int width,
  4. required int height,
})

Detect with YOLOX Run it after initYolox

Reads an image from pixel data and executes Detect.

pixels is pixel data of the image. pixelFormat is the pixel format. width and height are the width and height of the image.

Returns a list of YoloxResults

Implementation

List<YoloxResults> detectPixels({
  required Uint8List pixels,
  PixelFormat pixelFormat = PixelFormat.rgb,
  required int width,
  required int height,
}) {
  final pixelsNative = calloc.allocate<Uint8>(pixels.length);

  for (var i = 0; i < pixels.length; i++) {
    pixelsNative[i] = pixels[i];
  }

  final results = YoloxResults.create(
    _detectWithPixelsYoloxFunction(
      pixelsNative,
      pixelFormat.type,
      width,
      height,
      nmsThresh,
      confThresh,
      targetSize,
    ).toDartString(),
  );
  calloc.free(pixelsNative);
  return results;
}