- wx.createVKSession人脸识别传入onCameraFrame实时帧数据识别不到人像?
// pages/audio/index.ts Page({ /** * 页面的初始数据 */ data: { audioUrl: '', videoUrl: '' }, /** * 生命周期函数--监听页面加载 */ onLoad() { videoCtx = wx.createCameraContext(); let count = 0; listener = videoCtx.onCameraFrame((frame:any) => { count++; if (count === 10) { this.detectFace(frame); count = 0; } }); VKSession = wx.createVKSession({ version: 'v1', track: { plane: { mode: 1 }, face: { mode: 2 } } }); VKSession.on('updateAnchors', (anchors:any) => { console.warn('anchors', anchors); }) }, handleStart() { videoCtx.startRecord({ timeoutCallback: (res:any) => { console.warn(res); this.setData({ videoUrl: res.tempVideoPath }) }, timeout: 300, complete: (res:any) => { console.warn('videoCtx.startRecord complete', res); } }); VKSession.start((errno:any) => { console.warn('VKSession.start errno', errno); }); listener.start(); }, handleStop() { listener.stop({ complete: (res:any) => { console.warn('listener.stop', res); } }); VKSession.stop(); videoCtx.stopRecord({ compressed: true, success: (res:any) => { console.warn('videoCtx.stopRecord success', res); this.setData({ videoUrl: res.tempVideoPath }) }, fail: (res:any) => { console.warn('videoCtx.stopRecord fail', res); } }); }, async detectFace(frame:any) { console.warn(frame.data); VKSession.detectFace({ frameBuffer: frame.data, width: frame.width, height: frame.height, scoreThreshold: 0.8, sourceType: 0, modelMode: 1 }); }, handleError() {}, }); [图片] 代码片段: https://developers.weixin.qq.com/s/yoorZhmf7aJ6
2023-06-26 - 最新版本开发工具引入tfjsPlugin报错
[图片]
2022-06-15