Skip to content

Commit

Permalink
fix the example_code path and bug
Browse files Browse the repository at this point in the history
  • Loading branch information
u0251077 committed Aug 5, 2020
1 parent ce0b8d0 commit f7cb071
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions example_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import os
from sys import platform
import argparse
import pyopenpose as op

try:
"""
# Import Openpose (Windows/Ubuntu/OSX)
dir_path = os.path.dirname(os.path.realpath(__file__))
try:
Expand All @@ -25,15 +27,15 @@
except ImportError as e:
print('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
raise e

"""
# Flags
parser = argparse.ArgumentParser()
parser.add_argument("--image_path", default="../../../examples/media/COCO_val2014_000000000192.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
parser.add_argument("--image_path", default="../../examples/media/COCO_val2014_000000000192.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).")
args = parser.parse_known_args()

# Custom Params (refer to include/openpose/flags.hpp for more parameters)
params = dict()
params["model_folder"] = "../../../models/"
params["model_folder"] = "../../models/"

# Add others in path?
for i in range(0, len(args[1])):
Expand Down Expand Up @@ -64,8 +66,9 @@

# Display Image
print("Body keypoints: \n" + str(datum.poseKeypoints))
cv2.imshow("OpenPose 1.6.0 - Tutorial Python API", datum.cvOutputData)
cv2.waitKey(0)
cv2.imwrite("result_body.jpg", datum.cvOutputData)
#cv2.imshow("OpenPose 1.6.0 - Tutorial Python API", datum.cvOutputData)
#cv2.waitKey(0)
except Exception as e:
print(e)
sys.exit(-1)

0 comments on commit f7cb071

Please sign in to comment.