To systematically analyze the effect of camera angle changes on elbow angle calculation, a standalone web-based simulator was developed using HTML, CSS, and JavaScript. Its environment is shown in
Figure 1. This simulator enables investigation of different scenarios of arm and forearm displacement relative to the camera without changing the joint angle. In this controlled environment, changes in the pixel lengths of the vectors and their ratios are analyzed, and the behavior of perspective-induced angular error is examined. The interactive visualization tool and its source code are available in a GitHub repository, with a permanent archive hosted on Zenodo.
The simulation results form the basis for designing the machine learning-based error correction model proposed in this framework. Given the nonlinear nature of perspective error, which exhibits a parabolic relationship with the rotation angle, a Random Forest Regressor was selected to estimate the error. To ensure a clear distinction between the system layers, this machine learning model is explicitly presented as a proposed theoretical component and was not trained or validated on empirical or clinical datasets in the current study. The model inputs include three features: (1) The ratio of the arm vector length to the base value, (2) the ratio of the forearm vector length to the base value, and (3) the ratio of the arm length to the forearm length. The model output is a correction value in degrees that is applied to the angle calculated by MediaPipe (
18,
19). Although implementation and training of this model require a real dataset, and no data were collected for its training in the present work, its governing logic is based on the systematic analysis of perspective error behavior in the developed simulator. The main advantage of this proposed approach is its independence from depth reconstruction or complex 3D modeling, which facilitates future implementation in clinical applications.
To ensure reproducibility, the geometric simulation parameters and mathematical formulation are defined as follows:
3.1.1. Projection Modeling
Assuming an orthogonal camera model along the Z-axis, the baseline projected lengths of the arm (L1) and forearm (L2) equal their true lengths (l1 base = L1, l2base = L2). When subjected to body rotation and arm elevation, the 2D projected lengths (l1, l2) contract nonlinearly:
The MediaPipe-derived 2D angle is calculated using the dot product of these projected vectors. The angular error plotted in
Figure 2 is defined as follows:
A, Measurement error according to body rotation angle. The red line shows the raw error, and the green dashed line shows the theoretical error after ideal calculation-based correction. B, Changes in arm image length according to elevation angle. The red line shows the projection percentage, and the green dashed line shows projected baseline stability after ideal correction.
3.1.3. Feature Engineering and Correction
Three normalized ratios were computed per frame as inputs for the proposed Random Forest Regressor:
The final corrected angle was then calculated by subtracting the predicted error: