Code Monkey home page Code Monkey logo

haar.js's Introduction

HAAR.js Feature Detection Library for javascript (uses HTML5 canvas on browser and Canvas package on node.js)

based on Viola-Jones Feature Detection Algorithm using Haar Cascades

This is a port of OpenCV C++ Haar Detection (actually a port of JViolaJones which is a port of OpenCV for Java) to javascript and HTML5 canvas.

Haar.js

##Live Example http://foo123.github.com/examples/face-detection/

You can use the existing openCV cascades to build your detectors.

To do this just transform the opencv xml file to javascript using the haartojs java tool (in cascades folder)

example: ( to use opencv's haarcascades_frontalface_alt.xml run following command)

haartojs haarcascades_frontalface_alt

this creates a javascript file:
haarcascades_frontalface_alt.js
which you can include in your html file or node file

the variable to use in javascript is similarly
haarcascades_frontalface_alt

##ChangeLog

  • initial commit by Nikos M. (works on browser)
  • customization to work with node.js and require.js by maxired (using js closures)

##Usage Ideas

##Todo

  • optimize detector for real-time usage on browsers (eg. reference-> https://github.com/liuliu/ccv)
  • keep up with the changes in openCV cascades xml format

The Code works in the browser and inside node.js

##Runing inside the brower## Loading wth script tags You can run the example face.html or mouth.html inside your browser

##Running inside node## For running, the package have a dependency on canvas You can find an example inside examples/nodes.js Valide Output

node examples/node.js 
processing the picture
[{"x":102.5,"y":105.5,"width":160.66666666666666,"height":160.66666666666666}]

To work properly canvas need some system depencencies. You can find instruction on https://github.com/LearnBoost/node-canvas/wiki For example for Ubuntu :

sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev

##Loading with RequireJS ## As a third option, you can load the library with requireJS, both on the browser on with node. There is an example of loading with RequireJS inside node in examples/require.js. The configuration would be the same inside a browser

Complete source code
(note: the java source classes, which parse the openCV xml cascades, will be added to the project also)

Contributor Nikos M.
URL Nikos Web Development
URL Haar.js blog post
URL WorkingClassCode

Contributor maxired

haar.js's People

Contributors

joeyvanderbie avatar

Watchers

James Cloos avatar Loide Mara Verdes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.