当前位置:网站首页>Openpose2d transform 3D pose recognition
Openpose2d transform 3D pose recognition
2022-07-24 06:13:00 【A small EZ】
Recently, the author encountered a problem is openpose When it comes to attitude recognition , The recognized human posture is a 2d Plane posture . about AR For interactive applications ,2d Posture is not as good as 3d Posture . Of course you can kinect Depth camera or open source project vnect Realization 3d Real time attitude recognition . But if we can openpose Make some changes , Can achieve an approximate effect .
First openpose Of body_25 The model output is shown in the figure :
In order to make an approximate effect , We can first assume that
1. The torso is facing the camera and will not deviate ( Spinning )【 Joint point 5 2 1 8】.
2. The inclination of the limbs is only left Right deviation and Lean forward , No leaning back .
Then first of all, our goal is to do a stretching posture as shown in the figure ( Limb in 2d In the plane ), Measure the length of each limb .
Next , We use 1 2 and 2 3 Take the joint point as an example , Make one 3d Attitude recognition .
First we assume 5 2 1 8 Always keep parallel with the camera , So we can take this as a reference .
about 2d In terms of plane We know this angle , It can be obtained by calculating the included angle between vectors .
So when 3 When leaning forward , Got 2d The output is actually 2 3'. We know 2 3' Length and 2 3 The length of .
2 3' = 2 3 * cos Θ. So you can calculate Caster angle θ The angle of . Got it The angle in the two pictures , You can get joint points 3 The spatial location of

about OpenPose Of unity In terms of plug-ins , Is to calibrate the obtained attitude information on the screen , And then use LineRenderer Drawing . On this basis, the author adds a limb model 

Script in lsfather lsfather Empty object lshoulder For the actual model , This is convenient for the adjustment of angle and model .
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class To3DBlog : MonoBehaviour
{
[SerializeField] RectTransform Joint0;
[SerializeField] RectTransform Joint1;
Vector3 direction;
bool enabledstate;
GameObject Renderobj;
[SerializeField] float MaxSize = 0;
[SerializeField] float curLength;
float curHeight;
[SerializeField] GameObject childobj;
// Start is called before the first frame update
void Start()
{
Renderobj = this.gameObject;
childobj = this.gameObject.transform.GetChild(0).gameObject;
}
// Update is called once per frame
void Update()
{
if (Joint0 && Joint1)
{
bool enabled = Joint0.gameObject.activeInHierarchy && Joint1.gameObject.activeInHierarchy;
enabledstate = enabled;
childobj.SetActive(enabled);
if (enabled)
{
// Conduct
direction = (Joint0.transform.localPosition - Joint1.transform.localPosition);
curLength = direction.magnitude;
// Modules of vectors
if (curLength > MaxSize)
{
MaxSize = direction.magnitude;
}
// seek Joint1 Of z value
//curHeight = MaxSize * Mathf.Sin(Mathf.Acos(curLength/MaxSize));
curHeight = Mathf.Sqrt(Mathf.Pow(MaxSize,2)- Mathf.Pow(curLength,2));
// The direction ahead is -z Axis direction however Consider mirroring
direction = (Joint1.transform.localPosition + new Vector3(0, 0, curHeight) - Joint0.transform.localPosition);
Renderobj.transform.localPosition = (Joint1.transform.localPosition + Joint0.transform.localPosition + new Vector3(0,0,-curHeight)) / 2;
Renderobj.transform.up = direction;
Renderobj.transform.localScale = new Vector3(MaxSize, MaxSize, MaxSize);
//scale The problem of
}
}
}
}
The algorithm is explained in the figure : among curLength yes openpose Identify the distance between two joint points ( This body is also in z The projection of the axis ),MaxSize Is the actual length of the limb , In this way, we can find the current Joint1 Height .
For the right shoulder, apply the results 
For the right arm, the results apply Left 2d Right 3d The effect is as shown in the picture 
边栏推荐
- JUC并发编程基础(1)--相关基础概念
- Dameng database_ Logical backup
- day3-jvm+排序总结
- Dameng database_ Logical architecture foundation
- UDP通讯应用于多种环境的Demo
- Lunix命令入门 - 用户及文件权限(chmod 详解)
- Force buckle: 1-sum of two numbers
- 论文阅读-Endmember-Guided Unmixing Network (EGU-Net) 端元指导型高光谱解混网络
- Dameng database_ LENGTH_ IN_ Influence of char and charset
- Lua基础
猜你喜欢

JVM系统学习

Thymeleaf quick start learning

单播、组播、广播、工具开发、QT Udp通讯协议开发简介及开发工具源码
![[deep learning] handwritten neural network model preservation](/img/4a/27031f29598564cf585b3af20fe27b.png)
[deep learning] handwritten neural network model preservation

HoloLens 2 开发101:创建首个HoloLens 2应用程序

Thymeleaf快速入门学习
![[raspberry pie 4B] VII. Summary of remote login methods for raspberry pie xshell, putty, vncserver, xrdp](/img/dc/364fdc4c1748cc5522e4592bc47dc3.png)
[raspberry pie 4B] VII. Summary of remote login methods for raspberry pie xshell, putty, vncserver, xrdp

【数据库系统原理】第四章 高级数据库模型:统一建模语言UML、对象定义语言ODL

【无需公网IP】为远程桌面树莓派配置固定的公网TCP端口地址

Openpose Unity 插件部署教程
随机推荐
day6-jvm
Find the number with the most occurrences in the array
使用Keras实现CNN+BiLSTM+Attention的多维(多变量)时间序列预测
Positional argument after keyword argument
使用Qt连接MySql并创建表号、写入数据、删除数据
Dameng database_ Supported table types, usage, characteristics
JDBC初级学习 ------(师承尚硅谷)
JUC并发编程基础(8)--读写锁
常见AR以及MR头戴显示设备整理
Opencv reads avi video and reports an error: number < Max_ number in function ‘icvExtractPattern
Hit the wall record (continuously updated)
Search of two-dimensional array of "sword finger offer" C language version
初识图形学
UDP通讯应用于多种环境的Demo
QT drawing exception using pure code
[FatFs] migrate FatFs manually and transfer SRAM virtual USB flash disk
Qt新建工程简介
Detailed explanation of KMP code distribution
JVM系统学习
day-7 jvm完结