Image recognition-based syringe precision real-time detection method

By using a multi-view imaging system and an improved feature extraction algorithm, combined with dynamic illumination adjustment and refraction compensation, the problems of low accuracy and weak anti-interference ability of existing syringe detection methods are solved, realizing efficient, real-time, and automated detection of syringe accuracy, which is applicable to medical and industrial syringes.

CN121904046BActive Publication Date: 2026-06-19JINJIANG JINGBO KNITTING MASCH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINJIANG JINGBO KNITTING MASCH CO LTD
Filing Date
2026-03-24
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing methods for detecting the precision of syringes suffer from problems such as large errors, poor reproducibility, low detection efficiency, weak anti-interference ability, inability to provide real-time feedback, and inability to effectively address the refractive effect of transparent syringes and dynamic deformation during production.

Method used

A real-time detection method based on image recognition is adopted, which combines a multi-view imaging system, dynamic illumination adjustment, refraction compensation, improved feature extraction and dynamic deformation compensation with a multi-scale multi-structural element morphological edge detection algorithm to achieve efficient and real-time detection of syringe accuracy.

Benefits of technology

It achieves high-precision detection of key parameters such as syringe inner diameter, outer diameter, and scale lines, with errors controlled within ±0.01mm. The detection accuracy is improved, the reliability and stability of feature extraction are greatly enhanced, it adapts to dynamic deformation of the production line, is compatible with various syringe materials, and reduces manual intervention and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121904046B_ABST
    Figure CN121904046B_ABST
Patent Text Reader

Abstract

This invention discloses a real-time syringe accuracy detection method based on image recognition, belonging to the field of image recognition technology. The invention includes the following steps: constructing a multi-view imaging system and completing syringe positioning; acquiring images from multiple views and preprocessing them using dynamic illumination adjustment and refraction compensation algorithms; extracting key syringe features using an improved visual saliency-morphological fusion algorithm; completing dynamic deformation compensation and accuracy parameter calculation based on a MeanShift contour tracking and group decision fusion model; and determining the detection results in real time and feeding them back to the production line. This invention, by adjusting the power of each LED unit in a ring-shaped adaptive light source array in real time, accurately calculates the refraction offset of edge pixels and completes coordinate correction based on the syringe wall thickness, refractive index, and shooting angle. Simultaneously, it designs a multi-scale, multi-structural element morphological edge detection algorithm to adapt to various structural elements and multi-scale operations for different syringe features, thereby improving the accuracy of the detection method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition, specifically to a real-time precision detection method for syringes based on image recognition. It is applicable to the online real-time detection of key precision parameters such as inner diameter, outer diameter, scale spacing, syringe wall thickness, and tube chamfer of various syringes, including medical syringes and industrial syringes, enabling high-precision control throughout the entire syringe production process. Background Technology

[0002] As precision injection instruments (especially medical syringes), the geometric accuracy of syringes (e.g., inner diameter error must be less than or equal to ±0.05mm, and graduation line spacing error must be less than or equal to ±0.1mm) directly affects the accuracy of drug dosage or industrial injection precision. Therefore, precision testing during syringe production is a core aspect of ensuring product quality. Existing syringe precision testing methods are mainly divided into three categories:

[0003] 1. Manual inspection: Relying on visual observation by inspectors in conjunction with tools such as calipers, this method suffers from problems such as large errors, poor reproducibility, high labor intensity, and low inspection efficiency. It is difficult to adapt to the needs of digital and automated production and cannot achieve real-time inspection and feedback.

[0004] 2. Traditional machine vision inspection: It adopts ordinary image acquisition and simple edge detection algorithms (such as Sobel and Canny operators), which have defects such as weak anti-interference ability (susceptible to uneven lighting, scratches on the surface of the syringe, and stains), insufficient detection accuracy (especially unable to effectively deal with the refraction effect of transparent syringes), and inaccurate feature extraction. In addition, it does not consider the impact of dynamic deformation during the syringe production process.

[0005] 3. Infrared or 3D scanning detection: Some methods use infrared imaging to construct 3D point clouds for comparison, but they have problems such as high equipment cost, slow detection speed (unable to meet the real-time requirements of the production line), complex algorithms and susceptibility to environmental temperature interference, making it difficult to promote and apply on a large scale.

[0006] Therefore, there is an urgent need for a real-time syringe accuracy detection method that has high detection accuracy, strong anti-interference ability, fast detection speed, controllable cost, and can effectively cope with the refraction effect of transparent syringes and dynamic deformation during production, so as to solve the shortcomings of existing technologies. Summary of the Invention

[0007] The purpose of this invention is to provide a real-time syringe accuracy detection method based on image recognition. By adjusting the power of each LED unit in the ring adaptive light source array in real time, the method accurately calculates the refractive offset of edge pixels and completes coordinate correction based on the syringe wall thickness, refractive index, and shooting angle. At the same time, a multi-scale, multi-structural element morphological edge detection algorithm is designed to adapt to various structural elements and multi-scale operations of different syringe features. This solves the problems of low accuracy, weak anti-interference ability, inability to provide real-time feedback, and insufficient response to the refractive effect of transparent syringes in existing detection methods.

[0008] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution:

[0009] This invention relates to a real-time syringe accuracy detection method based on image recognition, comprising the following steps:

[0010] Step S1, Detection System Setup and Syringe Positioning: Build a multi-view imaging system, clamp and fix the syringe to be tested on a pneumatic rotating platform, and collect 360° full-circumference images of the syringe by controlling the rotating platform to rotate at a constant speed.

[0011] Step S2, Multi-view image acquisition and preprocessing: Control 4 industrial cameras to simultaneously acquire 360° full-circumference images of the syringe. Based on the material characteristics of the syringe, adjust the power of each LED unit in the ring adaptive light source array through a dynamic illumination adjustment algorithm. Then, correct the refraction offset of the syringe edge pixels through a refraction compensation algorithm. Combined with an improved adaptive filtering algorithm, perform noise reduction processing. Finally, normalize the image.

[0012] Step S3, Improved Feature Extraction: An improved visual saliency-morphological fusion algorithm is adopted. First, the saliency of key features of the syringe is enhanced by an improved frequency-tuned visual saliency detection algorithm. Then, the edge features of the syringe inner diameter, outer diameter, scale lines, and chamfer of the nozzle are extracted by a multi-scale multi-structural element morphological edge detection algorithm. After contour refinement and screening, the effective contour is obtained.

[0013] Step S4, Dynamic Deformation Compensation and Group Decision Accuracy Calculation: Based on the effective contour extracted in step S3, the MeanShift algorithm is used to track the movement trajectory of the contour points. Combined with the preset deformation model, the dynamic deformation of the syringe is corrected through the dynamic deformation compensation algorithm. The reliability of the accuracy parameters from four perspectives is calculated. Through the group decision fusion model, the final accuracy parameters of the syringe inner diameter, outer diameter, scale spacing, wall thickness, and tube opening chamfer radius are calculated.

[0014] Step S5, Real-time Judgment and Feedback: Compare the final accuracy parameters obtained in step S4 with the preset qualified standard range to determine whether the product is qualified or not, and transmit the test results to the production line control system in real time to realize automatic sorting of unqualified products and traceability of test data.

[0015] As a preferred technical solution, in step S1, the multi-view imaging system includes: four high-resolution industrial cameras (resolution ≥ 12 million pixels, frame rate ≥ 30fps), a ring adaptive light source array (composed of 12 groups of adjustable power LED units, wavelength 450-550nm, adapted for transparent syringe imaging), a pneumatic rotating platform (adjustable rotation speed, built-in FPGA controller and temperature compensation module), an image acquisition card, and an industrial control host; wherein, the four industrial cameras are located one each in the orthogonal X-axis and Y-axis directions (field of view 60°), and one at each end of the syringe axis (field of view 30°), and the ring light source array is distributed at 360° equal intervals on a ring support with a diameter of 300mm, and the pitch angle is adjustable;

[0016] The syringe to be tested is fixed on a pneumatic rotating platform using a pneumatic clamp made of flexible material to avoid squeezing and deforming the syringe. The FPGA controller controls the rotating platform to rotate at a constant speed of 120 rpm to ensure that the multi-view camera 1 can acquire a 360° full-circumference image of the syringe. At the same time, the initial positioning image is acquired by an industrial camera, and the reference points at both ends of the syringe are located based on the Harris corner detection algorithm to establish the axial coordinate system of the syringe and complete the automatic positioning of the syringe.

[0017] As a preferred technical solution, in step S2, four industrial cameras are controlled to simultaneously acquire images of the syringe. Each set of images is acquired every 30° rotation, with four images in each set (corresponding to four perspectives). The acquisition frequency is linked to the production line speed (adapted to the production line speed of 0.5-2m / min), ensuring that 12 sets of images, totaling 48 images, are acquired for each syringe, achieving 360° coverage without blind spots. The acquired images are transmitted to the industrial control host in real time via an image acquisition card.

[0018] Based on the light transmittance characteristics of the syringe material (transparent glass or plastic), a dynamic illumination power adjustment algorithm is adopted to automatically adjust the power of each LED unit in the ring light source array according to the real-time acquired image brightness and contrast, avoiding reflections caused by excessive light and feature blurring caused by insufficient light; the formula for the dynamic illumination power adjustment algorithm is as follows:

[0019] ;

[0020] In the formula, For the first Real-time power adjustment of each LED unit ; This is the proportionality coefficient. This is the preset optimal image contrast. For the first The real-time image contrast of the corresponding area for each LED unit is calculated from the image grayscale histogram. This is the reference power for the LED unit. This represents the minimum power of the LED unit.

[0021] As a preferred technical solution, in step S2, when the refraction compensation algorithm corrects the refraction offset of the syringe edge pixels, it is based on the preset wall thickness of the syringe. and refractive index Calculate the refraction offset The offset correction is performed on the pixels at the edge of the syringe. The algorithm formula is as follows:

[0022] ;

[0023] ;

[0024] In the formula, The angle between the industrial camera and the surface of the syringe. The original coordinates of the edge pixels caused by refraction. These are the edge pixel correction coordinates after refraction compensation. The coordinates of the syringe axis in the image. This is a sign function used to determine whether a pixel is on the left or right side of the axis and to determine the offset direction.

[0025] As a preferred technical solution, in step S2, a modified adaptive filtering algorithm is used for noise reduction. The specific algorithm formula is as follows:

[0026] ;

[0027] ;

[0028] In the formula, Let be the grayscale value of the denoised image at the (x,y) coordinate. This represents the grayscale value of the original corrected image at the (x, y) coordinates. For the size of the filter window, Within the filter window The weighting coefficient of location, The standard deviation of Gaussians in space. is the Gaussian standard deviation of grayscale similarity.

[0029] As a preferred technical solution, in step S3, the specific process of using the improved visual saliency-morphology fusion algorithm is as follows: the saliency standard deviation is preset to 0.15, the grayscale difference between each pixel in the image and all other pixels is calculated, and the weight is assigned based on the Euclidean distance from the pixel to the center of the maximum saliency region. The closer the distance, the greater the weight. The saliency value of each pixel is calculated by combining the grayscale difference and the weight. The saliency value ranges from [0,1], which increases the saliency value of the key feature region of the syringe by more than 40%, and quickly locates the feature region of the syringe from the complex background.

[0030] The multi-scale multi-structural element includes three structural elements: a circular structural element with a radius of 1, used to extract the smooth edges of the syringe's inner and outer diameters; a 3×1 rectangular structural element, used to extract the thin, elongated scale lines of the syringe; and a rhombus structural element with a diagonal length of 3, used to extract the irregular chamfered edges of the syringe nozzle. The multi-scale includes three scales: 1×1, 3×3, and 5×5. For the image after saliency enhancement, opening operations (erosion followed by dilation) and closing operations (dilation followed by erosion) are performed sequentially for each structural element and each scale. Then, the morphological gradient (dilation image minus erosion image) is calculated to obtain the corresponding gradient image. The average value of all nine gradient images is then fused to obtain the final edge image.

[0031] The contour thinning algorithm adopts the Zhang-Suen contour thinning algorithm to remove redundant pixels in the edge contour and retain the skeleton information of the contour. The geometric constraints are as follows: the inner diameter contour is a circle, the scale line is a straight line, and the chamfer contour is an arc. Based on the constraints, valid contours are selected and false contours formed by scratches and stains are eliminated.

[0032] As a preferred technical solution, the specific process of dynamic deformation compensation in step S4 is as follows: the movement trajectory of the syringe contour point is tracked by the MeanShift algorithm to determine the deformation direction angle of the contour point; the standard coordinates of the contour point when there is no deformation are combined with the standard coordinates of the contour point provided by the standard CAD model of the syringe, and the Euclidean distance between the real-time acquired contour point coordinates and the standard coordinates is calculated. This distance is the deformation of the contour point; the real-time acquired contour point coordinates are reverse-corrected according to the deformation direction angle and the deformation, and the contour point coordinates after deformation compensation are obtained, thereby reducing the detection error caused by dynamic deformation.

[0033] As a preferred technical solution, the specific process of dynamic deformation compensation in step S4 is as follows: the movement trajectory of the syringe contour point is tracked by the MeanShift algorithm to determine the deformation direction angle of the contour point; the standard coordinates of the contour point when there is no deformation are combined with the standard coordinates of the contour point provided by the standard CAD model of the syringe, and the Euclidean distance between the real-time collected contour point coordinates and the standard coordinates is calculated. This distance is the deformation of the contour point; the real-time collected contour point coordinates are reverse-corrected according to the deformation direction angle and the deformation, and the contour point coordinates after deformation compensation are obtained.

[0034] As a preferred technical solution, the specific process of calculating the accuracy of group decision fusion in step S4 is as follows: the accuracy parameters of the syringe include the inner diameter, outer diameter, scale spacing, wall thickness, and chamfer radius of the tube opening; calculate the reliability of the accuracy parameters of each of the four perspectives. The reliability is calculated by the sum of the deviations of all accuracy parameters under that perspective from the corresponding standard parameters. The smaller the sum of the deviations, the higher the reliability; use the reliability of each perspective as a weight to perform a weighted average of the same accuracy parameter of the four perspectives to obtain the final detection result of the accuracy parameter.

[0035] As a preferred technical solution, the specific calculation method for the syringe accuracy parameters is as follows: For the inner and outer diameter profiles after deformation compensation, a circle is fitted using the least squares method to obtain the center coordinates and radius. Twice the radius is the corresponding inner and outer diameter values. For the scale line profile, the scale line is fitted using the Hough linear transformation to obtain the linear equations of two adjacent scale lines. The perpendicular distance between the two lines is calculated, which is the scale spacing. Based on the distance between the center of the inner diameter profile and the center of the outer diameter profile, combined with the fitted radii of the inner and outer diameters, the syringe wall thickness is calculated. For the chamfer profile of the nozzle, an arc profile is obtained using curve fitting, and the radius of the arc is calculated as the chamfer radius of the nozzle.

[0036] As a preferred technical solution, in step S5, the final accuracy parameters (D, D', L, d, R) calculated in step S4 are compared with the preset qualified standard range. If all parameters are within the qualified range, the product is judged as qualified; if any parameter exceeds the qualified range, the product is judged as unqualified, and the unqualified parameter and deviation value are marked. The test results (qualified / unqualified, specific accuracy parameters, unqualified mark) are transmitted to the production line control system in real time and displayed on the display interface of the industrial control host. For unqualified products, a control signal is sent to the sorting device to realize the automatic sorting of unqualified products. The test data is stored in real time to form a test ledger for easy traceability and production process optimization.

[0037] The present invention has the following beneficial effects:

[0038] (1) This invention designs a preprocessing scheme that combines dynamic illumination adjustment and refraction compensation. Targeting the light transmission characteristics and optical refraction effect of transparent syringes (glass or plastic), the power of each LED unit in the ring adaptive light source array is adjusted in real time, which solves the problem of poor image quality caused by uneven illumination and overexposure of reflection in the prior art. At the same time, based on the syringe wall thickness, refractive index and shooting angle, the edge pixel refraction offset is accurately calculated and coordinate correction is completed, eliminating the edge positioning deviation caused by the refraction of transparent materials. Combined with the improved adaptive filtering denoising algorithm, while effectively suppressing environmental noise such as surface scratches and stains, key feature details such as syringe edges and scale lines are completely preserved, providing a high-quality image foundation for subsequent feature extraction and accuracy calculation. This makes the detection error of key parameters such as syringe inner diameter and outer diameter controlled within ±0.01mm, improving the detection accuracy and exceeding the accuracy level of existing detection methods.

[0039] (2) This invention proposes an improved visual saliency-morphological fusion feature extraction scheme. Based on the traditional frequency-tuned visual saliency detection algorithm, pixel distance weight is introduced to effectively improve the saliency of small-sized features such as fine scale lines on the syringe, and realize the rapid and accurate positioning of syringe feature areas in complex backgrounds. At the same time, a multi-scale multi-structural element morphological edge detection algorithm is designed. By adapting to various structural elements and multi-scale operations of different syringe features (smooth edges of inner / outer diameter, thin scale line structure, irregular arc of tube opening chamfer), the technical defect of existing single structural element algorithms that cannot take into account the extraction of multiple morphological features is solved. Combined with Zhang-Suen contour thinning algorithm and geometric constraint screening, the pseudo contours formed by scratches and stains are automatically removed to ensure the complete extraction of key features such as inner diameter, outer diameter, scale line, and tube opening chamfer, reducing the false detection rate and controlling the false detection rate below 0.5%, which significantly improves the reliability and comprehensiveness of feature extraction.

[0040] (3) This invention introduces the MeanShift contour tracking and dynamic deformation compensation scheme. It tracks the movement trajectory of the contour points in real time for the small dynamic deformation of the syringe caused by extrusion and thermal effects during the production process. Combined with the non-deformation coordinates preset in the standard CAD model of the syringe, it accurately calculates the deformation and deformation direction and completes the contour point coordinate correction. This solves the technical problem that the existing static detection method cannot adapt to the dynamic deformation of the production line and leads to the amplification of detection error. At the same time, it adopts a multi-view group decision fusion accuracy calculation model. By calculating the credibility of the detection parameters of each view, it integrates multiple sets of detection data in a weighted fusion manner, effectively avoiding the deviation risk of single-view detection. This greatly improves the repeatability and stability of the detection results. The detection time is controlled within 0.3s, which can perfectly adapt to the production line speed of 0.5-2m / min and realize the online real-time detection of the syringe.

[0041] (4) This invention combines the Harris corner detection algorithm with flexible fixture positioning to achieve automatic and accurate positioning of syringes, avoiding the subjective errors of manual positioning and the eccentricity and tilting problems of ordinary fixture positioning, and ensuring the consistency of the detection benchmark. The entire detection process does not require manual intervention. From image acquisition, preprocessing, feature extraction to accuracy calculation, result judgment and sorting feedback, the entire process is automated, which greatly reduces the labor intensity and manpower cost of manual detection, and effectively reduces the detection error caused by human operation. In addition, the multi-view imaging system adopted by this invention has a simple structure and controllable cost. It can be directly embedded into the existing syringe production line without large-scale modification of the production line. It is suitable for the accuracy detection needs of various syringes such as medical and industrial syringes. It has a wide range of applications and has strong practicality, economy and large-scale industrial promotion value.

[0042] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0043] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a flowchart of a real-time syringe accuracy detection method based on image recognition according to the present invention;

[0045] Figure 2 This is a schematic diagram of a multi-view imaging system. Detailed Implementation

[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0048] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figure 1-2 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.

[0049] Please see Figure 1 As shown, this invention is a real-time syringe accuracy detection method based on image recognition, comprising the following steps:

[0050] Step S1, Detection System Setup and Syringe Positioning: Build a multi-view imaging system, clamp and fix the syringe to be tested on a pneumatic rotating platform, and collect 360° full-circumference images of the syringe by controlling the rotating platform to rotate at a constant speed.

[0051] Step S2, Multi-view image acquisition and preprocessing: Control 4 industrial cameras to simultaneously acquire 360° full-circumference images of the syringe. Based on the material characteristics of the syringe, adjust the power of each LED unit in the ring adaptive light source array through a dynamic illumination adjustment algorithm. Then, correct the refraction offset of the syringe edge pixels through a refraction compensation algorithm. Combined with an improved adaptive filtering algorithm, perform noise reduction processing. Finally, normalize the image.

[0052] Step S3, Improved Feature Extraction: An improved visual saliency-morphological fusion algorithm is adopted. First, the saliency of key features of the syringe is enhanced by an improved frequency-tuned visual saliency detection algorithm. Then, the edge features of the syringe inner diameter, outer diameter, scale lines, and chamfer of the nozzle are extracted by a multi-scale multi-structural element morphological edge detection algorithm. After contour refinement and screening, the effective contour is obtained.

[0053] Step S4, Dynamic Deformation Compensation and Group Decision Accuracy Calculation: Based on the effective contour extracted in step S3, the MeanShift algorithm is used to track the movement trajectory of the contour points. Combined with the preset deformation model, the dynamic deformation of the syringe is corrected through the dynamic deformation compensation algorithm. The reliability of the accuracy parameters from four perspectives is calculated. Through the group decision fusion model, the final accuracy parameters of the syringe inner diameter, outer diameter, scale spacing, wall thickness, and tube opening chamfer radius are calculated.

[0054] Step S5, Real-time Judgment and Feedback: Compare the final accuracy parameters obtained in step S4 with the preset qualified standard range to determine whether the product is qualified or not, and transmit the test results to the production line control system in real time to realize automatic sorting of unqualified products and traceability of test data.

[0055] Please see Figure 2As shown, in step S1, the multi-view imaging system includes: 4 high-resolution industrial cameras (resolution ≥ 12 million pixels, frame rate ≥ 30fps), a ring adaptive light source array (composed of 12 groups of adjustable power LED units, wavelength 450-550nm, adapted for transparent syringe imaging), a pneumatic rotating platform (adjustable speed, built-in FPGA controller and temperature compensation module), an image acquisition card and an industrial control host; wherein, the 4 industrial cameras are located at 1 each in the orthogonal X-axis and Y-axis directions (field of view 60°), and 1 at each end of the syringe axis (field of view 30°), and the ring light source array is distributed at 360° equal intervals on a ring support with a diameter of 300mm, and the pitch angle is adjustable;

[0056] The syringe to be tested is fixed on a pneumatic rotating platform using a pneumatic clamp. The clamp is made of a flexible material to avoid squeezing and deforming the syringe. The FPGA controller controls the rotating platform to rotate at a constant speed of 120 rpm to ensure that the multi-view camera 1 can acquire a 360° full-circumference image of the syringe. At the same time, the initial positioning image is acquired by an industrial camera, and the reference points at both ends of the syringe are located based on the Harris corner detection algorithm to establish the axial coordinate system of the syringe and complete the automatic positioning of the syringe.

[0057] Step S1 achieves precise automatic positioning of the syringe through a closed-loop process of "fixture fixing - reference point positioning - coordinate system establishment," providing a unified reference for subsequent multi-view image acquisition and accuracy parameter calculation. The specific implementation is as follows: First, after the syringe to be tested is transported to the testing station via the production line, the pneumatic fixture receives control signals from the FPGA controller to achieve flexible clamping action—the clamping part uses flexible silicone material, and the clamping force is controlled within... To ensure the syringe is stably fixed while preventing excessive clamping force from causing deformation, the axis of the syringe after clamping is aligned with the rotation axis of the pneumatic rotating platform, with a deviation not exceeding 0.005mm. Secondly, four industrial cameras are used to simultaneously acquire initial positioning images of the syringe. The edges of the syringe openings at both ends are selected as the positioning reference area. The Harris corner detection algorithm is used to extract corner points from the positioning reference area, selecting feature corner points from the opening edges (at least eight feature corner points are selected at each end to ensure positioning stability). The coordinates of the center of the syringe openings at both ends are obtained through coordinate fitting, and the line connecting the centers of the two ends is used as the axial reference line of the syringe. Finally, a two-dimensional rectangular coordinate system is established with the midpoint of the axial reference line as the origin (X-axis parallel to the syringe axis, Y-axis perpendicular to the syringe axis), completing the automatic positioning of the syringe with high accuracy. Location takes time This ensures that subsequent multi-view image acquisition, feature extraction, and accuracy calculation are all based on a unified coordinate system, avoiding detection errors caused by positioning deviations.

[0058] In specific implementation, taking a 1ml medical transparent glass syringe (50mm in length, 4.5mm in diameter at the nozzle) as an example, after the syringe arrives at the testing station via the conveyor line, the FPGA controller sends a control signal to the pneumatic clamp. The silicone clamping arm of the clamp slowly closes, and the clamping force is stabilized at 0.15MPa, vertically fixing the syringe at the center of the pneumatic rotating platform, ensuring that the syringe axis coincides with the axis of the rotating platform. Subsequently, four industrial cameras simultaneously acquire initial images, with two cameras (30° field of view) at both ends of the syringe axis focusing on acquiring images of the nozzle area. Using the Harris corner detection algorithm, 10 feature corner points are extracted from the edge of each nozzle. After coordinate fitting calculation, the coordinates of the center of the nozzle at both ends are obtained as (120, 1...). (50), (120), 200 (image pixel coordinates), with the line connecting the two points as the axial baseline of the syringe, and (120, 175) as the origin, a two-dimensional rectangular coordinate system XY is established. The X-axis is along the axial direction of the syringe (from one end of the tube to the other end of the tube), and the Y-axis is perpendicular to the X-axis, thus completing the automatic positioning of the syringe. After positioning, the FPGA controller controls the pneumatic rotating platform to rotate at a constant speed of 120 rpm to ensure that the subsequent multi-view camera can acquire a 360° full-circumference image of the syringe. All acquired images are preprocessed and accuracy calculated based on this unified coordinate system. Experiments have verified that the positioning deviation of this positioning method is controlled within 0.003 mm, which fully meets the benchmark requirements for subsequent high-precision detection.

[0059] In step S2, four industrial cameras are controlled to simultaneously acquire images of the syringes. A set of images is acquired every 30° rotation, with four images in each set (corresponding to four perspectives). The acquisition frequency is linked to the production line speed (adapted to the production line speed of 0.5-2m / min) to ensure that 12 sets of images, totaling 48 images, are acquired for each syringe, achieving 360° coverage without blind spots. The acquired images are transmitted to the industrial control host in real time through the image acquisition card.

[0060] Based on the light transmittance characteristics of the syringe material (transparent glass or plastic), a dynamic illumination power adjustment algorithm is adopted. This algorithm automatically adjusts the power of each LED unit in the ring light source array according to the real-time acquired image brightness and contrast, avoiding glare caused by excessive illumination and feature blurring caused by insufficient illumination. The formula for the dynamic illumination power adjustment algorithm is as follows:

[0061] ;

[0062] In the formula, For the first Real-time power adjustment of each LED unit ; This is the proportionality coefficient. This is the preset optimal image contrast. For the first The real-time image contrast of the corresponding area for each LED unit is calculated from the image grayscale histogram. This is the reference power for the LED unit. This represents the minimum power of the LED unit.

[0063] In step S2, when the refraction compensation algorithm corrects the refraction offset of the syringe edge pixels, it does so according to the preset wall thickness of the syringe. and refractive index Calculate the refraction offset The offset correction is performed on the pixels at the edge of the syringe. The algorithm formula is as follows:

[0064] ;

[0065] ;

[0066] In the formula, The angle between the industrial camera and the surface of the syringe. The original coordinates of the edge pixels caused by refraction. These are the edge pixel correction coordinates after refraction compensation. The coordinates of the syringe axis in the image. This is a sign function used to determine whether a pixel is to the left or right of the axis and to determine the offset direction;

[0067] The denoised multi-view images are converted to grayscale images, and the pixel values ​​are normalized to the range of [0,1] to eliminate the residual effects of uneven illumination and lay the foundation for subsequent feature extraction. The normalization formula is as follows:

[0068] ;

[0069] in, , These are the minimum and maximum gray values ​​of the denoised image, respectively.

[0070] Step S2 addresses the issues of poor image quality and edge positioning deviation caused by the refraction effect of transparent syringes, uneven illumination, and other problems in existing technologies. The overall implementation process follows a closed-loop logic of "multi-view image acquisition, dynamic illumination adjustment, refraction compensation, improved adaptive filtering for noise reduction, and image normalization." Each step includes specific operation procedures, parameter settings, and corresponding implementation examples to ensure feasibility and reproducibility, as detailed below:

[0071] The industrial control host sends control signals to synchronously link the pneumatic rotary platform and four industrial cameras, ensuring that the rotation speed of the rotary platform matches the camera acquisition frequency, and that the acquisition frequency is synchronized with the production line speed (adapted to production line speeds of 0.5-2 m / min). This prevents image blurring or missed acquisitions due to speed mismatch. All four industrial cameras are set to 12 megapixels and 30fps. Two cameras along the X and Y axes (60° field of view) focus on the sidewall area of ​​the syringe, while the two cameras at both ends of the syringe axis (30° field of view) focus on the nozzle area, ensuring that the image acquisition clarity meets the subsequent accuracy requirements. The testing requirements are as follows (pixel resolution ≥ 0.001 mm / pixel): After the syringe is positioned, the FPGA controller controls the pneumatic rotating platform to rotate at a constant speed of 120 rpm. Every 30° rotation triggers a synchronous camera acquisition, acquiring 4 images per group (corresponding to 4 viewpoints). A total of 12 groups and 48 images are acquired for each syringe, achieving 360° full circumference coverage without blind spots. The acquired images are transmitted to the industrial control host in real time through the image acquisition card and stored in a lossless compression format. At the same time, the syringe number, acquisition viewpoint, and acquisition time corresponding to the image are marked to facilitate subsequent data traceability and anomaly investigation.

[0072] In specific implementation, taking a production line speed of 1m / min and a 1ml medical transparent glass syringe (50mm in length and 6mm in outer diameter) as an example, the industrial camera acquisition parameters were adjusted to 12 megapixels, 30fps frame rate, 60° field of view for the X-axis and Y-axis cameras, and 30° field of view for the cameras at both ends. The pneumatic rotating platform was controlled to rotate at a uniform speed of 120rpm. Every 30° rotation (rotation time 0.083s), 4 cameras simultaneously acquired 1 set of images, 4 images per set (X-axis view, Y-axis view, left end tube opening view, right end tube opening view). Each syringe rotated one revolution (0.5s) and acquired 12 sets of 48 images. The acquired images were transmitted to the industrial control host through the image acquisition card and marked in the format of "syringe number 001-view 1-acquisition time 20260228100001", etc., and stored losslessly on the host hard drive. After observation, the acquired images were clear and unobstructed, and the details of the syringe side wall and tube opening area were clear, fully meeting the requirements of subsequent preprocessing.

[0073] Based on the syringe material type, preset corresponding algorithm parameters are used—for glass syringes (85%-90% light transmittance), a proportional coefficient is set. Plastic syringe (75%-85% light transmittance) setting Preset optimal image contrast (Experimental calibration to ensure optimal differentiation between syringe features and background), LED unit reference power. minimum power The industrial control host segments the image for each frame according to the region corresponding to the LED unit, and calculates the real-time contrast of each region using the image grayscale histogram. ( (corresponding to 12 LED units); real-time contrast ratio Compared to the preset optimal contrast In contrast, the real-time adjustment power of each LED unit is calculated using a dynamic illumination adjustment algorithm. It sends control signals to the ring-shaped adaptive light source array to adjust the power of the corresponding LED units, ensuring that the image contrast of each area approaches the maximum. After adjustment, acquire the image again and check the contrast. and deviation If the current power is maintained, then the current power will be maintained; if the deviation is... Repeat the lighting adjustment steps until the requirements are met, ensuring uniform lighting without glare.

[0074] In practical implementation, taking a 1ml medical transparent glass syringe as an example, the preset parameters are as follows: After acquiring the first frame image, it was divided into 12 regions, and the real-time contrast ratio of the corresponding region of the third group of LED units was calculated. (lower than) The area corresponding to the 7th group of LED units (higher than) ); Calculated by algorithm: Group 3 Group 7 (Take the minimum value of 1W); send control signals to adjust the power of the third group of LEDs to 2.95W and the seventh group to 1W, then acquire and detect images again. All satisfy the deviation As required, after adjustment, the side wall of the syringe is no longer reflective, and the scale lines and edge details are clearly visible.

[0075] To address the refractive effect of transparent syringes, an improved adaptive filtering denoising method is used to eliminate edge shifts caused by refraction and the effects of environmental noise (scratches, stains). The specific implementation process consists of two steps: refraction compensation and image denoising. Each step has clear operating procedures, as follows:

[0076] The core of this step is to correct the edge pixel shift caused by the refraction of the transparent syringe, ensuring accurate positioning of the syringe edge. The specific implementation process is as follows:

[0077] JZ1, Parameter Preset: Preset the refractive index according to the syringe material. (glass syringe) Plastic syringe ); Preset wall thickness according to syringe specifications (1ml glass syringe) Preset the angle between the industrial camera and the syringe surface. (This can be dynamically adjusted via camera calibration);

[0078] JZ2, Coordinate Acquisition: Extract the coordinates of the syringe axis in the image from the syringe positioning results. By detecting image edges, the original coordinates of the syringe edge pixels caused by refraction are initially obtained. ;

[0079] JZ3, Offset Calculation: Calculate the refraction offset of edge pixels using a refraction compensation algorithm. ;

[0080] JZ4, Coordinate Correction: Based on the sign function Determine whether the pixel is to the left or right of the axis, determine the offset direction, and then adjust the original coordinates. The offset Δx is superimposed to obtain the compensated edge pixel correction coordinates. ;

[0081] JZ5, Global Correction: Repeat the steps for all syringe edge pixels. Complete the refraction compensation of the entire image to ensure that the positioning deviation of the syringe edge is less than or equal to ±0.005mm.

[0082] In practical implementation, taking a 1ml medical transparent glass syringe as an example, the preset parameters are as follows: , , Step 1.2: Locating and obtaining the coordinates of the syringe axis. (Image pixel coordinates); Obtain the original coordinates of a certain edge pixel through edge detection. (Right side of the axis, sign value is 1); Calculate the refraction offset. Converted to pixel coordinates (1 pixel = 0.001 mm), this is 26 pixels; calculate the corrected coordinates. After correcting all edge pixels of the syringe, comparing the images before and after correction, the edge offset was reduced from the original 35-40 pixels to less than 5 pixels, effectively solving the edge positioning deviation problem caused by the refraction of the transparent syringe.

[0083] In step S2, denoising is performed using an improved adaptive filtering algorithm. The specific algorithm formula is as follows:

[0084] ;

[0085] ;

[0086] In the formula, Let be the grayscale value of the denoised image at the (x,y) coordinate. This represents the grayscale value of the original corrected image at the (x, y) coordinates. For the size of the filter window, Within the filter window The weighting coefficient of location, The standard deviation of Gaussians in space. is the Gaussian standard deviation of grayscale similarity.

[0087] This step combines spatial distance weights with grayscale similarity weights to avoid edge blurring caused by traditional filtering. It can also effectively suppress discrete noise such as scratches and stains on the syringe surface. Compared with existing filtering algorithms, the denoising effect is improved by more than 30%, and the edge retention rate is improved by more than 25%.

[0088] In practical implementation: Taking a 1ml medical transparent glass syringe with surface scratches (0.01mm wide) as an example, the preset filtering parameters are as follows: , , ; Traverse a pixel in the scratched area of ​​the image Its grayscale value A pixel within the filter window (2 units from the center pixel, grayscale value) ), calculate weight Another pixel within the window (1 unit from the center, grayscale value) (for scratch noise), calculate the weights. The denoised grayscale value of the pixel is calculated by weighted averaging. Scratch noise was effectively suppressed, while the weight of pixels at the syringe edge (with large grayscale differences) was higher, and edge details were not blurred. Scratches were invisible in the denoised image, and edges and scale lines were clearly distinguishable. Taking a denoised image of a 1ml medical transparent glass syringe as an example, the following was extracted after traversing the image: , Select a pixel in the image and denoise it to get its grayscale value. Calculated using a normalization algorithm After normalization of the entire image, the grayscale range of the image is within [0,1]. The local bright and dark areas caused by uneven lighting are corrected, and the contrast between the syringe feature area and the background is more uniform, providing a stable image basis for subsequent visual saliency enhancement and feature extraction.

[0089] In step S3, the specific process of using the improved visual saliency-morphology fusion algorithm is as follows: the saliency standard deviation is preset to 0.15, the gray level difference between each pixel in the image and all other pixels is calculated, and the weight is assigned based on the Euclidean distance from the pixel to the center of the maximum saliency region. The closer the distance, the greater the weight. The saliency value of each pixel is calculated by combining the gray level difference and the weight. The saliency value ranges from [0,1], which increases the saliency value of the key feature region of the syringe by more than 40%, and quickly locates the feature region of the syringe from the complex background.

[0090] The multi-scale, multi-structural element includes three structural elements: a circular structural element with a radius of 1, used to extract the smooth edges of the syringe's inner and outer diameters; a 3×1 rectangular structural element, used to extract the thin, elongated scale lines of the syringe; and a rhombus structural element with a diagonal length of 3, used to extract the irregular chamfered edges of the syringe nozzle. The multi-scale includes three scales: 1×1, 3×3, and 5×5. For the image after saliency enhancement, opening operations (erosion followed by dilation) and closing operations (dilation followed by erosion) are performed sequentially for each structural element and each scale. Then, the morphological gradient (dilation image minus erosion image) is calculated to obtain the corresponding gradient image. The average of all nine gradient images is then fused to obtain the final edge image.

[0091] The contour thinning algorithm adopts the Zhang-Suen contour thinning algorithm to remove redundant pixels in the edge contour and retain the skeleton information of the contour. The specific geometric constraints are: the inner diameter contour is a circle, the scale line is a straight line, and the chamfer contour is an arc. Based on these constraints, valid contours are selected and false contours formed by scratches and stains are eliminated.

[0092] In step S3, the specific process of using the improved visual saliency-morphology fusion algorithm is as follows: the saliency standard deviation is preset to 0.15, the gray level difference between each pixel in the image and all other pixels is calculated, and the weight is assigned based on the Euclidean distance from the pixel to the center of the maximum saliency region. The closer the distance, the greater the weight. The saliency value of each pixel is calculated by combining the gray level difference and the weight. The saliency value ranges from [0,1], which increases the saliency value of the key feature region of the syringe by more than 40%, and quickly locates the feature region of the syringe from the complex background.

[0093] To address the issue of low contrast between the syringe's feature areas (inner diameter, scale) and the background, an improved version of the traditional frequency-tuned (FT) visual saliency detection algorithm is proposed. Based on the grayscale distribution of the syringe's feature areas, a weight is assigned to each pixel based on the center of the maximally saliency region, highlighting the key features of the syringe and suppressing background interference. The improved saliency detection algorithm formula is as follows:

[0094] ;

[0095] ;

[0096] In the formula, for The saliency value of the coordinate pixel, Image size, For significance, standard deviation The pixel weight coefficient is determined by the distance from the pixel to the center of the region of maximum saliency. for coordinates and Euclidean distance between coordinates The maximum Euclidean distance in the image is used. By introducing pixel distance weights, the problem of the traditional FT algorithm not being able to extract the saliency of small-sized features of the syringe (such as fine scale lines) is solved, which improves the saliency value of the key feature region of the syringe by more than 40%, and can quickly locate the feature region of the syringe from complex backgrounds.

[0097] The multi-scale, multi-structural element includes three structural elements: a circular structural element with a radius of 1, used to extract the smooth edges of the syringe's inner and outer diameters; a 3×1 rectangular structural element, used to extract the thin, elongated scale lines of the syringe; and a rhombus structural element with a diagonal length of 3, used to extract the irregular chamfered edges of the syringe nozzle. The multi-scale includes three scales: 1×1, 3×3, and 5×5. For the image after saliency enhancement, opening operations (erosion followed by dilation) and closing operations (dilation followed by erosion) are performed sequentially for each structural element and each scale. Then, the morphological gradient (dilation image minus erosion image) is calculated to obtain the corresponding gradient image. The average of all nine gradient images is then fused to obtain the final edge image.

[0098] Specifically, multi-scale, multi-structural-element morphological edge detection: Addressing the morphological differences of various features on a syringe (inner / outer diameter edges, scale lines, chamfers), a multi-scale, multi-structural-element morphological edge detection algorithm is designed. Combined with contour refinement, this achieves accurate extraction of different features, avoiding feature omissions or mis-extractions caused by single structural elements. The specific algorithm is as follows:

[0099] Three structural elements are designed to suit different feature extraction requirements:

[0100] Structural element 1: Circular structural element 10 (radius r=1), used to extract the smooth edges of the syringe's inner and outer diameters;

[0101] Structural element 2: Rectangular structural element 11 (3×1), used to extract syringe scale lines (thin strips).

[0102] Structural element 3: Rhombus structural element 12 (diagonal length 3), used to extract the chamfer (irregular edge) of the syringe nozzle.

[0103] For the image after saliency enhancement, the above three structuring elements at different scales (scale 1: 1×1, scale 2: 3×3, scale 3: 5×5) are used to perform opening and closing operations in sequence, and then the morphological gradient is calculated to obtain a multi-scale edge image. The algorithm formula is as follows:

[0104] ;

[0105] ;

[0106] In the formula, For the first Type of structural element, first Morphological gradient images at various scales Image with enhanced saliency For the s-th structuring element and the k-th scale, This is an opening operation (corrosion followed by expansion). This is a closing operation (expansion followed by erosion). Calculate the morphological gradient (dilatation image minus erosion image). This is the final edge image after fusion.

[0107] The contour thinning algorithm adopts the Zhang-Suen contour thinning algorithm to remove redundant pixels in the edge contour and retain the skeleton information of the contour. The specific geometric constraints are: the inner diameter contour is a circle, the scale line is a straight line, and the chamfer contour is an arc. Based on these constraints, valid contours are selected and false contours formed by scratches and stains are eliminated.

[0108] Specifically, the Zhang-Suen contour thinning algorithm is adopted. The core of this algorithm is to gradually remove redundant pixels in the edge contour by performing two rounds of iterative erosion while preserving the integrity of the contour skeleton. The specific steps are as follows: First, traverse the final edge image after fusion and mark the edge pixels that meet the condition of "only retaining itself and no more than 2 non-background pixels and non-endpoint pixels in its 8-neighborhood". Mark these pixels as pixels to be deleted. Second, traverse the image again and mark the edge pixels that meet the condition of "only retaining itself and no more than 3 non-background pixels and non-endpoint pixels in its 8-neighborhood". Mark these pixels as pixels to be deleted. Third, delete all the pixels to be deleted marked in the two rounds. Repeat the above two rounds of iterative process until there are no pixels to be deleted that meet the conditions. Finally, a thinned contour that retains only the contour skeleton information is obtained. This ensures that the width of the thinned contour is 1 pixel, while not destroying the contour integrity of key features such as the inner diameter of the syringe and the scale lines, and avoiding contour breakage or distortion caused by thinning.

[0109] Based on the inherent geometric constraints of the syringe features, the refined contours are screened to remove pseudo-contours formed by scratches and stains, retaining valid contours. The specific steps are as follows: First, extract the geometric features of all refined contours, including the shape (circle, straight line, arc), contour length, and contour closure; Second, screen according to the geometric constraints of the syringe's key features—the inner diameter contour must meet the following requirements: closure, shape close to a circle, and contour length deviating from the standard inner diameter circumference of the syringe. The scale line outline must meet the following requirements: "not closed, shape close to a straight line, and the outline length deviates from the standard scale line length." The chamfer profile of the pipe opening must meet the following requirements: "closed, shape close to an arc, and the arc radius deviates from the standard chamfer radius." Finally, contours that do not meet the above constraints are identified as pseudo contours (such as short straight lines formed by scratches or irregular closed contours formed by stains) and removed. Only the inner diameter, outer diameter, scale lines, and pipe chamfers that meet the constraints are retained as valid contours, providing an accurate contour basis for subsequent precision parameter calculations.

[0110] In practical implementation, taking a 1ml medical transparent glass syringe as an example, its standard inner diameter is 4.5mm (corresponding to a standard inner diameter circumference of approximately 14.13mm), the standard graduation line length is 3mm, and the standard tube opening chamfer radius is 0.5mm. After multi-scale multi-structural element morphological edge detection, the final edge image obtained includes the syringe inner diameter contour, outer diameter contour, and the contours of 6 graduation lines. It also contains two short straight-line pseudo-contours formed by surface scratches (lengths of 0.8mm and 1.2mm respectively) and one irregular closed pseudo-contour formed by a stain. The contour (irregular shape, approximately 5.3mm in circumference) was used to refine the edge image using the Zhang-Suen contour thinning algorithm. After eight rounds of iterative erosion, all contours were thinned to a width of one pixel. Effective contours such as the inner diameter and scale lines were unbroken, and pseudo-contours formed by scratches and stains were also refined. Contour selection was then performed: the inner diameter contour was a closed circle with a circumference of 14.11mm, deviating from the standard circumference by 0.02mm, satisfying the constraint and thus deemed a valid contour; the six scale line contours were all non-closed straight lines with lengths within... Between, deviation The first two scratch pseudo-contours were determined to be valid contours; the lengths of the two scratch pseudo-contours were both less than 1 / 2 of the standard scale line length and did not meet the length constraint of the straight contour, so they were determined to be pseudo-contours and removed; the shape of the stain pseudo-contour was irregular and the perimeter deviated significantly from the standard inner diameter perimeter, so it was determined to be a pseudo-contour and removed; after screening, only the inner diameter, outer diameter, 6 scale lines, and tube opening chamfer were retained as valid contours, and the key precision parameters of the syringe could be accurately calculated based on these valid contours.

[0111] In step S4, the specific process of dynamic deformation compensation is as follows: the MeanShift algorithm is used to track the motion trajectory of the syringe contour point to determine the deformation direction angle of the contour point; combined with the standard coordinates of the contour point when there is no deformation provided by the standard CAD model of the syringe, the Euclidean distance between the real-time collected contour point coordinates and the standard coordinates is calculated, and this distance is the deformation of the contour point; based on the deformation direction angle and the deformation, the real-time collected contour point coordinates are reverse-corrected to obtain the contour point coordinates after deformation compensation.

[0112] Specifically, based on the syringe outline extracted in step 3, the MeanShift algorithm is used to track the motion trajectory of the outline points. Combined with the dynamic deformation law during the syringe production process (preset deformation model), the deformation of each outline point is calculated to achieve dynamic deformation compensation. The algorithm formula is as follows:

[0113] ;

[0114] ;

[0115] In the formula, for Deformation of coordinate contour points The coordinates of the contour points are collected in real time; These are the standard coordinates of the contour point when there is no deformation (provided by the standard CAD model of the syringe). These are the coordinates of the contour points after deformation compensation; This is the deformation direction angle (obtained by the MeanShift algorithm, i.e., the direction angle of the contour point's motion trajectory).

[0116] In step S4, the specific process of calculating the accuracy of group decision fusion is as follows: the accuracy parameters of the syringe include the inner diameter, outer diameter, scale spacing, wall thickness, and chamfer radius of the tube opening; calculate the reliability of the accuracy parameters of each of the four perspectives. The reliability is calculated by the sum of the deviations of all accuracy parameters under that perspective from the corresponding standard parameters. The smaller the sum of the deviations, the higher the reliability; use the reliability of each perspective as a weight to perform a weighted average of the same accuracy parameter of the four perspectives to obtain the final detection result of that accuracy parameter.

[0117] For images acquired from multiple perspectives, a set of key precision parameters for the syringe (inner diameter) can be calculated for each perspective. , outer diameter Scale spacing Wall thickness Chamfer radius To improve detection accuracy, a group decision fusion model is proposed to fuse and calculate multi-view accuracy parameters to obtain the final accuracy detection result. The algorithm formula is as follows:

[0118] First, calculate the reliability of the accuracy parameters for each viewpoint. ( (corresponding to four perspectives), the specific formula for the group decision fusion model is as follows:

[0119] ;

[0120] In the formula, For the first The first perspective A precision parameter value, This is the standard value of the precision parameter, and n is the number of precision parameters (n=5).

[0121] Then, based on the credibility, group decision fusion is performed to calculate the final accuracy parameter value. :

[0122] ;

[0123] In the formula, For the first Calculated values ​​of accuracy parameters for each viewpoint;

[0124] By introducing a viewpoint reliability weight, the problem of error accumulation caused by "treating all viewpoint data equally" during multi-viewpoint parameter fusion is solved. Viewpoint data with high detection accuracy (high reliability) is prioritized, so that the final accuracy detection error is controlled within ±0.01mm (inner diameter, outer diameter) and within ±0.05mm (scale interval). Compared with the existing single-viewpoint detection, the detection accuracy is improved.

[0125] Specific accuracy parameter calculation method:

[0126] Inner / outer diameter calculation: For the deformed inner / outer diameter profile, the least squares method is used to fit a circle to obtain the center coordinates. and radius Then the inner diameter (Inner diameter profile fitting radius), outer diameter (Outer diameter profile fitting radius);

[0127] Calculation of scale spacing: For the scale line profile, use Hough linear transformation to fit the scale line to obtain the linear equation of two adjacent scale lines, and calculate the vertical distance between the two lines, which is the scale spacing L;

[0128] Wall thickness calculation: based on the distance between the center of the inner diameter profile and the center of the outer diameter profile. Combined with inner diameter radius and outer radius Calculate wall thickness (Consider the offset of the circle center);

[0129] Chamfer radius calculation: For the chamfer profile of the pipe opening, the least squares method is used to fit the arc to obtain the chamfer radius R.

[0130] In step S5, the final accuracy parameters (D, D', L, d, R) calculated in step S4 are compared with the preset acceptable range. If all parameters are within the acceptable range, the product is considered acceptable; if any parameter exceeds the acceptable range, the product is considered unacceptable, and the unacceptable parameter and deviation value are marked. The detection results (acceptable / unacceptable, specific accuracy parameters, unacceptable markings) are transmitted to the production line control system in real time and displayed on the industrial control host's display interface. For unacceptable products, control signals are sent to the sorting device to achieve automatic sorting. The detection data is stored in real time to form a detection ledger for subsequent traceability and production process optimization. The total time of the entire detection process (from image acquisition to result feedback) is less than or equal to 0.3 seconds, meeting the 30fps real-time detection requirement of the production line and realizing real-time control of the entire syringe production process.

[0131] It is worth noting that the various units included in the above system embodiments are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0132] Furthermore, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware, and the corresponding program can be stored in a computer-readable storage medium.

[0133] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A real-time syringe accuracy detection method based on image recognition, characterized in that, Includes the following steps: Step S1, Detection System Setup and Syringe Positioning: Build a multi-view imaging system, clamp and fix the syringe to be tested on a pneumatic rotating platform, and collect 360° full-circumference images of the syringe by controlling the rotating platform to rotate at a constant speed. Step S2, Multi-view image acquisition and preprocessing: Control 4 industrial cameras to simultaneously acquire 360° full-circumference images of the syringe. Based on the material characteristics of the syringe, adjust the power of each LED unit in the ring adaptive light source array through a dynamic illumination adjustment algorithm. Then, correct the refraction offset of the syringe edge pixels through a refraction compensation algorithm. Combined with an improved adaptive filtering algorithm, perform noise reduction processing. Finally, normalize the image. Step S3, Improved Feature Extraction: An improved visual saliency-morphological fusion algorithm is adopted, with a preset saliency standard deviation of 0.

15. The gray-level difference between each pixel and all other pixels in the image is calculated. The weight is assigned based on the Euclidean distance from the pixel to the center of the maximum saliency region. The saliency value of each pixel is calculated by combining the gray-level difference and the weight. The saliency value ranges from [0,1]. Then, the edge features of the syringe inner diameter, outer diameter, scale lines, and chamfer of the nozzle are extracted by a multi-scale multi-structural element morphological edge detection algorithm. After contour refinement and screening, the effective contour is obtained. Step S4, Dynamic Deformation Compensation and Group Decision Accuracy Calculation: Based on the effective contour extracted in step S3, the MeanShift algorithm is used to track the movement trajectory of the contour points. Combined with the preset deformation model, the dynamic deformation of the syringe is corrected through the dynamic deformation compensation algorithm. The reliability of the accuracy parameters from four perspectives is calculated. Through the group decision fusion model, the final accuracy parameters of the syringe inner diameter, outer diameter, scale spacing, wall thickness, and tube opening chamfer radius are calculated. Step S5, Real-time Judgment and Feedback: Compare the final accuracy parameters obtained in step S4 with the preset qualified standard range to determine whether the product is qualified or not, and transmit the test results to the production line control system in real time to realize automatic sorting of unqualified products and traceability of test data. In step S2, when the refraction compensation algorithm corrects the refraction offset of the syringe edge pixels, it is based on the preset wall thickness of the syringe. and refractive index Calculate the refraction offset The offset correction is performed on the pixels at the edge of the syringe. The algorithm formula is as follows: ; ; In the formula, The angle between the industrial camera and the surface of the syringe. The original coordinates of the edge pixels caused by refraction. These are the edge pixel correction coordinates after refraction compensation. The coordinates of the syringe axis in the image. This is a sign function used to determine whether a pixel is to the left or right of the axis and to determine the offset direction; In step S2, noise reduction is performed using an improved adaptive filtering algorithm. The specific algorithm formula is as follows: ; ; In the formula, Let be the grayscale value of the denoised image at the (x,y) coordinate. This represents the grayscale value of the original corrected image at the (x, y) coordinates. For the size of the filter window, Within the filter window The weighting coefficient of location, The standard deviation of Gaussians in space. The Gaussian standard deviation of grayscale similarity; In step S4, the specific process of the dynamic deformation compensation algorithm is as follows: the MeanShift algorithm is used to track the movement trajectory of the syringe contour point to determine the deformation direction angle of the contour point; combined with the standard coordinates of the contour point when there is no deformation provided by the standard CAD model of the syringe, the Euclidean distance between the real-time collected contour point coordinates and the standard coordinates is calculated, and this distance is the deformation of the contour point; based on the deformation direction angle and the deformation, the real-time collected contour point coordinates are reverse-corrected to obtain the deformation-compensated contour point coordinates.

2. The real-time syringe accuracy detection method based on image recognition according to claim 1, characterized in that, In step S1, the multi-view imaging system includes: 4 high-resolution industrial cameras, a ring adaptive light source array, a pneumatic rotating platform, an image acquisition card, and an industrial control host; wherein, the 4 industrial cameras are located one each in the orthogonal X-axis and Y-axis directions, and one at each end of the syringe shaft; the ring light source array is distributed at 360° equal intervals on a ring bracket with a diameter of 300mm, and the pitch angle is adjustable. The syringe to be tested is fixed on a pneumatic rotating platform using a pneumatic clamp; the FPGA controller controls the rotating platform to rotate at a constant speed of 120 rpm to ensure that the industrial camera can capture a 360° full-circumference image of the syringe; at the same time, the initial positioning image is acquired by the industrial camera, and the reference points at both ends of the syringe are located based on the Harris corner detection algorithm to establish the axial coordinate system of the syringe and complete the automatic positioning of the syringe.

3. The image recognition-based syringe precision real-time detection method according to claim 1, characterized in that, In step S2, four industrial cameras are controlled to synchronously acquire images of the syringe. A set of four images is acquired every 30° rotation. The acquisition frequency is linked to the production line speed to ensure that 12 sets of images, totaling 48 images, are acquired for each syringe. The acquired images are transmitted to the industrial control host in real time through the image acquisition card. Based on the light transmittance characteristics of the syringe material, a dynamic illumination power adjustment algorithm is adopted to automatically adjust the power of each LED unit in the ring light source array according to the real-time acquired image brightness and contrast; the formula for the dynamic illumination power adjustment algorithm is as follows: ; In the formula, For the first Real-time power adjustment of each LED unit ; This is the proportionality coefficient. This is the preset optimal image contrast. For the first The real-time image contrast of the corresponding area for each LED unit is calculated from the image grayscale histogram. This is the reference power for the LED unit. This represents the minimum power of the LED unit.

4. The real-time syringe accuracy detection method based on image recognition according to claim 1, characterized in that, In step S3, the multi-scale multi-structural element includes three structural elements: a circular structural element with a radius of 1, used to extract the smooth edges of the syringe's inner and outer diameters; a 3×1 rectangular structural element, used to extract the long, thin scale lines of the syringe; and a rhombus structural element with a diagonal length of 3, used to extract the irregular chamfered edges of the syringe nozzle. The multi-scale includes three scales: 1×1, 3×3, and 5×5. Opening and closing operations are performed on the image using each structural element and each scale in sequence, and then the morphological gradient is calculated to obtain the corresponding gradient image. The average value of all nine gradient images is taken and fused to obtain the final edge image.

5. The real-time syringe accuracy detection method based on image recognition according to claim 1, characterized in that, In step S4, the specific process of calculating the accuracy of group decision fusion is as follows: the accuracy parameters of the syringe include the inner diameter, outer diameter, scale spacing, wall thickness, and chamfer radius of the tube opening; calculate the reliability of the accuracy parameters of each of the four perspectives. The reliability is calculated by the sum of the deviations of all accuracy parameters under that perspective from the corresponding standard parameters. The smaller the sum of the deviations, the higher the reliability; use the reliability of each perspective as a weight to perform a weighted average of the same accuracy parameter of the four perspectives to obtain the final detection result of the accuracy parameter.

6. The image recognition-based syringe precision real-time detection method according to claim 5, characterized in that, The specific calculation method for the syringe precision parameters is as follows: For the inner and outer diameter profiles after deformation compensation, a circle is fitted using the least squares method to obtain the center coordinates and radius. Twice the radius is the corresponding inner and outer diameter values. For the scale line profile, the scale line is fitted using the Hough linear transformation to obtain the linear equations of two adjacent scale lines. The vertical distance between the two lines is calculated, which is the scale spacing. Based on the distance between the center of the inner diameter profile and the center of the outer diameter profile, combined with the fitted radii of the inner and outer diameters, the syringe wall thickness is calculated. For the chamfer profile at the nozzle, an arc profile is obtained using curve fitting, and the radius of the arc is calculated as the chamfer radius at the nozzle.

7. The real-time syringe accuracy detection method based on image recognition according to claim 1, characterized in that, In step S5, the final accuracy parameters calculated in step S4 are compared with the preset acceptable standard range. If all parameters are within the acceptable range, the product is deemed acceptable. If any parameter exceeds the acceptable range, the product is deemed unacceptable, and the unacceptable parameter and deviation value are marked. The test results are transmitted to the production line control system in real time and displayed on the display interface of the industrial control host. For unacceptable products, a control signal is sent to the sorting device to realize automatic sorting of unacceptable products. The test data is stored in real time to form a test log.