Skip to main content

Face Detection Libraries in Android

Android Face Detection Libraries. Detect faces in your android app easily.

(a). Face Detector

This is an Android library that makes it easy to detect faces in images and video streams. It uses MLKit's face detection API to identify faces in real-time. This library can be easily integrated into any camera API that provides a way to process its frames.

It was built to simplify face detection in Android applications. It provides a lightweight and easy-to-use solution for applications that require face detection functionality.

It is built on top of MLKit's face detection API. It provides a simple interface for detecting faces and displaying bounding boxes around them. The library is designed to be easily integrated into any camera API and is built with performance in mind.

Here is a demo screenshot:

Installation

Specify the following in your root build.gradle;

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Then Add the dependency:

implementation 'com.github.husaynhakeem:android-face-detector:2.0'

How can I use Face Detector in my Android application?

To use Face Detector, you need to follow these 2 easy steps. First, you need to add a FaceBoundsOverlay on top of your camera view.

<FrameLayout
...>

// Any other views

<CameraView
... />

<husaynhakeem.io.facedetector.FaceBoundsOverlay
... />

// Any other views

</FrameLayout>

Then you need to define a FaceDetection instance and connect it to your camera.

val faceDetector = FaceDetector(facesBoundsOverlay)
cameraView.addFrameProcessor {
faceDetector.process(Frame(
data = it.data,
rotation = it.rotation,
size = Size(it.size.width, it.size.height),
format = it.format,
lensFacing = cameraView.facing))
}

Are there any prerequisites for using Face Detector?

Yes, your camera API must provide a way to process video frames. If your camera API does not provide this functionality, then you will not be able to use Face Detector.

If you are an Android developer that needs to implement face detection functionality in your application, then Face Detector is a great choice. It is lightweight, easy to use, and provides real-time face detection capabilities. You can download it today and start integrating it into your application with ease. To learn more, visit the following link: https://github.com/husaynhakeem/android-face-detector