位置: 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 转载请保留说明!

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

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

  • 小规模纳税人一般纳税人区别
  • 初级税务师什么时候报名
  • 增值税应交税费和申报的不一样怎么调整
  • 初中毕业可以考警察学校吗
  • 退回的附加税能退回来吗
  • 预付押金是否可以作为成本
  • 计提残疾人保障金会计分录
  • 客运站收到承运方开具增值税专用发票可否抵扣
  • 小规模增值税征收条件
  • 原材料保险公司赔偿会计分录怎么写
  • 销售不同税率的货物会计处理
  • 电脑在固定资产中属于哪一类
  • 跨地区预缴税款需缴纳哪些
  • 仓储租赁增值税
  • 财务费用负数是什么意思
  • 企业出售旧设备的收入要纳税吗
  • win11右下角时间设置
  • 华为mate手机sim卡怎么插
  • 进口报关费用会计分录
  • php?ms=0&qgg=&_wv=3
  • php中面向对象
  • 销售部发生广告宣传费计入财务费用
  • 所有者权益变动表范本
  • 在资本相对充足的情况下,为什么还要进一步引进外资
  • threejs环境搭建
  • 同业代付会计分录
  • 融资租入资产的入账价值可能是()
  • 成本法转为权益法例题
  • 弗洛雷斯岛
  • 公民什么情况纳税
  • php docblocker
  • es5和es6的区别
  • 物业费少交点,有什么理由
  • 增值税普通发票查询真伪
  • 进项税额申报表怎么填写
  • c语言怎么给函数传递数组
  • 织梦使用手册
  • ubuntu下编译安装opencv
  • 新旧会计准则口径
  • 物流进项发票应纳税额
  • 股东退股按什么退钱
  • sql server更新数据
  • 等线支付给劳务派遣单位的工资怎么做账?
  • 高校报销开普票还是专票
  • 股东分红的会计分录怎么做
  • 购礼品送客户分账务处理怎么做
  • 企业要怎样才能用到便宜的天然气
  • 注册资本金印花税什么时候缴纳
  • 长期借款计提利息会计分录怎么做
  • 其他应收款如何做坏账处理
  • 小规模纳税人差额纳税申报表
  • 发生额怎么计算
  • 营业执照注册资金变更
  • 营业外支出包括哪些内容
  • Select count(*)、Count(1)和Count(列)的区别及执行方式
  • lsf.exe是什么
  • mac插hdmi没画面
  • linux telnet用法
  • win7纯净版系统多大
  • PHPMyAdmin 2.7.0-pl1下载
  • 如何解决windows蓝屏问题
  • iptables centos
  • opengl入门教程(精)
  • OpenGl的glMatrixMode()函数理解
  • javascript学习指南
  • android实战项目
  • cocos 3.x android下home键后,切回游戏时黑屏太久的问题
  • 简述shell命令提示符的组成
  • java 视频教程
  • javascript要怎么学
  • js立即执行函数作用
  • javascript和html区别
  • realm数据库连接
  • jquery动态设置css
  • 国家税务总局千户集团企业名单
  • 农产品初加工有哪些
  • 公司变更税务局
  • 平安车险如何开票报销
  • 三证一码是什么
  • 深圳国税局网站如何查询企业往年财务报表
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设