android-yoonit-facefy
                                
                                 android-yoonit-facefy copied to clipboard
                                
                                    android-yoonit-facefy copied to clipboard
                            
                            
                            
                        The face detection's module for Android with a lot of awesome features
Android Yoonit Facefy
	
	
| ◻ Google MLKit integration ◻ PyTorch integration ◻ Computer vision pipeline ◻ Face detection ◻ Face contours ◻ Face expressions ◻ Face movement |   | 
Table of Contents
- Installation
- Usage
- API
- Methods
- FaceDetected
- Head Movements
 
 
- To contribute and make it better
Installation
Add the JitPack repository to your root build.gradle at the end of repositories
allprojects {
	repositories {  
	... 
	maven { url 'https://jitpack.io' }
	} 
}  
Add the dependency
dependencies {
	implementation 'com.github.Yoonit-Labs:android-yoonit-facefy:master-SNAPSHOT'
}
Usage
This is a basic usage to the FacefyYoonit.
Feel free to use the demo.
import ai.cyberlabs.yoonit.facefy.Facefy
...
    fun example(inputBitmap: Bitmap) {
        Facefy()
            .detect(
                inputBitmap,
                { faceDetected ->
                    val boundingBox: Rect = faceDetected.boundingBox
                    val contours: MutableList<PointF> = faceDetected.contours
                    val headEulerAngleX: Float = faceDetected.headEulerAngleX
                    val headEulerAngleY: Float = faceDetected.headEulerAngleY
                    val headEulerAngleZ: Float = faceDetected.headEulerAngleZ
                    val leftEyeOpenProbability: Float? = faceDetected.leftEyeOpenProbability
                    val rightEyeOpenProbability: Float? = faceDetected.rightEyeOpenProbability
                    val smilingProbability: Float? = faceDetected.smilingProbability
                },
                { errorMessage ->
                    val mesage: String = errorMessage
                },
                {
                    // Process completed.
                }       
            )
    }
API
Methods
| Function | Parameters | Return Type | Description | 
|---|---|---|---|
| detect | inputBitmap: Bitmap, onSuccess: (FaceDetected) -> Unit, onError: (String) -> Unit | void | Detect a face from bitmap and return the result in the FaceDetectedas a closure. | 
FaceDetected
| Attribute | Type | Description | 
|---|---|---|
| leftEyeOpenProbability | Float? | The left eye open probability. | 
| rightEyeOpenProbability | Float? | The right eye open probability. | 
| smilingProbability | Float? | The smiling probability. | 
| headEulerAngleX | Float | The angle that points the rotation of the face about the horizontal axis of the image. HeadMovements | 
| headEulerAngleY | Float | The angle that points the "left-right" head direction. See HeadMovements | 
| headEulerAngleZ | Float | The angle that points the rotation of the face about the axis pointing out of the image. HeadMovements | 
| contours | Mutablelist<PointF> | List of Points that represents the shape of the recognized face. | 
| boundingBox | Rect | The face bounding box. | 
Head Movements
Here we explaining the above gif and how reached the "results". Each "movement" (vertical, horizontal and tilt) is a state, based in the angle in degrees that indicate head direction;
| Head Direction | Attribute | v < -36° | -36° < v < -12° | -12° < v < 12° | 12° < v < 36° | 36° < v | 
|---|---|---|---|---|---|---|
| Vertical | headEulerAngleX | Super Down | Down | Frontal | Up | Super Up | 
| Horizontal | headEulerAngleY | Super Left | Left | Frontal | Right | Super Right | 
| Tilt | headEulerAngleZ | Super Right | Right | Frontal | Left | Super Left | 
To contribute and make it better
Clone the repo, change what you want and send PR. For commit messages we use Conventional Commits.
Contributions are always welcome!
Code with ❤ by the Yoonit Team
