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

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

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

  • 一般纳税人的进销项税怎么做分录
  • 机械租赁适用税率
  • 小微企业做什么
  • 销售折让开具红字
  • 享受企业所得税三免三减半优惠的起始时间
  • 外籍个人工资薪金汇出境
  • 哪些收入减免所得税
  • 一般公共预算支出是什么意思
  • 上交的项目评审费如何做财务处理呢?
  • 物业公司销售门禁卡属于什么收入
  • 商贸公司账目
  • 委托、受托出口做账有哪些事项?
  • 海运费需要代扣代缴吗
  • 个体工商户经营所得税怎么申报
  • 代为持股有没有法律效应
  • 收到上级补助收入支出时财务会计怎么记账
  • 出票人账号是付款号吗
  • 旅游业企业所得税要求
  • 资本公积的借方和贷方各表示什么
  • vc_runtimeMinimum_x64.msi 找不到的解决方法
  • 什么情况下需要承担法律责任
  • 显卡功耗天梯图2023最新版
  • 交了预付款后,一方违约怎么处理
  • 公积金补缴上月算断缴吗
  • php可变参数
  • 异地使用支票的提示付款期限
  • linux直接运行jar
  • 投资性房地产转换日公允价值大于账面价值
  • 企业的工资薪金等现金支出只能通过什么办理
  • 上月发票这月冲红,对这月有影响吗
  • php数据结构
  • php零基础入门教程
  • 给退休人员发放一次性工龄补贴是真的吗
  • 金蝶利润表主营业务成本公式
  • vue3的理解
  • Win11 Build 23435 预览版今日发布: 文件管理器引入图库功能
  • pytorch with no grad
  • vue面试题及答案2021
  • 软件开发增值税即征即退政策
  • 在职工教育经费包括哪些
  • python怎么查看文件路径
  • 启动mysql的语句
  • php5.6.和7.2区别
  • 税控发票如何入账
  • sqlserver的replace
  • 企业所得税业务招待费怎么调整
  • 小规模纳税人取得普通发票怎么做账
  • 会计凭证的做账原则
  • 小规模纳税人已付款对方不开发票几年了会计分录
  • 金税盘清卡怎么弄
  • 划转税务的非税收入包括
  • 固定资产一次性扣除政策
  • 设备维保费如何计算
  • 开来发票没有付款可以进入费用吗?
  • 应收账款怎样记账
  • mysql分区实现
  • 浅谈mysql explain中key_len的计算方法
  • win7激活失败提示错误代码0x80072F8F
  • vim入门教程
  • 一键ghost U盘版
  • winload是什么
  • win10相机模糊
  • shell检查语法错误
  • 自动隐藏桌面图标
  • 远程电脑屏幕桌面图标什么都没有了
  • win7 安装系统
  • 写出perl中最常见4种控制流
  • 拖拽js实现
  • javascript函数大全
  • jquery操作数组
  • 记录心率
  • nodejs 获取命令行参数
  • android studio ndk编程 配置
  • Ubuntu14.04 Android 源码编译
  • python crc
  • python win
  • 上海地铁直接刷银联卡
  • 企业所得税忘记交了怎么办
  • 百旺税控客服电话
  • 专家费缴税标准
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设