Search code examples
mediapipe

How to reconstruct MediaPipe landmark coordinates from extracted coordinate values?


I am able to extract the landmark coordinates from results.pose_landmarks. Now, I want to send it to another device and there, using the x, y, z and visibility values, the datatype will be reconstructed so as to build the pose on a frame.


Solution

  • Store the iterated values in a list. Then use this snippet below,

    from mediapipe.framework.formats import landmark_pb2
    reconstructed = landmark_pb2.NormalizedLandmarkList(extracted_points_list)
    

    This will reconstruct the entire datatype.