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
@@ -54,39 +54,43 @@ 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 image and face rectangle locations
imageToProcess = cv2.imread(args[0].image_path)
handRectangles = [
# Left/Right hands person 0
[
op.Rectangle(320.035889, 377.675049, 69.300949, 69.300949),
op.Rectangle(0., 0., 0., 0.),
],
# Left/Right hands person 1
[
op.Rectangle(80.155792, 407.673492, 80.812706, 80.812706),
op.Rectangle(46.449715, 404.559753, 98.898178, 98.898178),
],
# Left/Right hands person 2
[
op.Rectangle(185.692673, 303.112244, 157.587555, 157.587555),
op.Rectangle(88.984360, 268.866547, 117.818230, 117.818230),
# Read image and face rectangle locations
imageToProcess = cv2.imread(args[0].image_path)
handRectangles = [
# Left/Right hands person 0
[
op.Rectangle(320.035889, 377.675049, 69.300949, 69.300949),
op.Rectangle(0., 0., 0., 0.),
],
# Left/Right hands person 1
[
op.Rectangle(80.155792, 407.673492, 80.812706, 80.812706),
op.Rectangle(46.449715, 404.559753, 98.898178, 98.898178),
],
# Left/Right hands person 2
[
op.Rectangle(185.692673, 303.112244, 157.587555, 157.587555),
op.Rectangle(88.984360, 268.866547, 117.818230, 117.818230),
]
]
]
# Create new datum
datum = op.Datum()
datum.cvInputData = imageToProcess
datum.handRectangles = handRectangles
# Create new datum
datum = op.Datum()
datum.cvInputData = imageToProcess
datum.handRectangles = handRectangles
# Process and display image
opWrapper.emplaceAndPop([datum])
print("Left hand keypoints: \n" + str(datum.handKeypoints[0]))
print("Right hand keypoints: \n" + str(datum.handKeypoints[1]))
cv2.imshow("OpenPose 1.4.0 - Tutorial Python API", datum.cvOutputData)
cv2.waitKey(0)
# Process and display image
opWrapper.emplaceAndPop([datum])
print("Left hand keypoints: \n" + str(datum.handKeypoints[0]))
print("Right hand keypoints: \n" + str(datum.handKeypoints[1]))
cv2.imshow("OpenPose 1.4.0 - Tutorial Python API", datum.cvOutputData)
cv2.waitKey(0)
except Exception as e:
# print(e)
sys.exit(-1)