I was trying to write a program which would take pictures from the baby monitor and then detect face using OpenCV. I wanted to add other functionalities based on that. The problem is that it is not able to detect a face very often. The problem may be because in the pictures I ma using, the baby is something eating his hand :P. I wanted to write a program which could find out if the baby had rolled over or had a blanket over his head. Any suggestions for tackling this problem? Will training OpenCV with multiple pictures help my case. Here is the sample program. Although written in nodejs, logic should be the same. Is there some other library/algorithm/approach that can help me achieve this?
var request = require('request');
var cv = require('opencv');
var user = 'admin';
var pass = 'password';
var options = {
url : 'http://192.168.86.114/cgi-bin/snapshot.cgi',
method : 'GET',
port: 80,
encoding: 'binary',
headers: { 'Authorization': 'Basic ' + new Buffer(user + ':' + pass).toString('base64') }
}
request( options, function(err, res, html){
if(err){
console.log(err)
return
}
require("fs").writeFile("./pictures/out.jpeg", res.body,'binary', function(err) {
console.log(err);
cv.readImage("./pictures/out.jpeg", function(err, im){
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);
}
im.save('./out.jpg');
});
})
});
})
Try MTCNN. It is fast and robust.