mirror of
https://github.com/gosticks/openpose.git
synced 2026-08-13 04:40:26 +00:00
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user