-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathopenpose_inference.py
38 lines (27 loc) · 983 Bytes
/
openpose_inference.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
import cv2
# Import Openpose (Windows/Ubuntu/OSX)
PYOPENPOSE_DIR = "C:/Users/ruben/Documents/Github/openpose/build/python/openpose/Release"
MODELS_DIR = "C:/Users/ruben/Documents/Github/openpose/models/"
KEYPOINTS = ['nose', 'neck', 'rshoulder', 'relbow', 'rwrist', 'lshoulder','lelbow',
'lwrist', 'midhip', 'rhip', 'rknee', 'rankle', 'lhip', 'lknee', 'lankle',
'reye', 'leye', 'rear', 'lear', 'lbigtoe', 'lsmalltoe', 'lheel', 'rbigtoe',
'rsmalltoe', 'rheel']
sys.path.append(PYOPENPOSE_DIR)
import pyopenpose as op
#############################
## create csv out of openpose
#############################
params = {
'model_folder': MODELS_DIR,
'number_people_max': 1
}
# Starting OpenPose
opWrapper = op.WrapperPython()
opWrapper.configure(params)
opWrapper.start()
datum = op.Datum()
def run_openpose(frame):
datum.cvInputData = frame
opWrapper.emplaceAndPop([datum])
return datum.poseKeypoints.copy()