Permalink
Browse files

no faces was returning true

  • Loading branch information...
jonrohan committed Aug 27, 2012
1 parent 92d5dbe commit faa6292b522128aa66fe9cfcff994298298a1ee2
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/image.js
View
@@ -101,6 +101,7 @@ var faceApis = {
height: im.height(),
tags: tags
}
+ var dectected = false
function px(i) { return (i / photo.width) * 100 }
function py(i) { return (i / photo.height) * 100 }
function center(f) { return f && {x: px(f.x + (f.width / 2)), y: py(f.y + (f.height / 2))} }
@@ -116,6 +117,7 @@ var faceApis = {
cvDetect(im, 'FA2', function(err, faces) {
console.log(faces)
+ if (faces.length > 0) dectected = true
async.forEach(faces, function(face, callback) {
var scale = 1
while (face.width * scale < 100 || face.height * scale < 100) {
@@ -189,7 +191,7 @@ var faceApis = {
if (err) return callback(err)
console.log(tags)
- callback(null, {photos: [photo]})
+ callback(null, {photos: [photo], detected: dectected})
})
})
})
@@ -338,7 +340,7 @@ exports.mash = function(data, callback){
function(err, results) {
if (err) return callback(err)
- if (results.face.photos == null || results.face.photos[0] == null) return callback(null, null)
+ if (results.face.photos == null || results.face.detected == false) return callback(null, null)
var options = {
face: results.face,

0 comments on commit faa6292

Please sign in to comment.