Previously I used Firebase ML kit for flutter to get user head position left, right, up and down in my applicatoin. It was easy then but now I can't find the way to implement google ml kit for same implementation.
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];
}
i'd used import 'package:firebase_ml_vision/firebase_ml_vision.dart'; library