• java实现人脸识别源码【含测试效果图】——前台显示层(index.jsp)


    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>人脸注册</title>
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript">
         		function CatchCode() {
              //实际运用可不写,测试代 , 为单击拍照按钮就获取了当前图像,有其他用途
              var canvans = document.getElementById("canvas");
              var video = document.getElementById("video");
              var context = canvas.getContext("2d");
     
              canvas.width = video.videoWidth;
              canvas.height = video.videoHeight;
              context.drawImage(video,0,0);
              
              var imgData = canvans.toDataURL();
    			//获取图像在前端截取22位以后的字符串作为图像数据
    			var imgData1 = imgData.substring(22);
    			
    			var username = $("#username").val();
    			$.ajax({
    					type: "post",
    					url: "FaceServlet?tag=reg",
    					data: {"img":imgData1,"username":username},
    					success: function(data){
    						alert(data);
    					},error:function(msg){
    						alert("错误");
    					}
    				});
    				
      				
          }
         		
         </script>
    </head>
    <body>
    	<h2>注册</h2>
    	用户名:
    	<input type="text" name="username" id="username" />
    	<br /> 录入头像:
    	<div id="support"></div>
    	<div id="contentHolder">
    		<video id="video" width="120" height="90"
    			style="border:1px solid red;border-radius: 800px;" autoplay></video>
    
    		<canvas style="border:1px solid red;border-radius: 800px;120px;height:80px;"
    			id="canvas"></canvas>
    	</div>
    	<br />
    	<input type="button" value="确认" id="snap" />
    	<br />
    	<a href="login.jsp">点击登陆</a>
    </body>
    </html>

  • 相关阅读:
    Solution to LeetCode Problem Set
    《Cracking the Coding Interview》读书笔记
    诗词收集——用于人文素养扫盲
    2015年清华大学计算机系考研总结
    编程知识大杂烩
    hihoCoder 1175:拓扑排序二
    Hackerrank
    Hackerrank
    LeetCode
    LeetCode
  • 原文地址:https://www.cnblogs.com/a1111/p/12816162.html
Copyright © 2020-2023  润新知