一、百度智能雲
申請離線采集SDK
內部應用人臉識別應用,通過使用人臉識別功能模塊,能快速識別用戶身份,達到快速響應業務的需求和使用便捷
申請離線識別SDK
等待離線識別SDK申請通過
等待離線采集SDK
配置License
MD5簽名
操作方法
1)將apk修改后綴為 .rar文件后解壓;
2) 進入解壓后的META-INF目錄,該目錄下會存在文件CERT.RSA
3) 在該目錄下打開cmd,輸入命令 :keytool -printcert -file CERT.RSA
填寫信息
生成並下載
模塊商城的模塊+自定義授權模塊=完整的百度人臉采集sdk 參考gou哥的 https://github.com/52yaoer/baiduFaceLiveLicense
效果展示:
二、自定義模塊上傳
一、 更改壓縮包zip格式
二、 上傳
三、提示
四、更改
五、效果如下
保證打包的授權模塊里面的jar正確。上傳自定義模塊后並添加到app
三、配置調試
主要是參考填寫配置文件,其他操作我們已經做完了
參考帖子如下
提交配置文件,重新自定義load 測試
我的展示效果如下
前端代碼:
<!DOCTYPE html> <html> <head> <title>Module Develop</title> <meta charset="utf-8"> <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" /> <style type="text/css"> html, body { height: 100% } body { background-color: #fff; margin: 0; } #wrap { height: 100%; position: relative; } #header { padding-top: 20px; background-color: #5082c2; height: 44px; position: relative; } #header h1 { font-size: 20px; height: 44px; line-height: 44px; margin: 0em; color: #fff; margin-left: 100px; margin-right: 100px; text-align: center; } #main { display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-pack: center; } a.button { display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-pack: center; -webkit-box-align: center; height: 32px; margin: 8px; background-color: rgba(240, 240, 240, 1.0); border-color: rgba(220, 220, 220, 1.0); border-width: 2px; border-style: solid; } a.active { background-color: rgba(240, 240, 240, 0.7); } </style> </head> <body> <div id="wrap" style="margin-top:100px;"> <div id="main"> <a class="button" tapmode="active" onclick="requestPermission()">相機權限(系統API)</a> <a class="button" tapmode="active" onclick="openFaceDetectView()">打開人臉識別界面</a> <a class="button" tapmode="active" onclick="continueFaceDetect()">識別結果處理后繼續人臉識別</a> <a class="button" tapmode="active" onclick="closeFaceDetectView()">關閉人臉識別界面</a> </div> </div> </body> <script type="text/javascript"> var demo = null; apiready = function() { demo = api.require('baiduFaceLive'); if (!demo) { alert("請添加模塊后編譯"); return; } } function requestPermission() { api.requestPermission({ list: ['camera'], }, function(ret, err) { api.alert({ msg: JSON.stringify(ret) }); }); } function openFaceDetectView() { demo.openFaceDetectView({ rect: { x: 0, y: 0, //w : api.frameWidth, //h : api.frameHeight, }, fixedOn: api.frameName, fixed: true, isSound: false, defaultUI: false, isShowRectLine: true }, function(ret, err) { if (ret.evenType == 'success') { alert(ret.data.bestImage); console.log("人臉識別:", JSON.stringify(ret)); console.log("人臉識別結果:", ret.data.bestImage); } else { api.toast({ msg: JSON.stringify(ret) + " " + JSON.stringify(err) }); } }); } function continueFaceDetect() { demo.continueFaceDetect(function(ret, err) { //alert(JSON.stringify(ret)); }); } function closeFaceDetectView() { demo.closeFaceDetectView(function(ret, err) { //alert(JSON.stringify(ret)); }); } </script> </html>
結果如下
這個是采集識別拿到圖片。然后可以把圖片提交到服務端,用百度api的認證接口進行識別認證
然后再次查看
離線識別SDK根本沒用上,不需要