## 4 Discussion
The proposed system integrates the benefits of image-based digital methods [11; 13; 14; 15; 16; 17; 18; 19; 20; 21] with the ease of use of a smartphone, which is connected to a transtibial prosthesis. This innovative and accessible approach to automatic LLD compensation represents a substantial advancement in the field. The experimental results revealed the progression of the SATP process for automatic compensation of simulated LLD. It was observed that the SATP exhibited an incremental compensation pattern, reflecting the prosthesis's response to the detection of leg length discrepancy. The consistent compensation rate indicates a stable automatic control system, allowing for rapid assessment of LLD and gradual restoration of body alignment, without inducing abrupt variations, unwanted oscillations, or significant overcompensation. The results obtained from the present study demonstrate that the implementation of this compensation method has the potential to ensure the maintenance of an appropriately sized prosthesis over an extended period, particularly in cases involving growing children. Additionally, its application in patients utilizing temporary prostheses following amputation could facilitate adjustment to a prosthesis of the correct size. It is imperative to acknowledge the significance of this aspect in the prevention of limb length discrepancies and the subsequent secondary conditions that may arise. The system was evaluated using 1000 frames recorded under strictly controlled laboratory conditions, with constant indoor lighting and fixed camera placement. In this environment, the system correctly identified alignment in 94.6% of frames. The maximum observed angular deviations from the calibrated baselines were: \(\Delta\theta\_\)middle = 2.814\({}^{\circ}\), \(\Delta\theta\_\)upper = 1.888\({}^{\circ}\)  
Frames exceeding the calibrated tolerances (\(\pm\)0.073\({}^{\circ}\) for the middle line, \(\pm\)0.90\({}^{\circ}\) for the upper line) were flagged as misaligned, indicating a leg length discrepancy (LLD). Preliminary occlusion tests showed that the system remained functional with up to 50% of a marker partially blocked, but alignment detection failed when occlusion exceeded this threshold. These results demonstrate the algorithm's reliability and accuracy under stable, repeatable laboratory conditions. This study introduced a self-adaptive prosthetic control system that incorporates a vision-based mechanism for detecting and correcting leg length discrepancies (LLD) in real time. The system employs a calibrated, marker-based computer vision algorithm operating on high-resolution video input (3840 \(\times\) 2160), utilizing HSV color segmentation and centroid-based geometric analysis to extract and evaluate angular relationships between the prosthesis and fixed wall reference markers. Calibration trials conducted under controlled laboratory conditions established baseline angular references of \(\theta\_\)middle = 161.2\({}^{\circ}\) and \(\theta\_\)upper = 108.2\({}^{\circ}\), with corresponding tolerances of \(\pm\)0.073\({}^{\circ}\) and \(\pm\)0.90\({}^{\circ}\), determined through statistical analysis of 60 aligned frames. The algorithm achieved a correct alignment detection rate of 94.6% across 1000 test frames, with maximum observed deviations of 2.81\({}^{\circ}\) and 1.88\({}^{\circ}\) for the middle and upper lines, respectively. Additional tests confirmed stable performance while occlusion resistance was maintained up to 50% marker coverage. In the present study, the proposed SATP correction system achieved a mean absolute error of 0.134 mm, calculated based on the test case set, with a maximum individual error of 0.28 mm. These values are significantly below the lowest clinically relevant threshold for LLD (i.e., 5 mm), which is generally considered the lower limit at which long-term complications may begin to appear [4; 7; 8].