

Face Detection in JavaScript via Canvas - CWIZO
http://badassjs.com/post/1461943420/face-detection-in-javascript-via-html5-canvas

======
jbail
Here is the face detection demo I ran:
[http://liuliu.me/detect/detect.html#http%3A%2F%2Fimg.dailyma...](http://liuliu.me/detect/detect.html#http%3A%2F%2Fimg.dailymail.co.uk%2Fi%2Fpix%2F2008%2F03_02%2FnicolebatLL_1000x895.jpg)

(press the Detect button when the page loads)

That is impressive.

------
mayanklahiri
The blog post is a little light on details. Just go to the source and demo on
the original creator's site: <http://liuliu.me/detect/detect.html>

Canvas allows access to individual pixels in an image, and JS is arguably
faster than BASIC interpreters of the 80s. Fun things lie ahead in client-side
image processing.

EDIT: Incidentally, the code is pretty hairy and has about 3 comments. It's
hard to figure out what ML approach he's using from a cursory look.

EDIT: Aah, definitely an image pyramid in there, so some multi-resolution
stuff happening.

------
yatsyk
<http://squidder.com/face/> \- real time face detection with flash

------
templaedhel
It seems to on average get about half the faces.
[http://liuliu.me/detect/detect.html#http%3A%2F%2Fwww.alexrei...](http://liuliu.me/detect/detect.html#http%3A%2F%2Fwww.alexreisner.com%2Fimg%2Fbaseball%2Ffaces.reisner.gif)
[http://liuliu.me/detect/detect.html#http%3A%2F%2Fkk.org%2Fct...](http://liuliu.me/detect/detect.html#http%3A%2F%2Fkk.org%2Fct2%2FFaceSw2.jpg)
It recognizes upside down faces though, which is impressive.
[http://liuliu.me/detect/detect.html#http%3A%2F%2Fwww.scifun....](http://liuliu.me/detect/detect.html#http%3A%2F%2Fwww.scifun.ed.ac.uk%2Fpages%2Fabout_us%2Fshows%2FJennifer_Lopez-
upside-down-face.jpg) Overall, a great demo.

------
callmeed
I did this one:
[http://liuliu.me/detect/detect.html#http://antikewl.com/dail...](http://liuliu.me/detect/detect.html#http://antikewl.com/daily/wp-
content/uploads/2007/12/stevejobs19751.jpg)

And it only detected Jobs, but not Woz ...

------
abeppu
Trouble with false positives :
[http://liuliu.me/detect/detect.html#http%3A%2F%2Ffarm1.stati...](http://liuliu.me/detect/detect.html#http%3A%2F%2Ffarm1.static.flickr.com%2F25%2F95283121_f300f7d188_o.jpg)

~~~
kevin_morrill
Some of the bricks look like the Face on Mars :) <http://bit.ly/aWTgzA>

------
elliottcarlson
There already is a Facebook app to aide in tagging photos by detecting faces:

<http://apps.facebook.com/photo-finder/>

It's actually quite accurate too...

------
abi
I don't know too much about face detection, can you anyone tell which
algorithm the author is using? It doesn't work on a lot of pictures so I was
wondering if this is the best face detection algorithm available?

~~~
apu
I didn't look at the source in detail, but almost all face detection systems
today (including those implemented in hardware in cameras) use a variant of
Viola and Jones' Haar-Like Cascade Detector [1].

The major exception is work from CMU and PittPatt [2], which uses Neural
Networks [3].

[1] [http://en.wikipedia.org/wiki/Viola-
Jones_object_detection_fr...](http://en.wikipedia.org/wiki/Viola-
Jones_object_detection_framework)

[2] <http://www.pittpatt.com/>

[3] <http://vasc.ri.cmu.edu/NNFaceDetector/>

~~~
liuliu
I doubt that PittPatt uses NN. Here is the reference I found:

Feature-Centric Evaluation for Efficient Cascaded Object Detection, Henry
Schneiderman

Maybe Schneiderman himself can clarify this :)

~~~
apu
Ah good point. I forgot that he had his own method, separate from Takeo's.

------
albertzeyer
Doesn't really seem to work that good on pictures with more objects on it.

------
akivabamberger
It's pretty sweet. I wrote qoobster.com/bieber to get Antoine Dodson's sweet
headband instead of that silly red square plastered on my friends.

~~~
devongovett
haha, nice!

