Skip to content

Instantly share code, notes, and snippets.

@peterbraden
Created January 20, 2012 02:55
Show Gist options
  • Save peterbraden/1644678 to your computer and use it in GitHub Desktop.
Save peterbraden/1644678 to your computer and use it in GitHub Desktop.
Face Detection in Node.JS
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