process method

Stream<FaceMeshResult> process(
  1. Stream<FaceMeshImage> frames, {
  2. NormalizedRect? roi,
  3. FaceMeshBoxResolver<FaceMeshImage>? boxResolver,
  4. double boxScale = _boxScale,
  5. bool boxMakeSquare = true,
  6. int rotationDegrees = 0,
  7. bool mirrorHorizontal = false,
})

Processes a stream of FaceMeshImage frames sequentially.

Provide either a static roi or a boxResolver callback to define the region of interest per frame (not both). Every incoming frame is processed with the same parameters that you would pass to FaceMeshProcessor.process.

Implementation

Stream<FaceMeshResult> process(
  Stream<FaceMeshImage> frames, {
  NormalizedRect? roi,
  FaceMeshBoxResolver<FaceMeshImage>? boxResolver,
  double boxScale = _boxScale,
  bool boxMakeSquare = true,
  int rotationDegrees = 0,
  bool mirrorHorizontal = false,
}) async* {
  _validateResolvers<FaceMeshImage>(roi, boxResolver);
  await for (final FaceMeshImage frame in frames) {
    final FaceMeshBox? dynamicBox = boxResolver?.call(frame);
    yield _processor.process(
      frame,
      roi: roi,
      box: dynamicBox,
      boxScale: boxScale,
      boxMakeSquare: boxMakeSquare,
      rotationDegrees: rotationDegrees,
      mirrorHorizontal: mirrorHorizontal,
    );
  }
}