wx.faceDetect接口在不同手机上返回值不同吗?
在调用wx.faceDetect接口的时候发现在一些手机上的返回值是正常的,但是用iphone12 pro max测试的时候就有问题,返回值不全了 screen2base64: function (frame) {
if (!this.data.scan_switch) {
// 扫描开关关闭了
return;
}
// console.log("screen2base64");
var that = this
skip = skip + 1;
if (skip % 20 == 1) {
wx.faceDetect({
width: frame.width,
height: frame.height,
frameBuffer: frame.data,
enableConf: true,
enablePoint: true,
success(res) {
console.log("faceDetect Res->",res)
console.log("pointArray 内容如下",res.pointArray)
console.log("第86个点的数据如下:",res.pointArray[86])
var centerX = ((res.pointArray[84].x + res.pointArray[90].x) / 2) * (that.data.width / frame.width)
var centerY = ((res.pointArray[93].y + res.pointArray[87].y) / 2) * (that.data.height / frame.height)
that.setData({
centerX: centerX,
centerY: centerY,
})
// console.log("识别度",res.confArray.mouth)
// console.log(that.data.zoneX1,"+",centerX,"+",that.data.zoneX2)
// console.log(that.data.zoneY1,"+",centerY,"+",that.data.zoneY2)
if (res.confArray.mouth > 0.80 && centerX < that.data.zoneX2 && centerX > that.data.zoneX1 && centerY < that.data.zoneY2 && centerY > that.data.zoneY1) {
count++;
NoMouth = 8;
if (count >= 3) {
that.closeScan()
//检测完成,但是要播放完动画
clearInterval(mouth)
console.log("stop了", that.data.a)
mouth = setInterval(() => {
if (that.data.a > 45) {
clearInterval(mouth)
setTimeout(function () {
wx.redirectTo({
url: '../AVideo/AVideo',
})
}, 500)
} else {
that.setData({
a: that.data.a + 1
})
}
}, 2000 / 45)
}
} else {
NoMouth = NoMouth - 1
console.log("nomout", NoMouth)
if (NoMouth == 0) {
wx.showToast({
icon: 'none',
title: '微笑识别不成功,记得对准唇部框哦',
duration: 2000
})
NoMouth = 7;
}
}
// console.log("count->", count)
},
fail(err) {
console.log('失败', err)
NoMouth = NoMouth - 1
console.log("nomout", NoMouth)
if (NoMouth == 0) {
wx.showToast({
icon: 'none',
title: '微笑识别不成功,记得对准唇部框哦',
duration: 2000
})
NoMouth = 7;
}
}
})
}
// 开始制作base64
that.setData({
create_ready_status: false
})
},
[图片][图片]