face detect test

This commit is contained in:
Peter Braden 2012-01-23 23:43:12 -08:00
parent a501f20f97
commit 94d4835134
2 changed files with 17 additions and 12 deletions

View File

@ -4,15 +4,3 @@ var cv = require('./lib/opencv')
console.log(cv.version)
//console.log(cv.readImage("./examples/t2.jpg").toBuffer());
var im = cv.readImage("./examples/t2.jpg")
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, 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');
});

View File

@ -100,6 +100,23 @@ vows.describe('Smoke Tests OpenCV').addBatch({
assert.ok(buf0);
//assert.equal(buf.toString('base64'), buf0.toString('base64'));
}
, "faceDetect": {
topic : function(){
var cv = require('../lib/opencv')
, im = cv.readImage("./examples/mona.jpg")
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, this.callback)
}
, "finds face": function(err, faces){
assert.isNull(err);
assert.isArray(faces);
assert.equal(faces.length, 1)
}
}
}