A jQuery/Zepto plugin to detect faces on images, videos and canvases to get theirs coordinates.
Importante note: This plugin uses an algorithm by Liu Liu.
Website and demo here:
http://facedetection.jaysalvat.com/
Download the plugin with the method of your choice.
Download the last release manually
Or install it with Bower.
bower install jquery.facedetection
Or install it with NPM.
npm install jquery.facedetection
Include jQuery and the plugin.
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="path/to/dist/jquery.facedetection.min.js"></script>
Set a picture with some faces in your HTML page.
<img id="picture" src="img/face.jpg">
Apply the plugin to this image and get the face coordinates.
<script>
$('#picture').faceDetection({
complete: function (faces) {
console.log(faces);
}
});
</script>
Returns an array of found faces object:
interval — Interval (default 4)
minNeighbors — Minimum neighbors threshold which sets the cutoff level for discarding rectangle groups as face (default 1)
confidence — Minimum confidence (default null)
async — Async mode if Worker available (default false). The async mode uses Workers and needs the script to be on the same domain.
grayscale — Convert to grayscale before processing (default true)
complete — Callback function trigged after the detection is completed
complete: function (faces) {
// ...
}
error — Callback function trigged on errors
error: function (code, message) {
// ...
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。