Classifier resize image, new example

This commit is contained in:
Peter Braden 2012-08-24 13:17:37 -07:00
parent f855b2a332
commit c01ae532a6
2 changed files with 11 additions and 11 deletions

View File

@ -1,17 +1,17 @@
var cv = require('./lib/opencv')
, assert = require('assert')
, fs =require('fs')
//console.log(cv.version)
new cv.VideoCapture(0).read(function(mat){
cv.readImage("./examples/mona.png", function(err, im){
im.detectObject("./data/haarcascade_frontalface_alt.xml", {}, function(err, faces){
mat.resize(200,100)
mat.save('./out.jpg')
mat.detectObject("./data/haarcascade_frontalface_alt.xml", {min : [30,30]}, 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);
mat.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
}
im.save('./out.jpg');
});
console.log(faces.length ? (faces.length + " faces found") : "No faces")
mat.save('./out.jpg');
})
})

View File

@ -134,7 +134,7 @@ void AsyncDetectMultiScale(uv_work_t *req) {
equalizeHist( gray, gray);
baton->cc->cc.detectMultiScale(gray, objects, baton->scale, baton->neighbors, 0, cv::Size(baton->minw, baton->minh));
baton->cc->cc.detectMultiScale(gray, objects, baton->scale, baton->neighbors, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(baton->minw, baton->minh));
baton->res = objects;