flutter_package_liveness 0.0.1
flutter_package_liveness: ^0.0.1 copied to clipboard
Library Liveness helps detect between people and images.
This package helps to take photos by detecting whether it is a person or a photo.
Features #
Save the picture and show it. Results are people or figures Score Yaw Pitch Roll
Getting started #
Shoot with the user facing the camera and clear. Once verified, it will automatically save.
Usage #
Can be used for identity verification. can be used to check between people or images
<!--//#1 Define Permission Camera in AndroidManifest.xml-->
<uses-permission android:name="android.permission.CAMERA" />
//#2 Define MLLivenessCapture and information to be displayed
late MLLivenessCapture _capture;
Image? image;
bool? isLive;
dynamic score;
@override
void initState() {
super.initState();
_capture = MLLivenessCapture();
}
//#3 Create a function to press a button and display the result.
void _startRecognition() async {
MLLivenessCaptureResult? result =
await startRecognition(context, _capture);
if (result != null) {
setState(() {
isLive = result.isLive;
score = result.score;
image = Image.memory(
result.bitmap!,
fit: BoxFit.cover,
);
});
}
}
//#4 Create a button to take a photo.
@override
Widget build(BuildContext context) {
return Scaffold(
body: ElevatedButton(
style: buttonStyle(),
onPressed: _startRecognition,
child: const Text('Capture'),
),
);
}
Additional information #
Tell users more about the package: where to find more information, how to contribute to the package, how to file issues, what response they can expect from the package authors, and more.