Need private packages and team management tools?Check out npm Teams »

jquery-facedetection

1.0.0 • Public • Published

jquery-facedetection

browserify-compatible fork of @jaysalvat's jquery.facedetection -- a jQuery plugin to detect faces on an image, video, or canvas -- based on an algorithm by @liuliu

install

npm i --save jquery-facedetection

usage

import $ from 'jquery'
import faceDetection from 'jquery-facedetection'
faceDetection($)
 
$('#picture').faceDetection({
  complete: function (faces) {
    console.log(faces);
  }
})

returns an array of found faces object:

  • x — x coord of the face in the picture
  • y — y coord of the face in the picture
  • width — width of the face
  • height — height of the face
  • positionx — x position relative to the document
  • positiony — y position relative to the document
  • offsetx — x position relative to the offset parent
  • offsety — y position relative to the offset parent
  • scalex — ratio between original image width and displayed width
  • scaley — ratio between original image height and displayed height
  • confidence — level of confidence

settings

  • interval — interval (default 4)

  • minneighbors — minimum neighbors threshold which sets the cutoff level for discarding rectangle groups as face (default 1)

  • confidence — minimum confidence (default null)

  • async — async mode if worker available (default false). the async mode uses workers and needs the script to be on the same domain.

  • grayscale — convert to grayscale before processing (default true)

  • complete — callback function trigged after the detection is completed

      complete: function (faces) {
          // ...
      }
  • error — callback function trigged on errors

      error: function (code, message) {
          // ...
      }

Install

npm i jquery-facedetection

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar