DysTest

Inter-Pupillary Distance–Based Depth Estimation

A Clinically Robust Approach to Webcam-Based Distance Measurement

Uttam Panda, Christian Boer · Whitepaper · 2026

Accurate estimation of subject-to-screen distance is a foundational requirement for webcam-based clinical and cognitive assessment, governing both visual-angle calibration and data-quality gating. This paper presents a binocular, anatomy-driven approach to depth estimation based on Inter-Pupillary Distance (IPD), computed from MediaPipe iris-center landmarks 468 and 473. By combining the near-constant adult IPD prior with the pinhole-camera projection model, the method recovers subject distance from a single monocular webcam frame without depth sensors, structured light, or stereo baselines. We detail the landmark-averaging and head-roll-correction steps used to suppress per-frame jitter, the distance-confidence gating used to discard unreliable frames, and the age-tier IPD priors used for paediatric subjects, whose IPD differs systematically from the adult constant. We report the resulting accuracy envelope at typical assessment distances of 40–100 cm and discuss the dominant error sources: landmark localisation noise, off-axis head pose, and individual IPD variance.

1. Introduction

Webcam-based cognitive and clinical assessment platforms depend on knowing, frame by frame, how far the subject's eyes are from the camera. Subject-to-screen distance governs two things that matter for downstream measurement validity: (i) the conversion between pixel displacement and visual angle, without which no gaze or fixation measurement can be interpreted consistently across devices and seating positions, and (ii) a data-quality gate — frames captured outside a clinically reasonable working distance are excluded from calibration and scoring rather than silently degrading accuracy.

Dedicated depth sensing (structured light, stereo pairs, time-of-flight) is not available on the consumer hardware this platform targets: a single RGB webcam, frequently a laptop's built-in camera, with no guaranteed intrinsic calibration. This paper describes a monocular distance-estimation method that substitutes a stable anatomical prior — Inter-Pupillary Distance (IPD) — for a physical depth sensor, recovering subject distance from iris landmarks already produced by the platform's face-mesh model as a side effect of gaze tracking, at no additional sensing cost.

2. Background

2.1 The pinhole camera model

A standard pinhole camera projects a 3D point at distance d onto the image plane with apparent size inversely proportional to d. For an object of known real-world size S (metres), observed with apparent size s (pixels) under a camera with focal length f (pixels), the classical relation is:

d = (S × f) / s

Figure 1. Pinhole-camera geometry: the real-world Inter-Pupillary Distance S projects through the lens onto the sensor as the apparent separation s, recovering distance d once focal length f is known.

This relation requires two knowns: the true size S of the object being measured, and the camera's focal length f in pixel units. Ordinary webcams rarely expose a calibrated intrinsic matrix to browser-based JavaScript, so f must itself be estimated or treated as a per-session nuisance parameter resolved during the calibration procedure already required for gaze estimation (see Thin-Plate Spline Gaze Calibration with Adaptive Per-Point Regularization, this series). The choice of S is the subject of this paper.

2.2 Why Inter-Pupillary Distance

Facial dimensions vary considerably across individuals, but a small number of anthropometric measures are unusually stable within an age class. Inter-Pupillary Distance — the distance between the centres of the two pupils when the eyes are in primary gaze — is one of them. Population studies of adult IPD (Dodgson, 2004) report a near-normal distribution with a mean near 63 mm and a standard deviation on the order of 3–4 mm, giving a coefficient of variation low enough that a population-mean IPD is a serviceable per-subject distance prior even without individual calibration. Unlike head width, interocular canthal distance, or facial height, IPD is also minimally affected by facial expression, making it more robust to the natural movement that occurs during a child's assessment session.

3. Method

3.1 Landmark source

Distance estimation reuses the iris landmarks already produced for gaze tracking by a 478-point face-mesh model (MediaPipe FaceMesh with refineLandmarks: true), which adds ten dedicated iris landmarks (indices 468–477) to the base 468-point mesh: five points describing the left iris (centre and four boundary points) and five describing the right. The centre landmark of each iris pair — index 468 for the left eye, 473 for the right — is taken as the pupil-centre proxy for IPD measurement, avoiding the additional noise that would be introduced by averaging the four boundary points for a measurement that does not require sub-iris precision.

3.2 Binocular averaging and roll correction

A single-frame IPD estimate computed directly from the raw pixel distance between landmarks 468 and 473 is sensitive to head roll: tilting the head changes the apparent horizontal separation of the two iris centres without any change in true distance. The platform's iris-geometry routine (computeIrisOffset, shared with the gaze-calibration pipeline) corrects for this by first computing the roll angle from the eye-corner landmarks:

roll = atan2(right_eye_centre.y − left_eye_centre.y,
             right_eye_centre.x − left_eye_centre.x)

and rotating the binocular offset vector into an upright-face frame before any distance-relevant quantity is derived from it. This is the same correction applied to the gaze-offset signal, so distance estimation and gaze estimation share one geometry pipeline rather than maintaining two independently-tuned implementations that could silently drift apart.

3.3 Distance recovery

With the roll-corrected, landmark-derived IPD in pixels (IPD_px) and the population-mean adult IPD (IPD_mm ≈ 63 mm) as the size prior, subject distance follows directly from the pinhole relation in §2.1, with the camera's effective focal length in pixels obtained from the getUserMedia video track's reported field of view where available, or from a one-time calibration-distance reference frame otherwise. Because the dominant source of error in this estimate is individual deviation from the population-mean IPD rather than landmark noise (§4), distance is reported as a smoothed value over a short rolling window of frames rather than a raw per-frame number, both to suppress landmark jitter and to avoid the false precision of an instantaneous estimate.

3.4 Age-tier adjustment

Inter-Pupillary Distance grows substantially over childhood and does not reach the adult range until adolescence; pediatric ophthalmology growth-curve studies place average IPD in the high 40s (mm) at early school age, rising through the 50s in mid-childhood toward the low 60s by mid-adolescence. Because this platform serves school-age children as well as adults, the single adult-mean IPD prior of §3.3 is not appropriate across the full age range it must support. Distance estimation is therefore parameterised by the subject's declared age tier, substituting an age-appropriate IPD prior so that a 7-year-old subject is not systematically assessed as sitting closer to the camera than they actually are — an error that would, left uncorrected, propagate into every downstream visual-angle calculation for that session.

4. Error Sources and Accuracy Envelope

Three error sources dominate, in descending order of typical contribution at the platform's target working distance of 40–100 cm:

  1. Individual IPD deviation from the population/age-tier mean. This is irreducible without a per-subject calibration step and is the principal residual error in the method. At the ±3–4 mm standard deviation reported for adult IPD, the resulting distance error is on the order of a few percent of true distance — acceptable for visual-angle conversion and distance-gating purposes, but not a substitute for a true depth sensor where sub-centimetre accuracy is required.
  2. Landmark localisation noise. Sub-pixel jitter in the MediaPipe iris-centre estimate is the second-order contributor; it is suppressed by the rolling-window smoothing of §3.3 rather than corrected geometrically, since it is approximately zero-mean across frames.
  3. Off-axis head pose. Extreme yaw (the subject turned far enough that one eye approaches self-occlusion) degrades the iris-centre estimate for the occluded eye before it degrades the binocular distance calculation, because severe yaw is already excluded upstream by the platform's head-alignment quality gate before a frame is accepted into calibration or scoring.

5. Discussion

The central design decision in this method is treating IPD as a population/age-tier prior rather than attempting per-subject biometric calibration of true IPD from a reference object of known size. This trades a small, well-characterised systematic error (individual deviation from the age-tier mean) for the ability to estimate distance from the first frame of a session, with no separate "hold a credit card to the camera"-style calibration step that would add friction to an assessment already asking a young child to sit through a multi-stage protocol. Given that distance is used here primarily as a gate (is the subject within a workable range?) and a visual-angle scale factor, rather than as a clinical measurement in its own right, this trade is appropriate; a platform whose primary output depended on absolute distance accuracy at the millimetre level would need a different design.

6. Conclusion

Reusing iris-centre landmarks already computed for gaze tracking, together with a population- and age-tier-appropriate Inter-Pupillary Distance prior and a head-roll correction shared with the gaze pipeline, this method recovers clinically serviceable subject-to-screen distance from a single uncalibrated RGB webcam, with no additional hardware and no separate calibration step.

References

  1. Dodgson, N. A. (2004). Variation and extrema of human interpupillary distance. Proceedings of SPIE: Stereoscopic Displays and Virtual Reality Systems XI, 5291, 36–46.
  2. Kartynnik, Y., Ablavatski, A., Grishchenko, I., & Grundmann, M. (2019). Real-time facial surface geometry from monocular video on mobile GPUs. arXiv:1907.06724.
  3. Lugo-Hernandez, E. et al. (2022). Pediatric interpupillary distance growth curves: a normative reference. Journal of Pediatric Ophthalmology & Strabismus, 59(4).
  4. Hartley, R., & Zisserman, A. (2004). Multiple View Geometry in Computer Vision (2nd ed.). Cambridge University Press. [Pinhole camera model, Ch. 6]

Appendix A — Landmark Reference

Landmark index Description
468 Left iris centre
469–472 Left iris boundary (4 points)
473 Right iris centre
474–477 Right iris boundary (4 points)
33, 133 Left eye outer / inner canthus
263, 362 Right eye outer / inner canthus

Appendix B — Roll-Correction Formula

Given left/right eye-centre points (lcx, lcy) and (rcx, rcy) derived from the canthus landmarks above:

roll = atan2(rcy − lcy, rcx − lcx)
[gx', gy'] = [gx·cos(−roll) − gy·sin(−roll), gx·sin(−roll) + gy·cos(−roll)]

applied to any binocular offset vector (gx, gy) — including the IPD vector used for distance — before it is used downstream, projecting the raw measurement into an upright-face reference frame invariant to head tilt.

Important: DysTest is a screening tool and does not provide a formal medical diagnosis.