• 微信号:Zh-y9213
您当前的位置:爱资源分享网 > > 网站源码 > 网页特效

jQuery图片人脸识别代码

栏目:网页特效时间:2021-08-13 07:15阅读数:50人阅读
jQuery图片人脸识别代码是一款可以识别图片上人物脸部的jQuery插件,识别出来用正方形框选脸部标识。


js代码

<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/jquery.facedetection.js"></script> 
<script>
	/* global $ */
	$(function () {
		"use strict";
		
		$('#try-it').click(function (e) {
			e.preventDefault();

			$('.face').remove();

			$('#picture').faceDetection({
				complete: function (faces) {                        
					for (var i = 0; i < faces.length; i++) {
						$('<div>', {
							'class':'face',
							'css': {
								'position': 'absolute',
								'left':     faces[i].x * faces[i].scaleX + 'px',
								'top':      faces[i].y * faces[i].scaleY + 'px',
								'width':    faces[i].width  * faces[i].scaleX + 'px',
								'height':   faces[i].height * faces[i].scaleY + 'px'
							}
						})
						.insertAfter(this);
					}
				},
				error:function (code, message) {
					alert('Error: ' + message);
				}
			});
		});
	});
</script>


在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载

本站所有文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:737597453@qq.com