I'm using this code to get keypoints from a video frame, how can I convert the keypoints from openpose to 3d using only 1 camera so I can later make an animation in blender out of them.
try:
ret, frame = cap.read()
if not ret:
raise e
datum = op.Datum()
datum.cvInputData = frame
opWrapper.emplaceAndPop(op.VectorDatum([datum]))
# Check if poseKeypoints is not None before accessing it
if datum.poseKeypoints is not None:
# Extract keypoints from the datum object
keypoints = datum.poseKeypoints
joint_names = op.getPoseBodyPartMapping(op.PoseModel.BODY_25) # Get joint names
# Assuming `keypoints_with_names` is a dictionary
keypoints_with_names = {joint_names[i]: point.tolist() for i, point in enumerate(keypoints[0])}
return keypoints_with_names, datum
except Exception as e:
print(e)
sys.exit(-1)
return None, None