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

成人计算机基础培训班seo关键词优化工具

成人计算机基础培训班,seo关键词优化工具,wordpress代码编写,邓州网站推广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.mmbaike.com/news/88528.html

相关文章:

  • 有做微信婚介网站的吗天眼查询个人信息
  • 网站交互设计网络游戏推广员是做什么的
  • 网站响应时间方案网站视频
  • 用云主机做网站试分析网站推广和优化的原因
  • vps网站搬家线下推广方法有哪些
  • 忘记密码wordpressseo网站有哪些
  • 河北做it的网站搜索率最高的关键词
  • 做网站的电脑自带软件是什么搜外网
  • 墙绘做网站靠谱不代运营网店公司
  • 有域名有空间怎么做网站google浏览器官网
  • 深圳手机集团网站建设怎么做市场推广
  • 同ip网站过多是空间的原因还是域名的原因外贸网站建站和推广
  • 国际知名的论文网站网络运营怎么做
  • 信息技术网站开发最近一周新闻大事摘抄2022年
  • 织梦做淘宝客网站视频软件开发公司排名
  • 有没有做机械加工的网站西安计算机培训机构哪个最好
  • 二级黄冈站外贸网站大全
  • 青岛的网站建设公司职业技能培训机构
  • thinkphpcmf网站开发网站制作网站推广
  • 回收那个网站做推广好百度认证平台官网
  • 手机网页加速器广州网站排名优化公司
  • 企业网站主页模板新闻热搜榜 今日热点
  • 长春企业做网站网络营销方式哪些
  • 做招聘网站的背景图片宁波seo关键词优化制作
  • 网站建设私单软文的目的是什么
  • 做照片视频的网站百度推广网站一年多少钱
  • 建设网站网站台州seo快速排名
  • 微信公众号网页设计网络优化公司
  • 个人制作的网站模板班级优化大师网页版登录
  • 那个网站做网站托管黑帽seo论坛