Permalink
Browse files

Add shortcut for face cascade file -> cv.FACE_CASCADE

  • Loading branch information...
1 parent 3a7469f commit 0bb7fe99187e6d11f83c89ef3c8cebc04256993f @peterbraden committed Feb 26, 2013
Showing with 11 additions and 3 deletions.
  1. +2 −1 README.md
  2. +8 −1 lib/opencv.js
  3. +1 −1 test/unit.js
View
@@ -29,7 +29,7 @@ Or to build the repo:
cv.readImage("./examples/test.jpg", function(err, im){
- im.detectObject("./data/haarcascade_frontalface_alt.xml", {}, function(err, faces){
+ im.detectObject(cv.FACE_CASCADE, {}, 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);
@@ -117,6 +117,7 @@ detection. This can be used for face detection etc.
mat.detectObject(haar_cascade_xml, opts, function(err, matches){})
+For convenience in face recognition, cv.FACE_CASCADE is a cascade that can be used for frontal face recognition.
Also:
View
@@ -1,6 +1,7 @@
var Stream = require('stream').Stream
, Buffers = require('buffers')
- , util = require('util');
+ , util = require('util')
+ , path = require('path')
var bindings = require('./bindings')
@@ -67,3 +68,9 @@ imagestream.end = function(b){
});
}
+
+// Provide cascade data for faces etc.
+
+cv.FACE_CASCADE = path.resolve('../data/haarcascade_frontalface_alt.xml')
+
+
View
@@ -179,7 +179,7 @@ vows.describe('Smoke Tests OpenCV').addBatch({
, cb = this.callback
cv.readImage("./examples/mona.png", function(err, im){
- im.detectObject("./data/haarcascade_frontalface_alt.xml", {}, cb)
+ im.detectObject(cv.FACE_CASCADE, {}, cb)
})
}

0 comments on commit 0bb7fe9

Please sign in to comment.