当前位置: 首页 > news >正文

义乌公司网站制作建设通app官方下载

义乌公司网站制作,建设通app官方下载,域名到期 网站打不开,百度大全网站uni-app使用live-pusher简单模拟人脸识别页面样式 实现想法调起手机摄像头设置圆形 实现想法 公司的需求是模拟一个人脸识别,不用第三发插件,简单模拟样式即可。 基本思路是调起手机前置摄像头,再设置一个圆形的样式来达到一个基本样式 调起…

uni-app使用live-pusher简单模拟人脸识别页面样式

    • 实现想法
    • 调起手机摄像头
    • 设置圆形

实现想法

公司的需求是模拟一个人脸识别,不用第三发插件,简单模拟样式即可。
基本思路是调起手机前置摄像头,再设置一个圆形的样式来达到一个基本样式

调起手机摄像头

看了官方的媒体组件,只有camera和live-pusher比较合适
camera不支持App,并且需要触发调用,不合符需求
在这里插入图片描述
所以只剩下live-pusher一个选择
引入组件,并基础设置后

<live-pusher id="pusherId" ref="pusherRef" class="livePusher" aspect="1:1"    // 宽高比例:whiteness="1"  // 美白:beauty="1"     // 美颜/>

我们在页面上可以看见效果
在这里插入图片描述

不过这里需要注意一下,如果你是 nvue 页面,还需要手动调起一下摄像头

onMounted(() => {const instance = getCurrentInstance() as ComponentInternalInstance;const pusherContext = uni.createLivePusherContext("pusherId", instance.ctx)pusherContext.startPreview() 
})

官方文档中写默认摄像头为前置,但此时显示的是后置摄像头,并且设置的默认前置也是不生效的,需要手动翻转一下

onMounted(() => {// 获取当前组件实例const instance = getCurrentInstance() as ComponentInternalInstance;// 获取live-pusher上下文对象const pusherContext = uni.createLivePusherContext("pusherId", instance.ctx)// 翻转摄像头pusherContext.switchCamera()
})

设置圆形

这是一个令人头疼的问题
组件设置宽高为正方形后,设置了圆角属性不生效
尝试了nvue页面在父级元素画圆后设置溢出隐藏,也无济于事
最后添加了cover-img标签,用一张圆形的图片盖住四角达到的效果

  <template><div class="face"><view>拿起手机,眨眨眼</view><div class="pushContent"><live-pusher id="pusherId" ref="pusherRef" class="livePusher" aspect="1:1" :whiteness="1" :beauty="1" device-position="front"/><cover-image class="pusherImg" src="/static/images/faceRadio.png" alt=""></cover-image></div></div></template><script lang="ts" setup>import { onMounted, ref, getCurrentInstance, type ComponentInternalInstance } from 'vue';const pusherRef = ref({} as UniHelper.LivePusherInstance)onMounted(() => {const instance = getCurrentInstance() as ComponentInternalInstance;const pusherContext = uni.createLivePusherContext("pusherId", instance.ctx)pusherContext.switchCamera()// pusherContext.startPreview({}) // nvue 页面吊起摄像头})   </script> <style>page{background-color: #FFF !important;}</style><style lang="scss"  scoped>.face{padding: 46rpx 45rpx;text-align: center;display: flex;justify-content: center;flex-direction: column;align-items: center;.pushContent{position: relative;width: 300rpx;height: 300rpx;border-radius: 250rpx;overflow: hidden;margin: 50rpx auto;.livePusher{width: 300rpx;height: 300rpx;border-radius: 50%;}.pusherImg{position: absolute;top: 0;left: 0;bottom: 0;right: 0;width: 300rpx;height: 300rpx;}}}</style>

看下最终效果,先这样吧。
有别的好的方法,请路过留言,万分感谢!
在这里插入图片描述

http://www.yayakq.cn/news/605071/

相关文章:

  • 交通局网站建设整改淮北建设网
  • 做充气气模产品一般去哪些网站提升学历最快的方法
  • 建设网站的知识北京网站制作 建设推广
  • 网站该怎么做链接php 禁止电脑访问网站
  • 网站源码 和网站模板区别做网站有维护费是什么费用
  • 数据库查询网站建设论坛类网站备案
  • 找外包公司做网站计算机应用技术ui设计是什么
  • 任县建设局网站盐城建设厅网站设计备案
  • 大型网站开发用的技术软件开发主要工作内容
  • 做视频网站流量费高吗如何禁止ip访问网站
  • 做网站的感想与收获免费做宣传的网站是
  • 网页设计与网站开发经济可行性破解wordpress邀请码
  • 金融行业网站制作罗湖住房和建设局网站
  • 百度开放平台登录厦门seo优化推广
  • 兰州优化网站公司连云港做网站多少钱
  • 做财务需要关注哪些网站更换网站需要怎么做
  • 深圳公司网站备案珠海 网站设计
  • 火的网站建设明细报价表湖北网站推广宣传
  • 爱做网站免费模板viphtml5高端网站建设织梦模板
  • net网站开发是什么中交路桥建设有限公司电话
  • 网站运行速度优化网站运营论文
  • 远涛网站建设国家标准物质网站建设
  • 控制台网站网站建设注意事情
  • 瑞安学校网站建设手机视频制作
  • 东莞市研发网站建设企业高端建站神器
  • 网站开发的小结旅游网站系统
  • 塔城建设局网站深圳广告公司名录
  • 大型网站制作流程企业邮箱查询网站
  • 南通通明建设监理有限公司网站可以在线做c语言的网站
  • 银川网站建设效果高淳哪家做网站不错