<camera
class="camera"
device-position="front"
flash="off"
resolution="low"
@error="error"
></camera>
vks() {
let that = this;
that.cameraEngine = wx.createCameraContext();
const session = wx.createVKSession({
track: {
face: { mode: 2 },
},
});
console.error(session, "session");
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);
});
});
session.on("removeAnchors", () => {
console.log("removeAnchors");
});
session.start((errno) => {
console.error(errno, "session.start");
if (errno) return console.error("VK error: ", errno);
const listener = that.cameraEngine.onCameraFrame((frame) => {
session.detectFace({
ArrayBuffer: frame.data,
width: frame.width,
height: frame.height,
scoreThreshold: 0.8,
sourceType: 0,
modelMode: 1,
});
});
listener.start();
});
},
ArrayBuffer: frame.data 这里的key值搞错了,不好意思,记录一下