Python fix to #1161, #1170, and keypoint from heatmap example (#1192)

This commit is contained in:
Raaj
2019-04-15 18:44:40 -04:00
committed by Gines
parent b6058505a6
commit 1e4a785357
9 changed files with 501 additions and 369 deletions
@@ -52,28 +52,32 @@ for i in range(0, len(args[1])):
# op.init_argv(args[1])
# oppython = op.OpenposePython()
# Starting OpenPose
opWrapper = op.WrapperPython()
opWrapper.configure(params)
opWrapper.start()
try:
# Starting OpenPose
opWrapper = op.WrapperPython()
opWrapper.configure(params)
opWrapper.start()
# Read frames on directory
imagePaths = op.get_images_on_directory(args[0].image_dir);
start = time.time()
# Read frames on directory
imagePaths = op.get_images_on_directory(args[0].image_dir);
start = time.time()
# Process and display images
for imagePath in imagePaths:
datum = op.Datum()
imageToProcess = cv2.imread(imagePath)
datum.cvInputData = imageToProcess
opWrapper.emplaceAndPop([datum])
# Process and display images
for imagePath in imagePaths:
datum = op.Datum()
imageToProcess = cv2.imread(imagePath)
datum.cvInputData = imageToProcess
opWrapper.emplaceAndPop([datum])
print("Body keypoints: \n" + str(datum.poseKeypoints))
print("Body keypoints: \n" + str(datum.poseKeypoints))
if not args[0].no_display:
cv2.imshow("OpenPose 1.4.0 - Tutorial Python API", datum.cvOutputData)
key = cv2.waitKey(15)
if key == 27: break
if not args[0].no_display:
cv2.imshow("OpenPose 1.4.0 - Tutorial Python API", datum.cvOutputData)
key = cv2.waitKey(15)
if key == 27: break
end = time.time()
print("OpenPose demo successfully finished. Total time: " + str(end - start) + " seconds")
end = time.time()
print("OpenPose demo successfully finished. Total time: " + str(end - start) + " seconds")
except Exception as e:
# print(e)
sys.exit(-1)