npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-facedetection-lite

v0.3.5

Published

A face detection offline with a few lines of code. Was designed to run on old smartphones.

Downloads

20

Readme

Cordova Plugin Face Detection - LITE

Plugin for facial detection in real-time and off-line, extremely lite. It is designed to run on old smartphones. This plugin implemented the method described in [2013 by Markuš et al] (http://arxiv.org/abs/1305.4537).

PS: For older smartphones, it is ideal that each frame reviewed has a maximum height and width of 60 pixels and the processing cycle runs every 100 milliseconds or more. In the sample project, this was implemented.

Installation

This plugin can be used on the iOS, Android, Electron and Browser platforms;

cordova plugins add cordova-plugin-facedetection-lite

Methods

initFaceDetection(sizeFrameMemory, faceFinderPath, resultCallback)

  • sizeFrameMemory - Number of frames that will be used to reinforce the detection of all faces. Defaults to 5
  • faceFinderPath - Facial training file location, being allowed offline. Defaults to cascades/facefinder
  • resultCallback - Callback function
Code:
facedetection.initFaceDetection(5, "./facefinder", function (result) {
    /* Here you can create the loop to detect frames */
});

Warning: Until the current version, the parameters are being ignored on some platforms, being ixed default value in the code.

detections(rgba, width, height, minSizeFace, maxSizeFace, iouthreshold, resultCallback)

  • rgba - Image in byte array
  • width - Image width
  • height - Image height
  • minSizeFace - Minimum size of selected faces
  • maxSizeFace - Minimum size of selected faces
  • iouthreshold - Maximum size of selected faces
  • resultCallback - Callback function
Code:
facedetection.detections(rgba, cameraWidth, cameraHeight, cameraWidth * 0.2, cameraWidth * 1.2, 0.1, function (dets) {
    for (i = 0; i < dets.length; ++i) {
        var box = dets[i];

        var canvasPreviewCtx = canvasPreview.getContext('2d');
        canvasPreviewCtx.beginPath();
        canvasPreviewCtx.arc(box[1], box[0], box[2] / 2, 0, 2 * Math.PI, false);
        canvasPreviewCtx.lineWidth = 1;
        canvasPreviewCtx.strokeStyle = 'red';
        canvasPreviewCtx.stroke();
    }
});

Warning: Until the current version, only the first 3 parameters are implemented and the rest of the parameters are being ignored on some of the platforms, being fixed default value in the code.

Sample App

cordova-sample-facedetection for a complete working Cordova example for Android, iOS and Browser platforms.

Task List

  • [x] Basic structure of the plugin;
  • [x] Add PicoJS library to the Browser
  • [x] Compile Pico library in C for iOS
  • [x] Compile Pico library in C for Android
  • [ ] Process dynamic path to training file
  • [ ] Process dynamic parameters when calling each function

Development

If you intend to do some improvement in the project, follow some instructions, such as compiling library in the C language.

Recompiling libraries

If you modify the C source files, be sure to re-build the compiled libraries.

Android

You can re-build the libpicornt.so binaries using the ndk-build script.

To do so:

  • Install Android NDK as instructed here
  • Add the NDK install path to your path environment variable
    • By default it's installed under $ANDROID_SDK_HOME/ndk-bundle
    • e.g. export PATH=$PATH;$ANDROID_SDK_HOME/ndk-bundle
  • Set the ANDROID_NDK_HOME environment variable to your NDK install path
    • e.g. export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
  • Open terminal in plugin root folder
  • Run ./compile-android (compile-android.cmd on Windows)

iOS

If you modify the C source code in common/picornt/ you'll need to rebuild the static library and headers in src/ios/libs.

  • Open terminal in plugin root folder
  • Run ./compile-ios

Credits

Created by Luís De Marchi @luisdemarchi - Linkedin

Libraries used: