mirror of
https://github.com/gosticks/openpose.git
synced 2026-08-14 21:30:17 +00:00
@@ -54,34 +54,38 @@ 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()
|
||||
|
||||
# Process Image
|
||||
datum = op.Datum()
|
||||
imageToProcess = cv2.imread(args[0].image_path)
|
||||
datum.cvInputData = imageToProcess
|
||||
opWrapper.emplaceAndPop([datum])
|
||||
# Process Image
|
||||
datum = op.Datum()
|
||||
imageToProcess = cv2.imread(args[0].image_path)
|
||||
datum.cvInputData = imageToProcess
|
||||
opWrapper.emplaceAndPop([datum])
|
||||
|
||||
# Process outputs
|
||||
outputImageF = (datum.inputNetData[0].copy())[0,:,:,:] + 0.5
|
||||
outputImageF = cv2.merge([outputImageF[0,:,:], outputImageF[1,:,:], outputImageF[2,:,:]])
|
||||
outputImageF = (outputImageF*255.).astype(dtype='uint8')
|
||||
heatmaps = datum.poseHeatMaps.copy()
|
||||
heatmaps = (heatmaps).astype(dtype='uint8')
|
||||
# Process outputs
|
||||
outputImageF = (datum.inputNetData[0].copy())[0,:,:,:] + 0.5
|
||||
outputImageF = cv2.merge([outputImageF[0,:,:], outputImageF[1,:,:], outputImageF[2,:,:]])
|
||||
outputImageF = (outputImageF*255.).astype(dtype='uint8')
|
||||
heatmaps = datum.poseHeatMaps.copy()
|
||||
heatmaps = (heatmaps).astype(dtype='uint8')
|
||||
|
||||
# Display Image
|
||||
counter = 0
|
||||
while 1:
|
||||
num_maps = heatmaps.shape[0]
|
||||
heatmap = heatmaps[counter, :, :].copy()
|
||||
heatmap = cv2.applyColorMap(heatmap, cv2.COLORMAP_JET)
|
||||
combined = cv2.addWeighted(outputImageF, 0.5, heatmap, 0.5, 0)
|
||||
cv2.imshow("OpenPose 1.4.0 - Tutorial Python API", combined)
|
||||
key = cv2.waitKey(-1)
|
||||
if key == 27:
|
||||
break
|
||||
counter += 1
|
||||
counter = counter % num_maps
|
||||
# Display Image
|
||||
counter = 0
|
||||
while 1:
|
||||
num_maps = heatmaps.shape[0]
|
||||
heatmap = heatmaps[counter, :, :].copy()
|
||||
heatmap = cv2.applyColorMap(heatmap, cv2.COLORMAP_JET)
|
||||
combined = cv2.addWeighted(outputImageF, 0.5, heatmap, 0.5, 0)
|
||||
cv2.imshow("OpenPose 1.4.0 - Tutorial Python API", combined)
|
||||
key = cv2.waitKey(-1)
|
||||
if key == 27:
|
||||
break
|
||||
counter += 1
|
||||
counter = counter % num_maps
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
sys.exit(-1)
|
||||
Reference in New Issue
Block a user