Nuclear Package Magnet

    face-detector-polyfill

    0.1.0 • Public • Published

    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.

    Install

    npm i face-detector-polyfill

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • giladaya