## 3 Results
### Experimental Testing of the Prosthetic System for LLD Correction  
#### 3.4.1 Incorporation of the LLD Detection Method into the Correction Algorithm  
A methodology for evaluating limb length discrepancy (LLD) was previously validated in a separate publication [20]. In the present study, a novel component of the algorithm was evaluated, specifically for the automatic correction of LLD with the self-adjusting transtibial prosthesis. The adapted algorithm is illustrated in Figure 9.  
In order to achieve a comprehensive understanding of the detection process, Figure 9 provides a concise overview of the requisite steps for determining LLD and the manner in which they are incorporated into the novel algorithm for correcting LLD using the transtibial prosthesis.  
Figure 9: The algorithm for detecting and compensating for LLD (1—strategic placement of markers; 2—positioning the video camera in front of the mannequin; 3—simulating LLD: 3 mm and 5 mm; 4—using the IP Webcam Pro® application and managing the elongation or shortening of the EPM; 5—detecting the markers using the HUE method—Hue, Saturation, Value; 6—applying a binary mask for visualizing the markers; 7—morphological operations of dilation on the markers; 8—detecting LLD by comparing the initial position with the final position of the markers after activating the EPM (adapted from [20]).  
It is imperative to analyze the alignment errors between the detected markers on the two limbs to compensate for the leg length discrepancy. These discrepancies must be sufficiently minimal to guarantee the adequate adjustment of the prosthesis length. In this regard, the lines generated by the software must be nearly parallel, and the differences between them must be kept below a preset value, chosen according to the system tolerances. This alignment process is carried out by processing data regarding the positioning of the markers placed on both limbs and evaluating the errors against an acceptable tolerance, which guarantees the accuracy of the adjustment.  
The prosthetic system under development operates through the implementation of a meticulously designed algorithm. Following the establishment of the reference positioning, the algorithm undertakes a comparison between the position of the blue line, which represents the alignment of the prosthesis, and the reference position. This is achieved by ensuring that both limbs (the intact and the artificial) are aligned. During this process, the algorithm calculates the angles formed between the two lines, and if the difference between them exceeds a predefined threshold, the EPM actuator is activated to align the artificial limb with the intact one [20].  
Subsequent to this adjustment, the system performs a re-evaluation of the marker positions (returning to Step 3 in Figure 9) to ascertain if LLD persists. If the alignment errors, calculated based on the angle differences, are below a predefined limit, the EPM automatically stops the movement, concluding that the prosthesis position is correct and that the adjustment has been made according to the system's requirements.  
Consequently, the EPM functions in a continuous manner until the alignment discrepancies become sufficiently minimal, thereby enabling the prosthesis to attain an optimal position. Subsequent to the fulfilment of this condition (after Step 8 in Figure 9), the motor ceases operation automatically. This signifies that the process of leg length discrepancy compensation has been completed and that the prosthesis is correctly aligned.