/js-objectdetect

computer vision in your browser - javascript real-time object detection

Primary LanguageJavaScriptMIT LicenseMIT

js-objectdetect

js-objectdetect is a javascript library for real-time object detection.

This library is based on the work of Paul Viola and Rainer Lienhart and compatible to stump based HAAR cascade classifiers used by the OpenCV object detector.

Watch this video for a short demonstration.

All modern browsers including IE 9+, Safari and Opera Mobile are supported.

Examples

js-objectdetect can be used for object detection, tracking and, in combination with mordern HTML5 features such as WebRTC, for all sorts of augmented reality applications that run in the browser without any plugin.

The following demos are available (Internet Explorer and iOS not supported):

gesture input Rotating a 3D object via hand gesture

gesture scroll Scrolling a website via hand gesture

glasses Trying out various sunglasses

Classifiers

js-objectdetect is compatible to stump based classifiers used by OpenCV. Classifiers for face, hand and eye detection are already included. More can be found on the web (classifier repository). However, not all classifiers have the same performance and some are quite sensitive to lighting conditions. Cascades have to be converted into the js-objectdetect format before usage. The cascade format is similar to that of tracking.js. Converters for old and new style OpenCV xml haarcascades are available.

Performance

The following list provides a runtime and detection performance comparison among current JavaScript face detection libraries. All test results have been acquired by applying either a 24x24 stump-based HAAR cascade or, in case of CCV, a 24x24 SURF cascade classifier with minimum step size on a single scale 80x80 image. Measured times are summed over 100 executions.

Last updated on February 7, 2015

Chrome 40 / FF 35 Detections per Second Detections Seconds
js-objectdetect 17.5 / 16.9 50 / 50 2.86 / 2.96
jsfeat1 9.4 / 6.3 30 / 30 3.18 / 4.75
tracking.js 7.7 / 8.97 48 / 48 6.24 / 5.35
Beyond Reality Face2 7.4 / 1.7 41 / 41 5.50 / 23.98
CCV3 2.2 / 4.4 8 / 8 2.22 / 1.80
js-objectdetect tracking.js jsfeat1 Beyond Reality Face2 CCV3
Detections Detections Detections Detections Detections

1 also auduno/clmtrackr, camgaze.js. Based on an older version of js-objectdetect.

2 Proprietary software, tested with v3.0.15. Fails to compile asm module in FF.

3 also jquery.facedetection, neave/face-detection, wesbos/HTML5-Face-Detection, auduno/headtrackr

Usage

Examples can be found in the repository. For documentation, refer to the JSDoc in the source files.

Download

License

js-objectdetect is distributed under MIT license. The included classifiers are subject to their own licenses.

Credits

Thanks to Audun Mathias Øygard (auduno) for his inspirational headtrackr library, Brandon Jones (toji) for his valuable javascript performance tipps, Nikos (foo123) for his port of JViolaJones on which the canny pruning algorithm is based on and tracking.js for the classifier format.