Day 78: The pragmatic approach: height scaling pose keypoints
A reference you can actually get: user height
The roadmap's pragmatic calibration: ask the user for their height. Their pixel height (top-of-head to feet keypoints) plus their known real height gives a scale factor (cm per pixel), which converts every other pixel measurement to centimeters. It's not perfect β it assumes the person is roughly upright and fronto-parallel to the camera β but it's a real, obtainable reference, and it's honest about its assumptions.
def scale_factor_cm_per_px(pose, real_height_cm):
head = point(pose.NOSE) # approx top; better: use head landmarks
ankle = point(pose.LEFT_ANKLE)
pixel_height = dist(head, ankle) * head_to_ankle_correction
return real_height_cm / pixel_height # cm per pixel
def to_cm(px_measurement, scale):
return px_measurement * scaleName the assumptions, because they are the error sources
Height calibration assumes: the person is standing straight, roughly parallel to the camera plane, fully in frame, and the height input is accurate. Each broken assumption is an error source β a tilted pose, a lean-back, foreshortening. Documenting these assumptions *is* documenting your error model, which is exactly what Day 80 and the README require.
Key terms
- Scale factor
- The cm-per-pixel ratio derived from a known real dimension (user height) and its pixel measurement.
- Fronto-parallel assumption
- The assumption that the person's body plane is parallel to the camera, so widths are not foreshortened.
The height-based calibration converts pixels to cm using the user's known height. What is its key limitation?