天天看点

python+unity 做3d动画人物 python做骨骼识别 (一)

1. 环境准备:pycharm 2017.2.2 python 3.8.6

2. unity 2018.

       曾经上学时学过unity开发,但后来工作后,一直没有从事过,此方面的技术研究了,一直想着做个东西捡起来,以前忘却的知识。。。想着想着很多年过去了。。。直到最近不知道。。咋的了突然想搞点东西玩玩,捡起来所学的知识。同时对所学知识进行一次汇总。。。。。。

python+unity 做3d动画人物 python做骨骼识别 (一)

实现步骤:

1.先用python进行人体骨骼动作识别。

2.获取骨骼动态数据,发送到unity

3.unity3D动态人物,进行骨骼数据绑定。

实时骨骼动态识别:

采用cv2+PoseDetector 识别

先看下效果:

python+unity 做3d动画人物 python做骨骼识别 (一)

看下效果视频:

python人体骨骼识别

关键源码:

while True:
    success, img = cap.read()
    img = detector.findPose(img)
    lmList, bboxInfo = detector.findPosition(img)
    lmString = ''
    if bboxInfo:
        #lmString = ''
        for lm in lmList:
            lmString += f'{lm[1]},{img.shape[0] - lm[2]},{lm[3]},'
        posList.append(lmString)