You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

face-detector-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

face-detector-polyfill

Polyfill for FaceDetector API

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
2
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

FaceDetector Polyfill

Polyfill for FaceDetector, part of shape detection api

Implementation

Uses the BBF object detector from JsFeat.

Note that currently landmarks are not detected.

Usage

In the browser

Install:

bower install face-detector-polyfill

Use:

<script>
  (function () {
    function loadScript(src, done) {
      var $script = document.createElement('script');
      $script.src = src;
      $script.onload = function() {
        done();
      };
      $script.onerror = function() {
        done(new Error('Failed to load script ' + src));
      };
      document.head.appendChild($script);
    }
    if (FaceDetector in window) {
      continueToStartTheApp();
    } else {
      loadScript(
        "bower_components/face-detector-polyfill/FaceDetector.min.js", 
        continueToStartTheApp
      );
    }
  })()
  // ...
</script>

With webpack

Install:

npm install --save face-detector-polyfill

Use:

if ('FaceDetector' in window) {
  continueToStartTheApp();
} else {
  require.ensure(['face-detector-polyfill'], function(require) {
    const FaceDetector = require('face-detector-polyfill');
    window.FaceDetector = FaceDetector;
    continueToStartTheApp();
  }, function(err) {
    console.log('Failed to load FaceDetector', err);
  });
}

Examples

See the examples folder, or live demo

Browser support

Requires Promises (can also be polyfilled) and typed arrays which are supported in all modern browsers, down to IE11.

Keywords

shape detect

FAQs

Package last updated on 03 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts