搜索插件、代码仓与 APP 分类

插件详情v0.1.4

face_camera

一个 Flutter 相机插件,可实时检测人脸。此外,它可以在检测到人脸时自动拍摄照片,这在进行 kyc 自拍时非常有用。

AndroidiOS
近 30 天下载
1370
喜欢数
216
Pub 分数
130

安装插件

flutter pub add face_camera

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

face_camera 包是一个 Flutter 插件,专为使用设备摄像头进行实时人脸检测而设计。当检测到人脸时,它会自动捕获图像,非常适合用于身份验证(KYC)过程中的自拍场景。该插件基于机器学习构建,可无缝集成到 Android 和 iOS 平台,为开发者提供了一种高效实现人脸感知相机功能的方法,无需复杂的设置。该插件简化了由面部存在触发的图像捕获流程,提升了身份验证工作流中的用户体验。

适合场景

  • KYC身份验证
  • 自动自拍捕捉
  • 应用程序中的实时人脸检测
  • 通过面部进行用户身份验证
  • 移动应用入门流程

主要特点

  • 实时人脸检测
  • 人脸检测时自动拍照
  • 跨平台支持(Android & iOS)
  • 与 Flutter 的轻量级集成
  • 用于面部触发捕捉的简单API

适合对象

  • 开发KYC应用的开发者
  • 需要自动自拍的应用程序
  • 身份验证系统
  • 基于面部交互的移动应用
  • 需要低代码人脸检测的项目

使用建议

  • 需要相机权限
  • 性能可能在旧设备上有所不同
  • 准确性取决于光照和面部可见性
  • 不适合高安全性的生物识别认证
  • 仅限人脸检测,不包括识别或跟踪

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

face_camera

A Flutter camera plugin that detects face in real-time.
Preview

Installation

First, add face_camera as a dependency in your pubspec.yaml file.

face_camera: ^<latest-version>
iOS

  • Minimum iOS Deployment Target: 15.5.0
  • Follow this link and setup ML Kit this is required for face_camera to function properly on iOS

Add two rows to the ios/Runner/Info.plist:

  • one with the key Privacy - Camera Usage Description and a usage description.
  • and one with the key Privacy - Microphone Usage Description and a usage description.

If editing Info.plist as text, add:

<key>NSCameraUsageDescription</key>
<string>your usage description here</string>
<key>NSMicrophoneUsageDescription</key>
<string>your usage description here</string>
Android

  • Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.
minSdkVersion 21
Usage

  • The first step is to initialize face_camera in main.dart
void main() async{
  WidgetsFlutterBinding.ensureInitialized(); //Add this

  await FaceCamera.initialize(); //Add this

  runApp(const MyApp());
}
  • Create a new FaceCameraController controller, setting the onCapture callback.
  late FaceCameraController controller;

  @override
  void initState() {
    controller = FaceCameraController(
      autoCapture: true,
      defaultCameraLens: CameraLens.front,
      onCapture: (File? image) {
        
      },
    );
  super.initState();
}
  • Then render the component in your application using the required options.
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SmartFaceCamera(
          controller: controller,
          message: 'Center your face in the square',
        )
    );
  }
Customization

Here is a list of properties available to customize your widget:

Name Type Description
controller FaceCameraController The controller for the [SmartFaceCamera] widget
showControls bool set false to hide all controls
showCaptureControl bool set false to hide capture control icon
showFlashControl bool set false to hide flash control control icon
showCameraLensControl bool set false to hide camera lens control icon
message String use this pass a message above the camera
messageStyle TextStyle style applied to the message widget
lensControlIcon Widget use this to render a custom widget for camera lens control
flashControlBuilder FlashControlBuilder use this to build custom widgets for flash control based on camera flash mode
messageBuilder MessageBuilder use this to build custom messages based on face position
indicatorShape IndicatorShape use this to change the shape of the face indicator
indicatorAssetImage String use this to pass an asset image when IndicatorShape is set to image
indicatorBuilder IndicatorBuilder use this to build custom widgets for the face indicator
captureControlBuilder CaptureControlBuilder use this to build custom widgets for capture control
autoDisableCaptureControl bool set true to disable capture control widget when no face is detected



Here is a list of properties available to customize your widget from the controller:

Name Type Description
onCapture Function(File?) callback invoked when camera captures image
onFaceDetected Function(DetectedFace?) callback invoked when camera detects face
imageResolution ImageResolution use this to set image resolution
defaultCameraLens CameraLens use this to set initial camera lens direction
defaultFlashMode CameraFlashMode use this to set initial flash mode
enableAudio bool set false to disable capture sound
autoCapture bool set true to capture image on face detected
ignoreFacePositioning bool set true to trigger onCapture even when the face is not well positioned
orientation CameraOrientation use this to lock camera orientation
performanceMode FaceDetectorMode Use this to set your preferred performance mode
Contributions

Contributions of any kind are more than welcome! Feel free to fork and improve face_camera in any way you want, make a pull request, or open an issue.

Support the Library

You can support the library by donating, liking it on Pub, starring it on GitHub, and reporting any bugs you encounter.

💖 Show Love on Selar

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。