process method

Stream<FaceMeshResult> process(
  1. Stream<FaceMeshImage> frames, {
  2. NormalizedRect? roi,
  3. FaceMeshRoiResolver<FaceMeshImage>? roiResolver,
  4. FaceMeshBoxResolver<FaceMeshImage>? boxResolver,
  5. double boxScale = _boxScale,
  6. bool boxMakeSquare = true,
  7. int rotationDegrees = 0,
  8. 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,
  FaceMeshRoiResolver<FaceMeshImage>? roiResolver,
  FaceMeshBoxResolver<FaceMeshImage>? boxResolver,
  double boxScale = _boxScale,
  bool boxMakeSquare = true,
  int rotationDegrees = 0,
  bool mirrorHorizontal = false,
}) async* {
  _validateResolvers<FaceMeshImage>(roi, roiResolver, boxResolver);
  await for (final FaceMeshImage frame in frames) {
    final NormalizedRect? dynamicRoi = roiResolver?.call(frame);
    final FaceMeshBox? dynamicBox = boxResolver?.call(frame);
    yield _processor.process(
      frame,
      roi: dynamicRoi ?? roi,
      box: dynamicBox,
      boxScale: boxScale,
      boxMakeSquare: boxMakeSquare,
      rotationDegrees: rotationDegrees,
      mirrorHorizontal: mirrorHorizontal,
    );
  }
}