官方人员如果看到的话,尽快回复,这个points3d 是相机坐标还是世界坐标,如果我用已知的相机内外参和points3d 能不能估算出物体的实际高度
关于VKSession.update3DMode 的一些问题?检测到人体后,会在 session.on('updateAnchors',anchors => { session.update3DMode({open3d: true}) anchors.map(anchor => { console.log('size', JSON.stringify(anchor.size)) console.log('points3d', JSON.stringify(anchor.points3d)) console.log('origin', JSON.stringify(anchor.origin)) console.log('camExtArray', JSON.stringify(anchor.camExtArray)) console.log('camIntArray', JSON.stringify(anchor.camIntArray)) }) } points3d 包含人体24个关键点位[{x,y,z}];那么其中的 y 是不是就是人体关键点位在物理中高度的估算?
2023-09-09请问解决了吗?我现在也被这个问题困扰
人体静态图片识别,updateAnchors回调参数值为[{}],是什么原因?index.html <view class="container page"> <view> <canvas type="2d" id="canvas" style="width: {{width}}px; height: {{height}}px"></canvas> </view> <view class="btn-cnt" style="position: fixed; top: 0; left: 0;"> <button type="primary" bindtap="chooseMedia">选择图片</button> <button type="primary" disabled="{{!bodyImgUrl}}" style="margin-top: 20px;" bindtap="detectbody">开始检测</button> </view> </view> index.js const app = getApp() Page({ data: { canvas:null, width:1, height:1, anchor2DList:[], bodyImgUrl:"", bodyImgWidth:0, bodyImgHeight:0, bodyImgOriginWidth:0, bodyImgOriginHeight:0 }, onReady() { wx.createSelectorQuery() .select('#canvas') .node() .exec(res => { this.canvas = res[0].node this.calcSize() this.initVK() }) }, calcSize(){ const info = wx.getSystemInfoSync() let width = info.windowWidth let height = info.windowHeight this.canvas.width = width this.canvas.height = height this.setData({ width, height, }) }, initVK() { const session = this.session = wx.createVKSession({ track: { body: { mode: 2 } }, version: 'v1' }) session.start(err => { if (err) return console.error('VK error: ', err) const canvas = this.canvas session.on('resize', () => { this.calcSize() }) session.on('addAnchors', anchors => { this.setData({ anchor2DList: anchors.map(anchor => ({ points: anchor.points, origin: anchor.origin, size: anchor.size })), }) }) session.on('updateAnchors', anchors => { console.log("anchors : ",anchors) this.data.anchor2DList = [] this.setData({ anchor2DList: anchors.map(anchor => ({ points: anchor.points, origin: anchor.origin, size: anchor.size })), }) }) session.on('removeAnchors', anchors => { this.setData({ anchor2DList: [], }) this.data.anchor2DList = [] }) }) }, chooseMedia() { wx.chooseMedia({ count: 1, mediaType: ['image'], success: res => { const imgUrl = res.tempFiles[0].tempFilePath wx.getImageInfo({ src: imgUrl, success: res => { const fixWidth = this.data.width const { width, height } = res this.setData({ bodyImgUrl: imgUrl, bodyImgWidth: fixWidth, bodyImgHeight: (fixWidth / width) * height, bodyImgOriginWidth: width, bodyImgOriginHeight: height }) }, fail: res => { console.error(res) } }) }, fail: res => { console.error(res) } }) }, async detectbody() { if (this.data.bodyImgUrl) { // const canvas = uni.createOffscreenCanvas({ // type: '2d', // width: this.data.bodyImgOriginWidth, // height: this.data.bodyImgOriginHeight, // }) // const context = canvas.getContext('2d') const canvas = this.canvas const context = canvas.getContext('2d') const img = canvas.createImage() await new Promise(resolve => { img.onload = resolve img.src = this.data.bodyImgUrl }) context.clearRect(0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) context.drawImage(img, 0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) this.imgData = context.getImageData(0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) console.log("imgData : ",this.imgData.data.buffer) this.session.detectBody({ frameBuffer: this.imgData.data.buffer, width: this.data.bodyImgOriginWidth, height: this.data.bodyImgOriginHeight, scoreThreshold: 0.5, sourceType: 1 }) } }, }) 静态图片 [图片] 控制台打印信息 [图片] 微信版本 8.0.40 基础库版本 3.0.1
2023-09-07