## 3 Experimental Methods and Results
### Image Processing Process  
In this study, we utilized an image processing approach to measure the position of the distal end of the input tube and calculate the cutting position. When the plasma bag arrived at the image acquisition point, the camera captured an image of the bag, which was then saved to a designated folder. The original picture of the plasma bag, as shown in Figure 8a, was preprocessed to improve the speed of the algorithm. In this study, we conducted grayscale conversion [16; 17] on the captured image, and the resulting image is depicted in Figure 8b. The grayscale image was obtained using the formula \(\mathrm{Gray}(i,j)=0.30*R(i,j)+0.59*G(i,j)+0.11*B(i,j)\). Then, we converted the grayscale image to a binary image using a threshold value of \(T_{h}=20\), which was determined based on preliminary experiments. The binary image, shown in Figure 8c, was processed to extract the disk's edge, which was identified as the black boundary. As the acquired image only covered a small part of the disk, we performed circular fitting on the continuous edge using the least-squares method to estimate the circle's parameters and determine the disk's center coordinates in the camera coordinate system. The input tube of the plasma bag was recognized by first extracting the bag's color [18; 19; 20; 21] and constructing a corresponding color image. Then, the Euclidean distance between each pixel in the camera-captured image and each pixel in the constructed-color image was calculated. Following optimization and experimentation, a recognition distance of Dos = 25 was selected for the input tube's color identification. Any pixel in the sampled photo whose distance to the similar pixel in the image was less than Dos satisfied the recognition distance criterion. A mask image was then constructed based on the corresponding pixel  
Figure 8: Disc image processing process: (a) disc shot raw image, (b) grayscale image, and (c) binarized image. Figure 7: Plot of the difference in distance from the end of the braid to the edge of the plasma bag. points in the sampled photo, with the input tube's position marked as 255 and all other unsatisfied pixel values set to 0, resulting in the mask image of the input tube's location, as shown in Figure 9a. We performed corner-point detection [22; 23; 24; 25] on the mask image to identify pixels with a high rate of change. After calibration, we selected a threshold value of 100 and marked the corner points with circles, and plotted them on the graph. We applied a cyclic function to filter out low-confidence corner points and identify reliable ones. Thus, we found the endpoint of the plasma input tube among all corner points. In addition, the image was input in a circular way. If the pixel value was higher than the threshold value, then the point was a corner point and plotted on the graph; if it was lower than the threshold value, then the point could be discarded directly. Utilizing the identified corner points, we calculated the distance from the previously obtained disc outline to pinpoint the end of the input tube. The endpoint was determined as the corner point that was closest to the disc. Figure 9b shows the identified corner points. In this study, after obtaining the pixel distance, we converted it to linear distance [26; 27]. The triangulation method was employed to calibrate the actual distance as the scaling ratios for the horizontal and vertical directions in the image were not the same, which required calibration of two sets of points to solve the equation. The following two equations were used:  
\[\left[(X_{1}-X_{2})\times d_{x}\right]^{2}+\left[(Y_{1}-Y_{2})\times d_{y} \right]^{2}={d_{1}}^{2} \tag{8}\]  
\[\left[(X_{3}-X_{4})\times d_{x}\right]^{2}+\left[(Y_{3}-Y_{4})\times d_{y} \right]^{2}={d_{2}}^{2} \tag{9}\]  
The distance of the residual-input tube in practice was derived from the values obtained for \(d_{x}\) and \(d_{y}\) and the previously obtained pixel distances.