天天看點

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)