Skip to content

Instantly share code, notes, and snippets.

@ledmonster
Created November 16, 2019 07:42
Show Gist options
  • Save ledmonster/2d0c2f2e1f493d27a99c9f1784b57763 to your computer and use it in GitHub Desktop.
Save ledmonster/2d0c2f2e1f493d27a99c9f1784b57763 to your computer and use it in GitHub Desktop.
openpose sample
import sys
sys.path.append('/usr/local/python')
import cv2
from openpose import pyopenpose as op
def main():
params = {
"model_folder": "/Users/junya/work/openpose/models/",
}
# Starting OpenPose
opWrapper = op.WrapperPython()
opWrapper.configure(params)
opWrapper.start()
# Process Image
datum = op.Datum()
imageToProcess = cv2.imread("/Users/junya/Pictures/Profile/200511_junya.jpg")
datum.cvInputData = imageToProcess
opWrapper.emplaceAndPop([datum])
# Display Image
print("Body keypoints: \n" + str(datum.poseKeypoints))
cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", datum.cvOutputData)
cv2.waitKey(0)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment