Coder Social home page Coder Social logo

404shades / face_camera Goto Github PK

View Code? Open in Web Editor NEW

This project forked from conezi/face_camera

1.0 0.0 0.0 22.11 MB

A Flutter camera plugin that detects face in real-time

License: MIT License

Ruby 7.37% Objective-C 1.87% Kotlin 3.93% Dart 84.36% Swift 2.46%

face_camera's Introduction

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: 11.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());
}
  • Then render the component in your application setting the onCapture callback.
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SmartFaceCamera(
          autoCapture: true,
          defaultCameraLens: CameraLens.front,
          message: 'Center your face in the square',
          onCapture: (File? image){
            
          },
        )
    );
  }

Customization


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

Name Type Description
onCapture Function(File?) callback invoked when camera captured image
onFaceDetected Function(DetectedFace?) callback invoked when camera detects face
imageResolution ImageResolution used this to set image resolution
defaultCameraLens CameraLens used this to set initial camera lens direction
defaultFlashMode CameraFlashMode used this to set initial flash mode
enableAudio bool set false to disable caputre sound
autoCapture bool set true to capture image on face detected
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
orientation CameraOrientation use this to lock camera orientation
captureControlIcon Widget use this to render a custom widget for capture control
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

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 liking it on pub, staring in on Github and reporting any bugs you encounter.

face_camera's People

Contributors

conezi avatar geekyroan avatar

Stargazers

All in avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.