Day 58: From keypoints to limb lengths: the geometry
Turning points into distances
Keypoints are coordinates; measurements are *distances between* them. Shoulder width is the distance between left and right shoulder landmarks; arm length sums shoulder→elbow and elbow→wrist; torso height runs shoulder-midpoint to hip-midpoint. This is Stage 0 Day 7's vectors made concrete — the Euclidean distance between two points is a straight application of the geometry you reviewed.
import numpy as np
def point(lm, w, h):
return np.array([lm.x * w, lm.y * h]) # normalized -> pixel coords
def dist(a, b):
return float(np.linalg.norm(a - b)) # Euclidean distance
ls, rs = point(L.LEFT_SHOULDER, w, h), point(L.RIGHT_SHOULDER, w, h)
le, lw = point(L.LEFT_ELBOW, w, h), point(L.LEFT_WRIST, w, h)
shoulder_width_px = dist(ls, rs)
arm_length_px = dist(ls, le) + dist(le, lw) # two-segment sumRobustness through redundancy
Where the body is symmetric, measure both sides and average (or take the more-visible side) — left and right shoulder-to-elbow should roughly agree, and a big disagreement flags a bad keypoint. Building these sanity checks in now is far cheaper than discovering during Day-84 validation that one arm's landmarks were unreliable all along.
Key terms
- Euclidean distance
- The straight-line distance between two points; here, the pixel distance between two keypoints.
- Limb length
- A body measurement derived by summing distances between successive joint keypoints.
- Symmetry check
- Comparing left/right measurements that should agree, as a sanity check on keypoint quality.
You measure left shoulder-to-elbow as 180px and right shoulder-to-elbow as 240px in a front-on photo. What does this most likely indicate?