mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

mediapipe custom pose connections

Open PaulosKapa opened this issue 6 months ago • 0 comments

I am using mediapipe with javascript. Everything works alright until i try to show connections between spesific landmarks (in my case bettween landmarks 11, 13, 15, 12, 14, 16)

here is my custom connections array:

const myConnections = [
    [11, 13], // Left Shoulder to Left Elbow
    [13, 15], // Left Elbow to Left Wrist
    [12, 14], // Right Shoulder to Right Elbow
    [14, 16], // Right Elbow to Right Wrist
];

here is how i call them


// Draw connections
      drawingUtils.drawConnectors(landmarks, myConnections, { color: '#00FF00', lineWidth: 4 });

I can draw only the landmarks i want, but not the connections between them. I tried logging the landmarks to see if they aren't recognised, and they returned values for X, Y, Z with VISIBILITY being UNDEFINED

console.log("Landmark 11 (Left Shoulder):", landmarks[11].visibility);
      console.log("Landmark 13 (Left Elbow):", landmarks[13].x);
      console.log("Landmark 15 (Left Wrist):", landmarks[15].y);

I tried changing the array to something like the code below and call them with the

drawingUtils.drawConnectors()

but it didnt work.

const POSE_CONNECTIONS = [
    [PoseLandmarker.LEFT_SHOULDER, PoseLandmarker.LEFT_ELBOW],
    [PoseLandmarker.LEFT_ELBOW, PoseLandmarker.LEFT_WRIST],
    [PoseLandmarker.RIGHT_SHOULDER, PoseLandmarker.RIGHT_ELBOW],
    [PoseLandmarker.RIGHT_ELBOW, PoseLandmarker.RIGHT_WRIST]
];

I used some generated code with a previous version of the mediapipe api (pose instead of vision) and it was working there

PaulosKapa avatar Jun 03 '25 12:06 PaulosKapa