Navigation Menu

Skip to content

Commit

Permalink
use better algorithms
Browse files Browse the repository at this point in the history
Use the ones recommended in FACE AND FACIAL FEATURE DETECTION EVALUATION
  • Loading branch information
wadey committed Aug 3, 2012
1 parent 335d42a commit 26292e2
Show file tree
Hide file tree
Showing 8 changed files with 167,642 additions and 8 deletions.
7,617 changes: 7,617 additions & 0 deletions cv/EP3.xml

Large diffs are not rendered by default.

23,550 changes: 23,550 additions & 0 deletions cv/FA2.xml

Large diffs are not rendered by default.

23,791 changes: 23,791 additions & 0 deletions cv/LE.xml

Large diffs are not rendered by default.

21,991 changes: 21,991 additions & 0 deletions cv/M1.xml

Large diffs are not rendered by default.

48,433 changes: 48,433 additions & 0 deletions cv/N2.xml

Large diffs are not rendered by default.

42,252 changes: 42,252 additions & 0 deletions cv/RE.xml

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions lib/image.js
Expand Up @@ -27,7 +27,7 @@ function cvDetect(im, name, callback) {
queue.push(arguments)
} else {
inUse = true
im.detectObject('./node_modules/opencv/data/'+name+'.xml', {min: [20, 20]}, function(err, faces) {
im.detectObject('./cv/'+name+'.xml', {min: [20, 20]}, function(err, faces) {
inUse = false
queue.forEach(function(args) {
process.nextTick(function() {
Expand Down Expand Up @@ -106,7 +106,7 @@ var faceApis = {
return imScaleMap[i]
}

cvDetect(im, 'haarcascade_frontalface_alt2', function(err, faces) {
cvDetect(im, 'FA2', function(err, faces) {
console.log(faces)
async.forEach(faces, function(face, callback) {
var scale = 1
Expand All @@ -123,12 +123,12 @@ var faceApis = {
var face2 = face
async.parallel(
{
eyeglasses: async.apply(cvDetectSub, fim, cut(face2, {height: 0.5}), 'haarcascade_eye_tree_eyeglasses'),
eyepair: async.apply(cvDetectSub, fim, cut(face2, {height: 0.6}), 'haarcascade_mcs_eyepair_small'),
eye_left: async.apply(cvDetectSub, fim, cut(face2, {width: 0.6}), 'haarcascade_righteye_2splits'),
eye_right: async.apply(cvDetectSub, fim, cut(face2, {x: 0.4, width: 0.6}), 'haarcascade_lefteye_2splits'),
mouth: async.apply(cvDetectSub, fim, cut(face2, {x: 0.3, width: 0.4, y:0.5, height: 0.8}), 'haarcascade_mcs_mouth'),
nose: async.apply(cvDetectSub, fim, cut(face2, {x: 0.2, width: 0.6, y: 0.2, height: 0.6}), 'haarcascade_mcs_nose'),
// eyeglasses: async.apply(cvDetectSub, fim, cut(face2, {height: 0.5}), 'haarcascade_eye_tree_eyeglasses'),
eyepair: async.apply(cvDetectSub, fim, cut(face2, {height: 0.6}), 'EP3'),
eye_left: async.apply(cvDetectSub, fim, cut(face2, {width: 0.6}), 'LE'),
eye_right: async.apply(cvDetectSub, fim, cut(face2, {x: 0.4, width: 0.6}), 'RE'),
mouth: async.apply(cvDetectSub, fim, cut(face2, {x: 0.3, width: 0.4, y:0.5, height: 0.8}), 'M1'),
nose: async.apply(cvDetectSub, fim, cut(face2, {x: 0.2, width: 0.6, y: 0.2, height: 0.6}), 'N2'),
},
function(err, results) {
if (err) return callback("Failed for: + face: " + (err.stack || err))
Expand Down
Binary file added public/image/test.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 26292e2

Please sign in to comment.