相机组件<camera :style="cameraStyle" device-position="front" flash="off" binderror="error"></camera>
实时画面后,调用checkFace,启动成功,不回调,“updateAnchors”,这是为什么?
function checkFace() {
var cameraEngine = wx.createCameraContext();
const session = wx.createVKSession({
track: {
face: { mode: 1 }, // mode: 1 - 使用摄像头;2 - 手动传入图像
},
// gl: gl,
});
console.error(session, "session");
// 摄像头实时检测模式下,监测到人脸时,updateAnchors 事件会连续触发 (每帧触发一次)
session.on("updateAnchors", (anchors) => {
console.error(anchors, "session.anchors");
anchors.forEach((anchor) => {
console.log("anchor.points", anchor.points);
console.log("anchor.origin", anchor.origin);
console.log("anchor.size", anchor.size);
console.log("anchor.angle", anchor.angle);
});
});
// 当人脸从相机中离开时,会触发 removeAnchors 事件
session.on("removeAnchors", () => {
console.log("removeAnchors 人离开",);
});
// 需要调用一次 start 以启动
session.start((errno) => {
console.error(errno, "session.start");
if (errno) return console.error("VK error: ", errno);
const listener = cameraEngine.onCameraFrame((frame) => {
// console.log("相机帧frame",JSON.stringify(frame));
session.detectFace({
ArrayBuffer: frame.data, // 图片 ArrayBuffer 数据。人脸图像像素点数据,每四项表示一个像素点的 RGBA
width: frame.width, // 图像宽度
height: frame.height, // 图像高度
scoreThreshold: 0.8, // 评分阈值
sourceType: 0,
modelMode: 0,
});
});
listener.start();
});
}

没有一个官方的真人解答一下这个问题吗