如何在flutter中使用google ml kit面部姿势估计?

问题描述 投票:0回答:1

之前,我使用 Firebase ML 套件进行颤动,以在我的应用程序中获取用户头部的左、右、上、下位置。那时很容易,但现在我找不到实现 google ml 套件以实现相同实现的方法。

  final FaceExpressionProvider _expressionProvider = FaceExpressionProvider();
  final FaceExpressionUtils _expressionVerifier = FaceExpressionUtils();
void _expressionListener() {
    final Face face = _expressionProvider.face;
    if (_controller == null) _controller = _expressionProvider.cameraController;
    var state = _expressionVerifier.process(face);
    _instruction = _instructionMapper(state);
    if (state == Instructions.VerificationComplete) {
      _captureImage();
    }

    setState(() {});
  }
FaceMovementInstruction _instructionMapper(Instructions instruction) {
    final instructions = [
      FaceMovementInstruction(
          AppLocalizations.of(context).faceNotFound.toUpperCase(),
          "facenotfound"),
      FaceMovementInstruction(
          AppLocalizations.of(context).lookLeft.toUpperCase(), "lookleft"),
      FaceMovementInstruction(
          AppLocalizations.of(context).lookRight.toUpperCase(), "lookright"),
      FaceMovementInstruction(
          AppLocalizations.of(context).smilePlease.toUpperCase(), "smile"),
      FaceMovementInstruction(
          AppLocalizations.of(context).verified.toUpperCase(), "verified"),
      FaceMovementInstruction(
          AppLocalizations.of(context).error.toUpperCase(), "error"),
    ];
    switch (instruction) {
      case Instructions.ShowFace:
        return instructions[0];
      case Instructions.LookLeft:
        return instructions[1];
        break;
      case Instructions.LookRight:
        return instructions[2];
        break;
      case Instructions.SmilePlease:
        return instructions[3];
        break;
      case Instructions.AnalyzingResults:
        break;
      case Instructions.VerificationComplete:
        return instructions[4];
        break;
    }
    return instructions[5];
  }

我使用了 import 'package:firebase_ml_vision/firebase_ml_vision.dart';图书馆

flutter face-detection firebase-mlkit google-mlkit pose-estimation
1个回答
0
投票

你有没有弄清楚这一点?目前也有同样的问题。从我看来一切都贬值了。

© www.soinside.com 2019 - 2024. All rights reserved.