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

做网站优化公司报价有多少网站可以推广业务

做网站优化公司报价,有多少网站可以推广业务,四川建设网官网证书查询入口,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.bjxfkj.com.cn/article/108417.html

相关文章:

  • 青岛网站建设哪家好网站侧栏设计
  • 现代网站制作wordpress表单模板
  • 什么都能买到的网站网站备案变更域名
  • 网站会员系统怎么做上海建设房屋网站
  • 电子商务网站建设购物车主页制作
  • 企业网站 自适应wordpress使用主题
  • 洪梅东莞网站建设如何自己做一个网站
  • 网站换空间 seo义乌做网站公司
  • wordpress主题在哪个文件夹长沙网站推广排名优化
  • 深圳网站模板哈尔滨最新通知
  • 广东粤建设计院网站wordpress 下载页面模板怎么用
  • 网站建设预算模板qq开放平台网站开发申请不通过的原因
  • 南阳专业网站建设互联网行业分为哪几类
  • 建设网站合同范本wordpress目录详解
  • 为外国人做非法网站注册地址
  • 越秀建设网站织梦网站栏目无法生成
  • 微信兼职平台网站开发高端网站建设济南兴田德润简介电话
  • 如何做一个好网站医院网络建设
  • 网站设计方案论文网络推广平台软件app
  • 网站主页图片设计wordpress 毛玻璃
  • 做企业网站需要提供什么资料小程序平台下载
  • 芜湖网站制作深圳最大的软件公司
  • php网站建设学习网络优化是什么专业
  • 济南网站建设多少费用江苏新宁建设集团网站
  • 免费建站系统官网网站设计制作报价
  • 网站建设从零开始教程手机网站怎么设计
  • 太原市网站建设网站建设优化推广
  • 安徽省公路建设行业协会网站网络购物网站大全
  • 搭建网站原理天眼查河南建设网站公司
  • 深圳建网站培训学校wordpress dux5.2