【一步步开发AI运动小程序】五、帧图像人体识别
1.【一步步开发AI运动小程序】一、准备工作2. 【一步步开发AI运动小程序】二、引入插件3.【一步步开发AI运动小程序】三、运动识别处理流程4.【一步步开发AI运动小程序】四、小程序如何抽帧
5.【一步步开发AI运动小程序】五、帧图像人体识别
6.【一步步开发AI运动小程序】六、人体骨骼图绘制7.【一步步开发AI运动小程序】七、进行运动计时、计数8.【一步步开发AI运动小程序】八、利用body-calc进行姿态识别9.【一步步开发AI运动小程序】九、姿态辅助调试桌面工具的使用10.【一步步开发AI运动小程序】十、姿态动作相似度比较11.【一步步开发AI运动小程序】十一、人体关键点跳跃追踪12.【一步步开发AI运动小程序】十二、自定义一个运动分析器,实现计时计数0113.【一步步开发AI运动小程序】十三、自定义一个运动分析器,实现计时计数0214.【一步步开发AI运动小程序】十四、主包超出2M大小限制,如何将插件分包发布?15.【一步步开发AI运动小程序】十五、AI运动识别中,如何判断人体站位的远近?16.【一步步开发AI运动小程序】十六、AI运动识别中,如何判断人体站位?17.【一步步开发AI运动小程序】十八、如何识别用户上传图片中的人体、运动、动作、姿态?18.【一步步开发AI运动小程序】十七、如何识别用户上传视频中的人体、运动、动作、姿态?19.【一步步开发AI运动小程序】十九、运动识别中如何解析RGBA帧图片?20.【一步步开发AI运动小程序】二十、AI运动小程序如何适配相机全屏模式?21.AI运动小程序开发常见问题集锦一22.AI运动小程序开发常见问题集锦二23.【更新日志】新发布的1.5.0版本插件中的增强模式,作用几何?24.【一步步开发AI运动小程序】二十一、如果将AI运动项目配置持久化到后端?随着人工智能技术的不断发展,阿里体育等IT大厂,推出的“乐动力”、“天天跳绳”AI运动APP,让云上运动会、线上运动会、健身打卡、AI体育指导等概念空前火热。那么,能否将这些在APP成功应用的场景搬上小程序,分享这些概念的红利呢?本系列文章就带您一步一步从零开始开发一个AI运动小程序,本系列文章将使用“云智AI运动识别小程序插件”,请先行在微信服务市场或官网了解详情。
一、初始化人体识别功能
人体识别能力调用前需要初始化(可多次初始化),插件的具有双人体识别引擎,默认不指定引擎将自动选择最优引擎,也可指定引擎,识别引擎的差别请参考集成文档。
const that = this;
humanDetection.initialize({
//ve: 2,
callback(err) {
uni.hideLoading();
if (!err) {
console.log('人体检测能力初始化成功。', humanDetection.getVe());
return;
}
uni.showModal({
content: `初始化失败,详细信息:${err.message}`,
showCancel: false
});
}
});
二、调用人体识别功能
//接上篇抽帧
const context = wx.createCameraContext();
const listener = context.onCameraFrame((frame) => {
//frame.data图像数组将用于后续的人体识别
const image = {
width: Number(frame.width),
height: Number(frame.height),
data: new Uint8Array(frame.data)
};
humanDetection.detectionAsync(image).then(human=>{
console.log(human);
});
});
listener.start();
三、人体识别结果
{
"score": 0.7251838252824896,
"width": 480,
"height": 640,
"timestamp": 1684325583506,
"keypoints": [
{
"y": 103.56424502483996,
"x": 256.0109768927012,
"score": 0.4570312798023224,
"name": "nose"
},
{
"y": 90.71574411931093,
"x": 270.50707531981544,
"score": 0.58251953125,
"name": "left_eye"
},
{
"y": 90.09307140499885,
"x": 244.60145098668588,
"score": 0.552734375,
"name": "right_eye"
},
{
"y": 95.37442872749463,
"x": 286.88540601464354,
"score": 0.75244140625,
"name": "left_ear"
},
{
"y": 93.90985185987653,
"x": 231.85045311881774,
"score": 0.7392578125,
"name": "right_ear"
},
{
"y": 162.78484030178413,
"x": 311.0556351088547,
"score": 0.919921875,
"name": "left_shoulder"
},
{
"y": 161.2381417518693,
"x": 203.38841526521654,
"score": 0.77197265625,
"name": "right_shoulder"
},
{
"y": 240.78316880186404,
"x": 310.24842737472574,
"score": 0.84912109375,
"name": "left_elbow"
},
{
"y": 242.12329664294745,
"x": 201.77353663841666,
"score": 0.833984375,
"name": "right_elbow"
},
{
"y": 281.9979693520591,
"x": 352.673287407275,
"score": 0.59765625,
"name": "left_wrist"
},
{
"y": 286.2878520237733,
"x": 173.8384814716242,
"score": 0.63427734375,
"name": "right_wrist"
},
{
"y": 307.2371714929637,
"x": 273.4654390815558,
"score": 0.82177734375,
"name": "left_hip"
},
{
"y": 305.7596342955926,
"x": 222.0470940485152,
"score": 0.84912109375,
"name": "right_hip"
},
{
"y": 417.72422545441424,
"x": 267.0201893540119,
"score": 0.6103515625,
"name": "left_knee"
},
{
"y": 414.7774591985668,
"x": 204.46947287192143,
"score": 0.8701171875,
"name": "right_knee"
},
{
"y": 481.8868752974563,
"x": 280.1792094531294,
"score": 0.74072265625,
"name": "left_ankle"
},
{
"y": 467.38751675509405,
"x": 247.29222232381437,
"score": 0.7451171875,
"name": "right_ankle"
}
],
"bodyRange": {
"x": 173.8384814716242,
"y": 90.09307140499885,
"width": 178.8348059356508,
"height": 391.79380389245745
}
}
四、识别结果旋转矫正
获得人体识别结果后,可以调用rotate()
进行整体旋转,也可以调用rotateToUpright()
自动旋转直立图,进行横、竖屏适配。
下一篇将为您介绍人体骨骼图绘制...

提供信息系统、公众号、小程序、APP订制开发服务
QQ:316455841
欢迎通过各种渠道咨询了解,免费提供信息系统建设咨询服务。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 百万级群聊的设计实践
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)