收藏
回答

苹果12真机调试调用相机人脸识别报错?

start:fail onCameraFrame is not supported on your device

请问是什么原因导致的呢?

  var that = this;
        wx.initFaceDetect();
        const context = wx.createCameraContext();
        this.context = context
        let listener = context.onCameraFrame((frame) => {
            wx.faceDetect({
                frameBuffer: frame.data,
                width: frame.width,
                height: frame.height,
                enablePoint: true,
                enableConf: true,
                enableAngle: true,
                enableMultiFace: true,
                success: function (faceData) {
                    let face = faceData.faceInfo[0]
                    if (face.angleArray.pitch >= 0.1 || face.angleArray.roll >= 0.1 || face.angleArray.yaw >= 0.1) {
                        wx.showToast({
                            title: '请平视摄像头',
                          })
                    } else if (face.confArray.global <= 0.8 || face.confArray.leftEye <= 0.8 || face.confArray.mouth <= 0.8 || face.confArray.nose <= 0.8 || face.confArray.rightEye <= 0.8) {
                        wx.showToast({
                            title: '请勿遮挡五官',
                          })
                    } else {
                       
                        // listener = null
                        listener.stop()
                        wx.showLoading({
                                title: '识别中',
                        })
                        // listener = null
                        setTimeout(() => {
                           wx.showToast({
                             title: '延迟',
                             
                           })
                            wx.hideLoading();
                           
                            // wx.showLoading({
                            //     title: '识别中',
                            //   })
                            // that.tapTakePhoto() 
                        }, 3*1000);
                       
                    }
                },


                fail: function (err) {
                    if (err.x == -1 || err.y == -1) {
                        wx.showLoading({
                            title: '识别不到人脸',
                          })
                         
                       
                    } else {
                        wx.showToast({
                            title: '网络错误',
                          })
                    }
                },
            })


        })


        listener.start()
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容