位置: IT常识 - 正文

UNI-APP 人脸识别分析及实现(前端)(unik面部识别怎么用)

编辑:rootadmin
UNI-APP 人脸识别分析及实现(前端) APP开发一个人脸识别,实现刷脸功能实现流程:

推荐整理分享UNI-APP 人脸识别分析及实现(前端)(unik面部识别怎么用),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:uniapp人脸识别打卡,uniapp人脸识别登录,uniapp人脸识别身份证,uniapp人脸识别方案,uniapp人脸识别上传,uniapp人脸识别上传,uniapp人脸识别上传,uniapp人脸识别方案,内容如对您有帮助,希望把文章链接给更多的朋友!

UNI-APP 人脸识别分析及实现(前端)(unik面部识别怎么用)

1、打开摄像头——自动读取照片——传输给后端——后端交由第三发或自主开发来识别——返回结果(相识度比) 2、打开摄像头——自动读取视频——传输给后端——后端通过解析视频,截取图片交由第三发或自主开发来识别——返回结果(相识度比) 通过分析,只需要做两步骤:打开摄像头和自动读取视频或照片

打开摄像头

分步骤分析:打开摄像头,并展示视频效果在html上,目前有两种方式: 1、使用camera组件进行,借用.createcameracontext()对象来打开摄像头(由于平台差异,uniapp不能在App、H5、支付宝/字节跳动/飞书/360小程序中使用) 2、通过livepusher对象(直播推流技术)实现视频预览和截屏 现在就有两种获取推流的方式了:第一种是nvue开发,第二种vue开发 如果是nvue开发,可以直接使用live-pusher组件进行直播推流,如果是vue开发,则需要使用h5+的plus.video.LivePusher对象来获取

使用NVUE来开发人脸识别

实际实现流程:调用手机摄像头创建直播推流 → 自动截图 → 压缩图片为base64格式→ 上传图片到服务器 → 服务器调用阿里人脸api → 阿里api返回该图片与底图的相似度

html部分<template> <view><div class="custom" :style="{height: CustomBar+'px'}"><view class="navcontent" :style="[{top:statusBar + 'px'}]"><text style="color: #FFFFFF;font-size: 16px;line-height: 45px;" class="iconfont icon-xiangzuo" @click="BackPage">返回</text><text style="color: #FFFFFF;font-size: 16px;line-height: 45px;">人脸识别</text><text></text></view></div> <div class="livefater"><div style="width: 350px;height: 350px;border-radius: 350px;overflow: hidden;background-color: #CCCCCC;"><live-pusher id='livePusher' ref="livePusher" class="livePusher" url=""mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2"aspect="1:1" @statechange="statechange" @netstatus="netstatus" @error = "error"></live-pusher></div><cover-image src="../static/image/gai.png" class="gaiimg"></cover-image></div> <button class="btn" @click="startPreview">打开摄像头进行人脸识别</button> </view></template>js部分 export default { data: { fil: true,imgList:[""],statusBar:'',CustomBar: 0 },onLoad(){// this.startPreview()}, onReady() { // 注意:需要在onReady中 或 onLoad 延时 this.context = uni.createLivePusherContext("livePusher", this);var that = thisuni.getSystemInfo({ success:function(e){ // 计算导航栏高度that.statusBar = e.statusBarHeight // #ifndef MP if(e.platform == 'android') { that.CustomBar = e.statusBarHeight + 50 }else { that.CustomBar = e.statusBarHeight + 45 } console.log(that.statusBar)// #endif // #ifdef MP-WEIXIN let custom = wx.getMenuButtonBoundingClientRect() that.CustomBar = custom.bottom + custom.top - e.statusBarHeight // #endif // #ifdef MP-ALIPAY that.CustomBar = e.statusBarHeight + e.titleBarHeight // #endif }}) }, methods: {Timer(){}, statechange(e) { console.log("statechange:" + JSON.stringify(e)); }, netstatus(e) { console.log("netstatus:" + JSON.stringify(e)); }, error(e) { console.log("error:" + JSON.stringify(e)); }, start: function() { this.context.start({ success: (a) => { console.log("livePusher.start:" + JSON.stringify(a)); } }); }, close: function() { this.context.close({ success: (a) => { console.log("livePusher.close:" + JSON.stringify(a)); } }); },// 拍照事件 snapshot: function() {var that = this this.context.snapshot({ success: (e) => { console.log(JSON.stringify(e));that.getMinImage(e.message.tempImagePath) } }); },// 开启摄像头 startPreview() {console.log("1")var that = this this.context.startPreview({ success: (a) => { console.log("livePusher.startPreview:" + JSON.stringify(a));that.Timer = setInterval(function(){that.snapshot()if(that.imgList.length>3){console.log("3")clearInterval(that.Timer)}},2000) } }); },// 使用plus.zip.compressImage压缩图片并转换成base64getMinImage(imgPath) {plus.zip.compressImage({src: imgPath,dst: imgPath,overwrite: true,quality: 40},zipRes => {setTimeout(() => {var reader = new plus.io.FileReader();reader.onloadend = res => {var speech = res.target.result; //base64图片console.log(speech);this.imgList.push(speech);};//一定要使用plus.io.convertLocalFileSystemURL将target地址转换为本地文件地址,否则readAsDataURL会找不到文件reader.readAsDataURL(plus.io.convertLocalFileSystemURL(zipRes.target));}, 1000);},function(error) {console.log('Compress error!', error);});},BackPage() {uni.navigateBack({delta: 1});} } }css部分.custom{background-color: #2C65F7;}.navcontent{height: 45px;display: -ms-flex;display: -webkit-flex;display: flex;justify-content:space-around;flex-direction:row;color:#FFFFFF;}.livePusher{width: 350px;height: 350px;}.livefater{display: -ms-flex;display: -webkit-flex;display: flex;justify-content:center;flex-direction:column;align-items:center;margin-top: 50rpx;margin-bottom: 50rpx;height: 350px;}.gaiimg{width: 350px;height: 350px;margin-top: -350px;}使用微信小程序开发人脸识别

微信小程序开发人脸识别,有很大的限制,在于资质审核。 微信文档

本文链接地址:https://www.jiuchutong.com/zhishi/283737.html 转载请保留说明!

上一篇:无痛人流多少钱(无痛人流多少钱?)

下一篇:最新小程序反编译详细教程,亲测可用(小程序在线反编译网页版)

  • 增值税留抵税额账务处理
  • 增值税怎么记
  • 销售佣金计入什么会计科目
  • 交易性金融资产公允价值变动计入
  • 应交税费应交印花税借方有余额
  • 税款滞纳金计入成本费用还是营业外
  • 小规模纳税人开具不动产发票税率
  • 净流动负债和流动负债
  • 核定征收企业股权转让的税收
  • 劳务工和临时工
  • 企业税金包括
  • 事业基金弥补收支差额是什么意思
  • 审计部费用报销审计
  • 借款合同印花税减免优惠政策
  • 互联网合同范本
  • 劳务派遣差额部分可以开专票吗
  • 公司免费使用我的肖像权用作商业
  • 河道管理费入什么科目
  • win7怎么转移桌面到d盘
  • 土地增值税计算例题
  • window清除临时存储文件夹
  • win10电脑电源选项怎样设置最好
  • 结转损益类收入科目的余额会计分录
  • 我告诉你windows7旗舰版
  • 酒店加盟管理费多少
  • 工业企业采购部门职责
  • 增值税如何在报表里填写
  • php请求https
  • 海鸥歌曲
  • idea打开vue文件
  • framework架构
  • 如何修改php.ini
  • 赠送客户商品分录
  • 个税专项扣除中赡养老人
  • network python
  • 国内来料加工会亏本吗
  • idea实用技巧
  • dpkg -s命令
  • 销项税太多
  • 应收应付核销规则及常见问题
  • 销售费用工资明细科目
  • 固定资产加速折旧是什么意思
  • 销项负数发票需不需要增加库存
  • SQLite教程(十二):锁和并发控制详解
  • mongodb reference
  • 织梦如何做提取卡密
  • 清算时实收资本需要做收入吗为什么
  • MySQL数据库远程登录
  • 银行存款出现负数怎么办
  • 高危险工作人员有什么意外险
  • 补缴以前年度企业所得税以及滞纳金
  • 纳税人id
  • 跨年度费用如何计算
  • 印花税征税范围2021
  • 下列sql server语句中出现语法错误的是
  • Win7旗舰版系统文件名称
  • 给推荐几款
  • 从哪里看windows是多少位的
  • 在操作系统中如何创建一个新的用户
  • win7系统自带网卡吗?
  • linux常用命令grep
  • javascript中的数组可以存放任何类型的数据
  • CCMoveBy与CCMoveTo
  • javascript函数的作用
  • glsl编译
  • 加密批处理代码
  • 小说温故知新
  • js中的?
  • unity做app
  • js实现全屏
  • 安卓模拟器比手机快吗
  • web.py 十分钟创建简易博客实现代码
  • 四川税务局网上办税
  • 河南省地方税务局公告2011年第10号
  • 物业收取水电费的通知范文
  • 失业金存在多个账户
  • 广东可以去吗
  • 按月申报印花税如何计税
  • 消防行政执法风险评估
  • 船舶吨税的税收优惠
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设