Code Monkey home page Code Monkey logo

pidroid's Introduction

Logo

Pidroid


Forks Stargazers Issues MIT License LinkedIn

Table of Contents

About the Project

Logo

Pidroid is android library to perform fast face detection, pupil detection and landmarks detection without third-party dependencies dependencies.

Motivation

This library has been developed to facilitate the integration of a face detection method in your Android application.

Usually, to install a face detection library, some integration with third-party software such as OpenCV or Tensorflow Lite or registration on a platform such as Firebase is necessary.

On the other hand, the weight of face detection models is usually high, which causes the application to grow unnecessarily.

Pidroid provides a completely dependency-free alternative to make it easier for developers to use these libraries.

Built With

This library currently is full developed in Kotlin with C++, no additional dependencies or installation is needed :)

Logo

Roadmap

  • High speed processing
  • Does not require additional dependencies
  • There is no need for image preprocessing prior detection
  • Face detection
  • Pupil detection
  • Landmarks detection
  • Pure Java Pidroid (to delete avoid Kotlin dependency)
  • Publish Library as Github Package
  • Rotated faces detection
  • Neon support
  • SSE support

Usage

Local implementation

First, right click on your app module and click on Open Module Settings.

Logo

Now, click on + button above app module. The following window will open:

Logo

Then click on Import .JAR/.AAR Package and select pidroid-release.aar module. Your project look like this:

Logo

Finally, add the following line to your build.gradle of the app module:

implementation project(path: ':pidroid-release')

Your app's build.gradle look like this:

Logo

Gradle implementation

Still in progress..

Usage

Basic usage

Pidroid library provides singleton object called "Pidroid". First, you need setup library in your Activity onCreate.

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(...)

		// Do some stuff...

        val pidroidConfig = PidroidConfig()
        Pidroid.setup(this, pidroidConfig)
    }

After setup finish, you can call detectFace function like this (example with Bitmap):

fun callDetectFace(bitmap: Bitmap): FaceDetectionResult {
        val pixels = IntArray(bitmap.width * bitmap.height * 4)
        bitmap.getPixels(pixels, 0, bitmap.width, 0, 0, bitmap.width, bitmap.height)
        var dInfo = FaceDetectionResult()
        Pidroid.detectFace(pixels, bitmap.width, bitmap.height, dInfo)
        return dInfo
    }

Parameters

All configuration parameters are in PidroidConfig class.

Parameter name Description Default value
minsize Min radius of faces detected 150
maxsize Max radius of faces detected 1000
prominentFaceOnly Parameter that determines if you want to return only the most predominant face False
clustering This parameter groups detections to prevent a face from being detected multiple times True
stridefactorWidth This parameter determines how many pixels the sliding window is moved to detect. For example, if the value is 0.1 and the image is 1000 pixels wide, the sliding window will move every 100 pixels. 0.1
stridefactorHeight Same as stridefactorWidth but for height 0.1
scalefactor The PICO algorithm searches for different face sizes starting from minsize to maxsize. This parameter determines how much the search size increases each iteration. 1.1
qthreshold Minimum threshold to consider a region as a face. 3.0
perturbs The detection of pupils and landmarks, start from an initial region to predict the exact position. This initial region is disturbed N times to increase the precision of detection. This also makes the method slower the larger this parameter grows. 10
pupilDetectionEnable This parameter enable pupil detection True
landmarkDetectionEnable This parameter enable landmark detection. Its mandatory pupilDetectionEnable to True to detect landmarks. True

Examples

In this project you will find two sample applications. The first is a simple application that performs the prediction on a bitmap and draws the result.

The second opens the camera and performs face, pupil and landmark detection in real time using a separate Thread so as not to block the UI.

Image demo

Still in progress..

Real Time demo

Logo

Still in progress..

Author

License

Copyright © 2021 Adrián Suárez Parra (Suaro)

This software is distributed under the MIT license. See the LICENSE file for the full license text.

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.