Created
January 20, 2012 02:55
-
-
Save peterbraden/1644678 to your computer and use it in GitHub Desktop.
Face Detection in Node.JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cv = require('opencv') | |
var im = new cv.Image("./examples/test.jpg") | |
, face_cascade = new cv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml") | |
var faces = face_cascade.detectMultiScale(im, function(err, faces){ | |
for (var i=0;i<faces.length; i++){ | |
var x = faces[i] | |
im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2); | |
} | |
im.save('./out.jpg'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment