###### Abstract  
The arterial blood sample collector produced in large quantities often fails to meet the requirements due to missing components in the packaging bag, and traditional manual detection methods are both inefficient and inaccurate. To solve this problem, a PyCharm-integrated development environment was used to study image processing and recognition algorithms for identifying components inside the packaging bag of the HN-3 arterial blood sample collector. The machine vision system was used to capture images of the packaging bags of the HN-3 Arterial blood sample collector. Template matching was employed to extract the packaging ROI, and the threshold segmentation method in the HSV color model was used to extract material features based on the packaging ROI. Morphological processing algorithms such as dilation or erosion were used to enhance the connectivity of the extracted features. The existence of components was determined by setting thresholds for the connected domain area or length. The results of the recognition experiment show that the false detection rate is 0.2%, the missed detection rate is 0%, and the average image processing time per product is no more than 39 ms. Compared with manual recognition methods, the efficiency and accuracy have been improved by 36.5 times and 2.3%, respectively. The experimental results confirm the effectiveness of the image processing algorithm. arterial blood collection device; machine vision; ROI extraction; HSV color model +
Footnote †: journal: Medical and Electrical Engineering  
0000-0002-2300-3300][PERSON]  
0000-0002-2300-3300][PERSON]  
0000-0002-2300-3300-3300-3300-3300-3300-3300-3300-3300-3300-3300-33000-3300-3300-3300-33000-3300-33000-33000-33  
Performing automated machine vision inspection using image processing techniques is a common practice in industrial settings to ensure product quality before packaging and shipment to customers [2]. Several studies have focused on quality inspection algorithms and defect recognition systems based on machine vision technology for various products, such as ampoule packaging [3], online packaging defect recognition [4], and detecting adulterated candy in bag packaging using Raman hyperspectral imaging [5]. However, there have been no reports on component missing inspection specifically for arterial blood sample collectors after packaging. This article uses PyCharm as the development environment to study the arterial blood sample collector packaging component missing detection algorithm based on machine vision. The PyCharm-integrated development environment is configured with software packages such as Opencv4.4.0 and modbus_tk that depend on the Python language. Opencv software package is used for image processing operations, and Modbus-TCP protocol is implemented using the Modbus_tk software package to achieve data exchange between the PC and the sorting system PLC. The image algorithm is divided into three modules: packaging image ROI (region of interest) extraction, threshold segmentation, and component recognition. The packaging ROI extraction module locates key areas in the image to ensure that image processing focuses on the component area, thus increasing feature segmentation reliability. The threshold segmentation module converts the extracted ROI image from the RGB color space to the HSV color space and divides it into H, S, and V channels. These channels are then used to extract the characteristics of the plunger, drawbar piston, cone head seal, and blood collection needle tip based on thresholding techniques. The comprehensive judgment module determines the inspection result based on the area value and distance value of the connected components. By developing this machine-vision-based algorithm, the aim is to address the issue of components missing from inspection in arterial blood sample collectors after packaging, providing a reliable solution for quality control in the manufacturing process.