jQuery插件实现面部识别

jQuery Face Detection
一个非常有意思的jQuery插件能够自动实现图像画面的面部识别。
这个插件使用起来也非常的简单,你所需要做的就是在你的页面中粘帖下面代码
$(function() {
$('#detect').click(function() {
var coords = $('#demo img').faceDetection({
start:function(img) {
$('.face').remove();
$('#detect').text('Processing...');
},
complete:function(img, coords) {
$('#detect').fadeOut();
},
error:function(img, code, message) {
alert('Error '+code+': '+message);
}
});
for (var i = 0; i < coords.length; i++) {
$('<div>', {
'class':'face',
'css': {
'position': 'absolute',
'left': coords[i].positionX +'px',
'top': coords[i].positionY +'px',
'width': coords[i].width +'px',
'height': coords[i].height +'px'
}
})
.appendTo('#demo');
}
return false;
});
});
当你点击detect faces按钮的时候,插件就开始运行去识别面部。
还有需要做的就是包含进3个js文件,具体我就不多说了,都在下载的文件里面了。
