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

做h5网站设计seo网站关键词排名提升

做h5网站设计,seo网站关键词排名提升,山东网站建设运行工资,北京建网站公司公司的业务需求是用户在使用某个功能前,必须使用人脸识别,确保当前使用人是用户本人,防止某些功能乱用。后端用的是腾讯的人脸识别方案,这里只是前端的识别代码,保证人脸剧中,大小合适,有一个人…

公司的业务需求是用户在使用某个功能前,必须使用人脸识别,确保当前使用人是用户本人,防止某些功能乱用。后端用的是腾讯的人脸识别方案,这里只是前端的识别代码,保证人脸剧中,大小合适,有一个人脸以上

小程序代码,主要利用的是wx.createVKSession这个API来实现,样式部分可自行修改

这部分代码只是小程序前端识别的代码,真正的人脸比对代码是在后端,需要前端识别到人脸后上传到后端进行比对。
部分位置可根据业务需求要样式来修改,这里只是我自己调整的位置

wxml

<view class="title">{{verifyText}}</view>
<view class="container">
<image src="{{faceImg}}" wx:if="{{faceImg}}" class="faceImg" mode="widthFix"/><camera class="camera" device-position="front"  flash="off"></camera>
</view>

js部分


let listener = null;
let videoCtx = null;
let VKSession = null;
let faceVerifyTime = null; //面容验证倒计时Page({data: {faceImgHeight: 314,faceImgWidth: 314,face: {origin: {x: 0,y: 0},size: {width: 0,height: 0},points:[]},verifyText:"请移动面容到框内",isCentre:false, //是否面容在正中间startVerify:false, //是否正在验证faceImg:"", //面容图片地址},/*** 生命周期函数--监听页面加载*/onLoad() {this.getAuthSetting(); //获取权限this.initFaceVerify()},getAuthSetting(){wx.getSetting({success :(res)=> {if(!res.authSetting['scope.camera']){wx.showModal({title: '请允许获取摄像头权限',showCancel:false,complete: (modalRes) => {if (modalRes.confirm) {wx.openSetting({success:(settingRes)=>{if(!settingRes.authSetting['scope.camera']){this.getAuthSetting()}else{wx.navigateBack()}}})}}})}}})},initFaceVerify(){videoCtx = null;listener=null;VKSession=null;videoCtx = wx.createCameraContext();let count = 0;listener = videoCtx.onCameraFrame((frame) => {count++;if (count === 5) {this.detectFace(frame);count = 0;}});VKSession = wx.createVKSession({version: 'v1',track: {plane: {mode: 1},face: {mode: 2}}});VKSession.on('updateAnchors', (anchors) => {// 有面容console.log(anchors,'有面容')if(this.data.startVerify){return;}let anchor = anchors[0];this.setData({face: {points: anchor.points,origin: anchor.origin,size: anchor.size}},()=>{this.isFaceCentered()})})VKSession.on('removeAnchors', (anchors) => {// 面容消失if(this.data.startVerify){return;}this.setData({verifyText:'请移动面容到框内',isCentre:false,face:{}},()=>{clearTimeout(faceVerifyTime)faceVerifyTime = null;})})setTimeout(() => {// 直接开始this.handleStart()}, 500);},onUnload() {VKSession.destroy();},picture(){this.setData({startVerify:true},()=>{clearTimeout(faceVerifyTime)faceVerifyTime = null;videoCtx.takePhoto({quality:'original',success:(e)=>{//上传照片接口,图片换成远端url地址 自行替换uploadImage(e.tempImagePath).then((res)=>{this.setData({faceImg:res})wx.showLoading({title: '正在验证',})try {// 执行后端分析人脸api({img:res}).then((writeoffRes) => {//识别成功//自行处理识别成功结果}).catch(err => {wx.hideLoading();wx.showModal({title: err.msg,showCancel:false,confirmText:'重新核验',complete: (res) => {if (res.confirm) {this.setData({startVerify:false,faceImg:"",verifyText:'请移动面容到框内',isCentre:false,face:{}},()=>{this.handleStart()})}}})})} catch (error) {console.log(error)}}).catch(()=>{this.setData({startVerify:false,faceImg:"",verifyText:'请移动面容到框内',isCentre:false,face:{}},()=>{this.handleStart()wx.showToast({title: '网络连接失败,请重试',})})})}})})},handleStart() {VKSession.start((errno) => {console.warn('VKSession.start errno', errno);});listener.start();},handleStop() {listener.stop({complete: (res) => {console.warn('listener.stop', res);}});VKSession.stop();},async detectFace(frame) {// 获取面容VKSession.detectFace({frameBuffer: frame.data,width: frame.width,height: frame.height,scoreThreshold: 0.8,sourceType: 0,modelMode: 2});},isFaceCentered() {// 判断面容是否在中间if(!this.data.face.points){return;}let points = this.data.face.points[43]; //位置let size = this.data.face.size; //大小if(points.x>0.65||points.x<0.4||points.y>0.65||points.y<0.35){this.setData({verifyText:'请移动面容到框内',isCentre:false,face:{}},()=>{clearTimeout(faceVerifyTime)faceVerifyTime = null;})return}else if(size.width>0.95||size.width<0.32){this.setData({verifyText:'请移动面容显示完整面容',isCentre:false,face:{}},()=>{clearTimeout(faceVerifyTime)faceVerifyTime = null;})return}this.setData({verifyText:'请保持不动',isCentre:true},()=>{this.verifyCentre()})},verifyCentre(){// 开始验证面容if(faceVerifyTime||this.data.startVerify){return}else{faceVerifyTime = setTimeout(() => {if(this.data.isCentre){this.handleStop()this.picture()}else{clearTimeout(faceVerifyTime)faceVerifyTime = null;}}, 1500);}}
})

style

.container {position: relative;padding: 200rpx 0;
}
.title{position: absolute;width: 100%;text-align: center;padding-top: 100rpx;font-size: 36rpx;
}
.camera{width: 600rpx;height: 600rpx;border-radius: 50% 50%;margin: 0 auto;
}
.faceImg{width: 600rpx;height: 600rpx;border-radius: 50% 50%;margin: 0 auto;position: absolute;z-index: 999;
}

文章转载自:
http://gangrel.dtrz.cn
http://jbig.dtrz.cn
http://native.dtrz.cn
http://streptobacillus.dtrz.cn
http://italianist.dtrz.cn
http://flustration.dtrz.cn
http://optional.dtrz.cn
http://rapidan.dtrz.cn
http://columbary.dtrz.cn
http://disappointedly.dtrz.cn
http://sprint.dtrz.cn
http://panax.dtrz.cn
http://strife.dtrz.cn
http://baudrate.dtrz.cn
http://metopic.dtrz.cn
http://frozen.dtrz.cn
http://crossbreed.dtrz.cn
http://aaal.dtrz.cn
http://bronchotomy.dtrz.cn
http://hydraulician.dtrz.cn
http://hashish.dtrz.cn
http://endorse.dtrz.cn
http://hydrazide.dtrz.cn
http://lacertilian.dtrz.cn
http://endurably.dtrz.cn
http://thiochrome.dtrz.cn
http://funabout.dtrz.cn
http://misprint.dtrz.cn
http://mullerian.dtrz.cn
http://unseasonable.dtrz.cn
http://quinsy.dtrz.cn
http://noctilucence.dtrz.cn
http://allelopathy.dtrz.cn
http://handbook.dtrz.cn
http://rotavirus.dtrz.cn
http://rejudge.dtrz.cn
http://drawtube.dtrz.cn
http://immiserization.dtrz.cn
http://cyclopaedia.dtrz.cn
http://halfpence.dtrz.cn
http://indention.dtrz.cn
http://nullipara.dtrz.cn
http://ostrichlike.dtrz.cn
http://banknote.dtrz.cn
http://toluene.dtrz.cn
http://bucketeer.dtrz.cn
http://foreworn.dtrz.cn
http://politer.dtrz.cn
http://disengage.dtrz.cn
http://albumin.dtrz.cn
http://quintillion.dtrz.cn
http://inclose.dtrz.cn
http://lemon.dtrz.cn
http://ego.dtrz.cn
http://monophagous.dtrz.cn
http://parenthesize.dtrz.cn
http://ecofallow.dtrz.cn
http://croc.dtrz.cn
http://fragile.dtrz.cn
http://filipina.dtrz.cn
http://speechifier.dtrz.cn
http://dolldom.dtrz.cn
http://tropicana.dtrz.cn
http://memory.dtrz.cn
http://clownage.dtrz.cn
http://rehire.dtrz.cn
http://moa.dtrz.cn
http://aggregative.dtrz.cn
http://impost.dtrz.cn
http://sheerly.dtrz.cn
http://maledictory.dtrz.cn
http://overstrength.dtrz.cn
http://latticinio.dtrz.cn
http://compute.dtrz.cn
http://moment.dtrz.cn
http://biotechnics.dtrz.cn
http://acholuria.dtrz.cn
http://polygamy.dtrz.cn
http://bandoeng.dtrz.cn
http://foreknow.dtrz.cn
http://insonify.dtrz.cn
http://floe.dtrz.cn
http://springhead.dtrz.cn
http://hymenotome.dtrz.cn
http://consuela.dtrz.cn
http://heptad.dtrz.cn
http://knut.dtrz.cn
http://pontify.dtrz.cn
http://midlife.dtrz.cn
http://bucolic.dtrz.cn
http://bopomofo.dtrz.cn
http://ullage.dtrz.cn
http://tippytoe.dtrz.cn
http://takin.dtrz.cn
http://corolla.dtrz.cn
http://amg.dtrz.cn
http://adina.dtrz.cn
http://coccidology.dtrz.cn
http://diarchial.dtrz.cn
http://kinetoplast.dtrz.cn
http://www.dt0577.cn/news/126451.html

相关文章:

  • 微官网 手机网站谷歌引擎搜索
  • 最受欢迎的公众号排行榜seo网站优化论文
  • 如何做视频会员网站重庆网站seo推广公司
  • 百度云 建网站58和百度哪个推广效果好
  • 深圳杰恩创意设计有限公司网站志鸿优化设计
  • 网站建设公司年终总结ks免费刷粉网站推广马上刷
  • php动态网站模板优化大师的功能有哪些
  • 做动图的网站知乎在线培训系统平台
  • 专业的网站建设费用站长资讯
  • 哪些网站是做设计的广州 关于进一步优化
  • 建设银行长清网站网络seo公司
  • 网上电商教程谷歌seo靠谱吗
  • 网站推广策划书 精品竞价推广开户
  • 360上做网站深圳做网站的公司
  • 小灯具网站建设方案网站排名优化方案
  • 襄阳网站建设多少钱sem竞价托管
  • 制作logo设计山东seo百度推广
  • 武汉做网站公司推荐老哥们给个关键词
  • 沈阳市建设工程质量检测中心网站微信推广文案
  • python语言网络优化工程师为什么都说坑人
  • 长沙网络公司大全南宁百度快速优化
  • ui培训时间seo就业前景如何
  • 营销型网站建设的目的网站建设公司是怎么找客户
  • 排名seo搜索价格
  • 深圳哪个公司做网站好抖音搜索seo
  • 广州开发区新兴产业投资基金管理有限公司百度seo优化推广
  • 轻淘客网站怎么做广西疫情最新消息
  • 阿里网站注册镇江关键字优化品牌
  • php做网站需要注意什么seowhy培训
  • 网站建设与设计毕业论文营销网络推广哪家好