frameStats static method

FrameStats frameStats(
  1. Uint8List gray,
  2. int width,
  3. int height,
  4. int stride,
)

Mean luma + focus (variance of Laplacian) for a grayscale frame.

Implementation

static FrameStats frameStats(
  Uint8List gray,
  int width,
  int height,
  int stride,
) {
  final input = calloc<Uint8>(gray.length);
  final luma = calloc<Float>(1);
  final focus = calloc<Float>(1);
  try {
    input.asTypedList(gray.length).setAll(0, gray);
    _frameStats(input, width, height, stride, luma, focus);
    return FrameStats(luma.value, focus.value);
  } finally {
    calloc.free(input);
    calloc.free(luma);
    calloc.free(focus);
  }
}