Blood collection tube detection method, controller, blood collection tube sorting system and storage medium

The visual recognition module collects and segments the blood collection tubes, and combines color template matching to realize centrifugal detection and liquid level detection of the blood collection tubes, solving the problems of inefficient detection accuracy and efficiency in the prior art, and improving the accuracy and efficiency of blood collection tube detection.

CN120387975APending Publication Date: 2025-07-29JIANGMEN POLYTECHNIC +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510284801.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

The existing machinery has a relatively single blood detection function for the blood collection vessel and cannot meet the diverse detection needs, resulting in low detection accuracy and efficiency. Especially when the number of blood samples is large, it is difficult to accurately identify different samples, which affects the detection cycle and accuracy.

Method used

The visual recognition module is used to collect images of the blood collection tubes, and the tube body and tube cover areas are identified through edge detection and image segmentation. The blood color type is determined by combining color template matching, and liquid level detection is performed based on the blood color type to realize centrifugal detection and liquid level detection of the blood collection tubes.

Benefits of technology

It improves the detection accuracy and efficiency of blood samples inside the blood collection vessel, can quickly identify whether the type and quantity of blood samples meet the requirements, shortens the detection time, and improves the processing capacity of automation equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120387975A_ABST
    Figure CN120387975A_ABST
Patent Text Reader

Abstract

The invention discloses a blood collection tube detection method, a controller, a blood collection tube sorting system and a storage medium, and the method comprises the steps: controlling a visual recognition module to carry out image collection on a to-be-detected blood collection tube, and obtaining a first blood collection tube image and a second blood collection tube image; performing edge detection on the first blood collection tube image to obtain edge information, and performing image segmentation on the first blood collection tube image based on the edge information to obtain a tube body region image and a tube cap region image; performing color matching on the tube cap region image and a preset color template, and determining a blood color type corresponding to the tube cap region image; performing color detection on the tube body area image based on the color template to obtain a centrifugal detection result, and performing liquid level detection on the second blood collection tube image based on the blood color type to obtain a liquid level detection result; and determining a target detection result of the to-be-detected blood collection tube according to the centrifugal detection result and the liquid level detection result. According to the embodiment of the invention, the detection accuracy and detection efficiency of the blood sample can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of blood sample processing, and in particular, to a method for detecting blood collection tubes, a controller, a blood collection tube sorting system, and a storage medium. Background Art

[0002] After years of development, vacuum blood collection technology has become an indispensable important means in modern medical examinations. Its core principle is to automatically collect venous blood samples quantitatively under negative pressure through a blood collection tube that has been pre-evacuated, avoiding the cumbersome operation of manually drawing blood in traditional blood collection methods.

[0003] Despite continuous technological progress, the existing machinery has a relatively single function for detecting the blood inside the blood collection tube, and there are still some technical and operational deficiencies and defects, which cannot meet the diverse detection needs. Some medical institutions need to open the blood collection tube and send it to a dedicated detection device for detection. The complexity of the technology and the diversity of the samples pose challenges to automated equipment. In the case of a large number of blood samples, the current medical machinery is difficult to accurately identify different blood samples, further affecting subsequent operations on the blood samples, resulting in a longer detection cycle for the blood samples and affecting the detection accuracy and efficiency. Summary of the Invention

[0004] Embodiments of this application provide a method for detecting blood collection tubes, a controller, a blood collection tube sorting system, and a storage medium, which can improve the detection accuracy and efficiency of blood samples inside the blood collection tubes to be detected.

[0005] In a first aspect, embodiments of this application provide a method for detecting blood collection tubes, which is applied to a blood collection tube sorting system. The blood collection tube sorting system includes a visual recognition module. The method includes:

[0006] Controlling the visual recognition module to collect images of the blood collection tube to be detected, obtaining a first blood collection tube image and a second blood collection tube image, where the second blood collection tube image is obtained by moving the blood collection tube to be detected to a preset light source for collection;

[0007] Performing edge detection on the first blood collection tube image to obtain edge information, and segmenting the first blood collection tube image based on the edge information to obtain a tube body region image and a tube cap region image;

[0008] Matching the color of the tube cap region image with a preset color template to determine the blood color type corresponding to the tube cap region image;

[0009] Performing color detection on the tube body region image based on the color template to obtain a centrifugation detection result, and performing liquid level detection on the second blood collection tube image based on the blood color type to obtain a liquid level detection result;

[0010] Determine the target detection result of the blood collection tube to be tested according to the centrifugation detection result and the liquid level detection result.

[0011] In some embodiments, the visual recognition module includes a color acquisition component and a black-and-white acquisition component, and the blood collection tube sorting system further includes a transportation component; controlling the visual recognition module to perform image acquisition on the blood collection tube to be tested to obtain a first blood collection tube image and a second blood collection tube image includes:

[0012] Control the color acquisition component to perform image acquisition on the blood collection tube to be tested to obtain a first blood collection tube image;

[0013] Control the transportation component to move the blood collection tube to be tested to a preset light source, and control the black-and-white acquisition component to perform image acquisition on the blood collection tube to be tested to obtain a second blood collection tube image.

[0014] Or,

[0015] Control the transportation component to move the blood collection tube to be tested to a preset light source to control the color acquisition component to perform image acquisition on the blood collection tube to be tested to obtain an intermediate image, and perform color conversion on the intermediate image to obtain a second blood collection tube image.

[0016] In some embodiments, the liquid level detection is performed on the second blood collection tube image based on the blood color type to obtain a liquid level detection result, including:

[0017] Determine the required blood volume corresponding to the blood color type, and determine the target liquid level height of the required blood volume;

[0018] Perform binarization processing on the second blood collection tube image to obtain a binarized image;

[0019] Perform region extraction on the binarized image to obtain a liquid level region;

[0020] Perform contour analysis on the liquid level region based on a preset line segment detection algorithm to obtain a liquid level contour line;

[0021] Determine the pixel coordinates of the liquid level contour line, and determine the actual liquid level height of the blood collection tube to be tested according to the pixel coordinates;

[0022] Compare the actual liquid level height with the target liquid level height to obtain a liquid level detection result.

[0023] In some embodiments, the edge detection is performed on the first blood collection tube image to obtain edge information, including:

[0024] Perform preprocessing operations on the first blood collection tube image to obtain a grayscale image;

[0025] Calculate the gradient magnitude and gradient direction of each pixel point in the grayscale image through a preset edge detection operator;

[0026] Perform non-maximum suppression on the grayscale image based on the gradient magnitude and the gradient direction to obtain an edge image;

[0027] Perform edge analysis on the edge image according to a preset threshold to obtain strong edge information and weak edge information;

[0028] Obtain edge information based on the strong edge information and the weak edge information.

[0029] In some embodiments, the performing image segmentation on the first blood collection tube image based on the edge information to obtain a tube body region image and a tube cap region image includes:

[0030] Perform region detection on the first blood collection tube image according to the strong edge information and the weak edge information to obtain a tube cap region image;

[0031] Connect the strong edges and weak edges in the tube cap region image to obtain the contour of the blood collection tube cap;

[0032] Perform tube body segmentation on the first blood collection tube image based on the contour of the blood collection tube cap to obtain a tube body region image.

[0033] In some embodiments, the performing color detection on the tube body region image based on the color template to obtain a centrifugation detection result includes:

[0034] Perform color space conversion on the tube body region image to obtain a target color image, and set a hue threshold, a saturation threshold, and a brightness threshold;

[0035] Perform color segmentation on the target color image according to the hue threshold, the saturation threshold, and the brightness threshold to obtain a mask image;

[0036] Multiply the mask image and the target color image pixel by pixel to obtain multiple target color regions;

[0037] For each of the target color regions, perform feature extraction on the target color region to obtain color features;

[0038] Perform color comparison between all the color features and the color template to obtain a centrifugation detection result.

[0039] In some embodiments, the blood collection tube sorting system further includes a transportation component; after determining the target detection result of the blood collection tube to be tested according to the centrifugation detection result and the liquid level detection result, the method further includes:

[0040] When the target detection result is that the centrifugation detection result meets the preset centrifugation condition and the liquid level detection result meets the preset liquid level condition, move the blood collection tube to be tested to the preset qualified area through the transportation component;

[0041] When the target detection result is that the centrifugation detection result does not meet the preset centrifugation condition, or the liquid level detection result does not meet the preset liquid level condition, move the blood collection tube to be tested to the preset unqualified area through the transportation component.

[0042] In a second aspect, an embodiment of the present application further provides a controller, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the blood collection tube detection method as described in the first aspect.

[0043] In a third aspect, an embodiment of the present application further provides a blood collection tube sorting system, which includes a vision recognition module, a transportation component, and the controller as described in the second aspect.

[0044] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions for causing a computer to execute the blood collection tube detection method as described in the first aspect.

[0045] The blood collection tube detection method provided by the embodiments of the present application has at least the following beneficial effects: The blood collection tube sorting system includes a visual recognition module. By controlling the visual recognition module to collect images of the blood collection tube to be tested, a first blood collection tube image and a second blood collection tube image are obtained. Among them, the second blood collection tube image is obtained by moving the blood collection tube to be tested to a preset light source for collection. Then, edge detection is performed on the first blood collection tube image to obtain edge information, and based on the edge information, image segmentation is performed on the first blood collection tube image to obtain a tube body region image and a tube cap region image, so as to accurately divide different regions of the blood collection tube to be tested. Then, the tube cap region image is color-matched with a preset color template to determine the blood color type corresponding to the tube cap region image, and color detection is performed on the tube body region image based on the color template to obtain a centrifugation detection result, so as to quickly detect the centrifugation effect, identify the blood color, and perform liquid level detection on the second blood collection tube image based on the blood color type to obtain a liquid level detection result, which helps to confirm whether the blood sample volume of each blood collection tube to be tested meets the requirements. Furthermore, the target detection result of the blood collection tube to be tested is determined according to the centrifugation detection result and the liquid level detection result. Through the visual recognition module, the embodiments of the present application realize color recognition and liquid level measurement of the blood collection tube to be tested, improving the detection accuracy and detection efficiency of the blood sample inside the blood collection tube to be tested.

[0046] Other features and advantages of the present application will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present application. The objectives and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The drawings are used to provide a further understanding of the technical solutions of the present application, and constitute a part of the specification. Together with the examples of the present application, they are used to explain the technical solutions of the present application, and do not constitute a limitation to the technical solutions of the present application.

[0048] Figure 1 is a system schematic diagram of the blood collection tube sorting system provided by the embodiments of the present application;

[0049] Figure 2 is a flowchart of the specific method of the blood collection tube detection method provided by the embodiments of the present application;

[0050] Figure 3 is a specific flowchart of collecting images of the blood collection tube to be tested through the visual recognition module provided by the embodiments of the present application;

[0051] Figure 4 is a specific flowchart of step S400 provided by the embodiments of the present application;

[0052] Figure 5It is the specific flowchart of step S200 provided by an embodiment of the present application;

[0053] Figure 6 It is the specific flowchart of step S200 provided by another embodiment of the present application;

[0054] Figure 7 It is the specific flowchart of step S400 provided by another embodiment of the present application;

[0055] Figure 8 It is the flowchart of the specific method of the blood collection tube detection method provided by another embodiment of the present application;

[0056] Figure 9 It is the schematic diagram of the hardware structure of the controller provided by an embodiment of the present application. Detailed implementation manners

[0057] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0058] It should be noted that although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the flowchart in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence.

[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0060] A blood collection tube detection method provided by an embodiment of the present application can be applied to a terminal, can also be applied to a server side, or can also be software running on a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer or a smart watch, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, or can also be configured as a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (Content Delivery Network, CDN) and big data and artificial intelligence platforms; the software can be an application implementing the above method, etc., but is not limited to the above forms.

[0061] Embodiments of the present application can be used in numerous general-purpose or special-purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer computing devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0062] After years of development, vacuum blood collection technology has become an indispensable important means in modern medical examinations. Its core principle is to automatically quantitatively collect venous blood samples under negative pressure through a blood collection tube that has been pre-evacuated, avoiding the cumbersome operation of manually drawing blood in traditional blood collection methods.

[0063] Despite continuous technological progress, the existing machinery has a relatively single function for detecting blood inside the blood collection tube, and there are still some deficiencies and defects in technology and operation, unable to meet diverse detection needs. Some medical institutions need to open the lid of the blood collection tube and send it to a dedicated detection device for detection, and the complexity of the technology and the diversity of samples pose challenges to automated equipment. In the case of a large number of blood samples, current medical machinery is difficult to accurately identify different blood samples, further affecting subsequent operations on the blood samples, resulting in a longer detection cycle for blood samples and affecting detection accuracy and efficiency.

[0064] To solve the above problems, the embodiments of the present application provide a method for detecting blood collection tubes, a controller, a blood collection tube sorting system, and a storage medium. The blood collection tube sorting system includes a visual recognition module. By controlling the visual recognition module to collect images of the blood collection tubes to be tested, a first blood collection tube image and a second blood collection tube image are obtained. Among them, the second blood collection tube image is obtained by moving the blood collection tube to be tested to a preset light source for collection. Then, edge detection is performed on the first blood collection tube image to obtain edge information, and image segmentation is performed on the first blood collection tube image based on the edge information to obtain a tube body region image and a tube cap region image, so as to accurately divide different regions of the blood collection tube to be tested. Then, color matching is performed between the tube cap region image and a preset color template to determine the blood color type corresponding to the tube cap region image, so as to identify the type of the blood collection tube to be tested. In addition, color detection is performed on the tube body region image based on the color template to obtain a centrifugation detection result, so as to quickly detect the centrifugation effect and identify the blood color. And liquid level detection is performed on the second blood collection tube image based on the blood color type to obtain a liquid level detection result, which helps to confirm whether the blood sample volume of each blood collection tube to be tested meets the requirements. Furthermore, the target detection result of the blood collection tube to be tested is determined according to the centrifugation detection result and the liquid level detection result. Through the visual recognition module, the embodiments of the present application realize color recognition and liquid level measurement of the blood collection tubes to be tested, and improve the detection accuracy and detection efficiency of the blood samples inside the blood collection tubes to be tested.

[0065] Refer to Figure 1 , Figure 1 is a system schematic diagram of the blood collection tube sorting system provided by the embodiments of the present application.

[0066] In some embodiments, the blood collection tube sorting system includes a visual recognition module 101, a controller 102, and a host computer 103. The visual recognition module 101 and the host computer 103 are both communicatively connected to the controller 102. Among them, the visual recognition module 101 is used to collect image information of the blood collection tubes and transmit it to the controller 102 for further processing. The controller 102 communicates with the host computer 103, receives instructions and parameter settings sent by the host computer 103, and at the same time feeds back the detection results and system status information to the host computer 103. The controller 102 usually exchanges data with the host computer 103 through a serial communication interface (such as RS232, RS485) or a network interface (such as Ethernet, Wi-Fi).

[0067] It can be understood that the host computer 103 in the embodiments of the present application includes a graphical user interface (GUI). An operator can set detection parameters, start or stop the sorting task, view the detection results and system status, etc. through the host computer 103. The user interface may include a real-time monitoring window, a parameter setting window, a detection result window, etc., which is convenient for the operator to perform various operations and monitoring.

[0068] It should be noted that the visual recognition module 101 in the embodiments of the present application may be an industrial CCD (Charge-Coupled Device) camera, a high-speed camera, an infrared camera, a ultraviolet camera, etc., and the embodiments of the present application do not make specific limitations.

[0069] It can be understood that the blood collection tube sorting system in the embodiments of the present application may further include a transportation component (not shown in the figure). The transportation component may be a manipulator, a mechanical gripper, a conveyor belt, etc. The transportation component is used to transfer the test tube between different modules, improve the flow rate of the sample, achieve efficient transfer of the test tube, and improve the processing efficiency.

[0070] The blood collection tube sorting system described in the embodiments of the present invention is to more clearly illustrate the technical solutions of the embodiments of the present invention, and does not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art can know that with the evolution of the blood collection tube sorting system and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0071] Those skilled in the art can understand that Figure 1 the blood collection tube sorting system shown in

[0072] does not constitute a limitation on the embodiments of the present invention, and may include more or fewer components than shown in the figure, or combine some components, or arrange different components. Figure 2 Figure 2 is a flowchart of the specific method of the blood collection tube detection method provided by the embodiments of the present application. In some embodiments, the blood collection tube detection method is applied to but not limited to Figure 1 the blood collection tube sorting system in

[0073] Step S100, controlling the visual recognition module to collect images of the blood collection tube to be tested, obtaining a first blood collection tube image and a second blood collection tube image, where the second blood collection tube image is obtained by moving the blood collection tube to be tested to a preset light source for collection.

[0074] ​In step S100 of some embodiments, in order to achieve precise detection of the blood collection tube to be tested, first, the visual recognition module is controlled by the blood collection tube sorting system to collect images of the blood collection tube to be tested, obtaining a first blood collection tube image and a second blood collection tube image. It can be understood that the first blood collection tube image can be collected under normal ambient light conditions, which can reflect the appearance characteristics of the blood collection tube to be tested in its natural state, such as the overall contour of the blood collection tube, the identification information on the tube body (including barcodes, scale lines, etc.), and the basic information such as the color of the tube cap, thereby providing basic data for subsequent preliminary identification and judgment. Further, in order to collect the second blood collection tube image, the blood collection tube to be tested can be moved to a preset light source and then image collection is performed. The preset light source can be a backlight located behind the blood collection tube to be tested, so that the light shines on the blood collection tube from behind. When the blood collection tube to be tested is moved to the backlight, the light emitted by the backlight will pass through the tube wall of the blood collection tube and the blood sample therein. Due to the characteristics of the blood sample such as light absorption and scattering, the collected second blood collection tube image shows a clearer contour of the blood collection tube, ensuring the reliability of the image data, thereby providing a higher-quality image basis for subsequent image analysis and diagnosis.

[0075] It should be noted that the blood collection tube sorting system in the embodiments of the present application is also provided with a human-computer interaction interface, and the user can generate an opening instruction through the human-computer interaction interface, so as to be able to implement different functions according to the user's needs and achieve personalized operations.

[0076] In step S200, edge detection is performed on the first blood collection tube image to obtain edge information, and based on the edge information, the first blood collection tube image is segmented to obtain a tube body region image and a tube cap region image.

[0077] In step S200 of some embodiments, after obtaining the first blood collection tube image, edge detection processing can be performed to extract the edge information in the image for more accurate division of different regions of the image. The specific edge detection algorithms used can include Canny edge detection, Sobel operator, etc. to find the regions with the most significant changes in pixel intensity in the first blood collection tube image. Because there are obvious boundaries between different parts such as the tube body and the tube cap of the blood collection tube in the image, by detecting these edges, the key contour information of the blood collection tube can be extracted. Further, based on the edge information obtained by edge detection, the first blood collection tube image is segmented, and the first blood collection tube image can be divided into the image parts of the tube body and the tube cap, thereby obtaining a tube body region image and a tube cap region image.

[0078] In step S300, the tube cap region image is color-matched with a preset color template to determine the blood color type corresponding to the tube cap region image.

[0079] In step S300 of some embodiments, during the detection of blood collection tubes, the color of the tube cap is a key identifier for distinguishing blood collection tubes for different purposes. For example, purple tube caps usually correspond to anticoagulant blood collection tubes for whole blood testing; red tube caps represent blood collection tubes containing coagulants for biochemical testing, etc. The preset color template stores various standard tube cap colors in a numerical form, such as RGB values, HSV (hue, saturation, brightness), etc., in the database of the blood collection tube sorting system to form a color comparison table for different blood testing items. When performing color matching, the system first extracts color features from the tube cap area image. For example, it can calculate the average color value by sampling pixel points within the tube cap area, or use more complex image processing algorithms such as K-means clustering to obtain the color distribution of the tube cap. Then, the extracted color features are compared with the preset color template one by one. The similarity can be measured by calculating the distance between color values (such as Euclidean distance). The smaller the distance, the closer the colors are, thus efficiently and accurately identifying the blood color type corresponding to the tube cap area image.

[0080] Step S400: Perform color detection on the tube body area image based on the color template to obtain a centrifugation detection result, and perform liquid level detection on the second blood collection tube image based on the blood color type to obtain a liquid level detection result.

[0081] In step S400 of some embodiments, in order to determine whether the blood sample has been centrifuged sufficiently, color detection can be performed on the tube body area image based on the color template to obtain a centrifugation detection result, which is convenient for subsequent judgment of whether the blood sample is qualified. Further, after determining the blood color type, liquid level detection can be performed on the second blood collection tube image according to different blood color types to obtain a liquid level detection result. Specifically, it can be achieved by analyzing the position of the blood liquid level in the second blood collection tube image and using a liquid level detection algorithm based on this blood color type for precise detection. For example, it can judge whether the liquid level meets the detection requirements according to the shape and edge features of the liquid level surface, realizing precise analysis of the color and liquid level height of the blood sample, being able to process a large number of samples quickly, shortening the detection time, and improving the detection efficiency.

[0082] Step S500: Determine the target detection result of the blood collection tube to be tested according to the centrifugation detection result and the liquid level detection result.

[0083] In step S500 of some embodiments, by comprehensively considering the centrifugation test results and the liquid level detection results, the target test result of the blood collection tube to be tested can be determined. For example, if the centrifugation test result shows that the blood components are well separated and the liquid level detection result indicates that the liquid level height is normal, then it can be determined that the target test result of the blood collection tube is qualified, that is, the blood sample meets the standards for subsequent testing or use. On the contrary, if the centrifugation test result is not ideal, such as the blood components are not fully separated, or the liquid level detection result is abnormal, such as the liquid level is too low, then the target test result will be determined as unqualified, indicating that the blood collection tube needs to be reprocessed or the blood sample needs to be recollected.

[0084] Refer to Figure 3 , Figure 3 is a specific flowchart for image acquisition of a blood collection tube to be tested by a visual recognition module provided in an embodiment of the present application. In some embodiments, the method includes, but is not limited to, steps S110 to S130.

[0085] It should be noted that the visual recognition module includes a color acquisition component and a black-and-white acquisition component. For example, the color acquisition component and the black-and-white acquisition component may include industrial CCD (Charge-Coupled Device) cameras, high-speed cameras, infrared cameras, ultraviolet cameras, etc., and the embodiments of the present application do not make specific limitations. Further, the blood collection tube sorting system further includes a transportation component that can stably and precisely move the blood collection tube to be tested from one position to another. For example, the transportation component may include a manipulator, a mechanical gripper, a conveyor belt, etc., and the embodiments of the present application do not make specific limitations.

[0086] Step S110: Control the color acquisition component to acquire an image of the blood collection tube to be tested, obtaining a first blood collection tube image.

[0087] Step S120: Control the transportation component to move the blood collection tube to be tested to a preset light source, and control the black-and-white acquisition component to acquire an image of the blood collection tube to be tested, obtaining a second blood collection tube image.

[0088] Step S130: Alternatively, control the transportation component to move the blood collection tube to be tested to a preset light source to control the color acquisition component to acquire an intermediate image of the blood collection tube to be tested, and perform color conversion on the intermediate image to obtain a second blood collection tube image.

[0089] In steps S110 to S130 of some embodiments, during the process of image acquisition of the blood collection tube to be tested by the visual recognition module, the transportation component precisely moves the blood collection tube to be tested from the centrifuge into the acquisition range of the visual recognition module. First, the color acquisition component in the visual recognition module acquires the color image of the blood collection tube to be tested, obtaining the first blood collection tube image. After the transportation component moves the blood collection tube to be tested to the preset light source, the black and white acquisition component starts to work and acquires the second blood collection tube image.

[0090] It should be noted that when the color acquisition component acquires the intermediate image at the preset light source, the obtained image has color characteristics under specific lighting conditions. Furthermore, through color conversion processing, unnecessary color information can be removed, key features can be highlighted, and the second blood collection tube image can be obtained. For example, converting from the RGB color space to the HSV color space. Since the HSV color space is more in line with the human perception of color, abnormal structures such as clots in the blood sample can be presented more clearly, making the setting of color thresholds and color segmentation operations more convenient and accurate. It can be understood that the color acquisition component is part of the visual recognition module and can acquire images with rich color information, which helps to identify the color of the tube cap of the blood collection tube and the color change of the blood sample, etc. The black and white acquisition component is another part of the visual recognition module, which is used to acquire grayscale images and focuses on specific detections such as the liquid level detection in the blood collection tube and the transparency analysis of the blood sample. The grayscale image can provide clearer image features. The color acquisition component and the black and white acquisition component work together, can obtain the image information of the blood collection tube from two dimensions of color and grayscale, and can detect the blood collection tube to be tested from multiple angles, improving the accuracy and reliability of the detection results.

[0091] Refer to Figure 4 , Figure 4 is the specific flowchart of step S400 provided in the embodiments of the present application for liquid level detection of the second blood collection tube image based on the blood color type to obtain the liquid level detection result. In some embodiments, the method includes but is not limited to steps S411 to S416.

[0092] Step S411, determine the required blood volume corresponding to the blood color type, and determine the target liquid level height of the required blood volume.

[0093] Step S412, perform binarization processing on the second blood collection tube image to obtain a binarized image.

[0094] Step S413, perform region extraction on the binarized image to obtain a liquid level region.

[0095] Step S414, perform contour analysis on the liquid level region based on a preset line segment detection algorithm to obtain a liquid level contour line.

[0096] Step S415: Determine the pixel coordinates of the liquid level contour line, and determine the actual liquid level height of the blood collection tube to be measured according to the pixel coordinates.

[0097] Step S416: Compare the actual liquid level height with the target liquid level height to obtain the liquid level detection result.

[0098] In steps S411 to S416 of some embodiments, during the process of detecting the liquid level of the second blood collection tube image based on the blood color type, in the embodiment of the present application, first determine the required blood volume corresponding to the blood color type. For example, in a quantitative blood collection device, the required blood volume for blood collection tubes of different colors is preset in advance, and then determine the target liquid level height corresponding to the required blood volume. The target liquid level height can be a preset liquid level height. Further, perform binarization processing on the second blood collection tube image. Specifically, a threshold can be set, and the points in the second blood collection tube image with pixel values greater than the threshold are set to white (pixel value 255), and the points less than or equal to the threshold are set to black (pixel value 0). By adjusting the threshold, the blood region and the background region of the second blood collection tube are effectively separated, thereby obtaining a binarized image. Then, perform region extraction on the binarized image. For example, use image processing algorithms such as connected component analysis to extract the liquid level region. Then, perform contour analysis on the liquid level region based on a preset line segment detection algorithm to obtain the liquid level contour line. Specifically, the line segment detection algorithm can be applied to the extracted liquid level region, such as the Hough transform, etc., so as to be able to transform the line segments in the image into the parameter space for detection, and thus accurately find the liquid level contour line.

[0099] It should be noted that after determining the pixel coordinates of the liquid level contour line, it is necessary to convert them into the actual physical height, that is, determine the actual liquid level height of the blood collection tube to be measured according to the pixel coordinates. Specifically, taking the pixel coordinates of the liquid level contour line as (x, y) as an example, if the resolution of the image is known, the actual liquid level height can be calculated by the following method: actual liquid level height = y * pixel size. For example, if the resolution of the image is 0.1 mm / pixel and the y coordinate of the liquid level contour line is 600 pixels, then the actual liquid level height = 600 * 0.1 mm / pixel = 60 mm, that is, the actual liquid level height of the blood sample in the blood collection tube to be measured is calculated to be 60 mm. Then, compare the actual liquid level height with the target liquid level height to obtain the liquid level detection result, thereby realizing the detection of the liquid level height of the blood sample, facilitating subsequent judgment of whether the blood sample is qualified, being able to quickly process a large number of samples, shortening the detection time, and improving the detection efficiency.

[0100] Refer to Figure 5 , Figure 5It is a specific flowchart for edge detection of the first blood collection tube image in step S200 provided by another embodiment of the present application to obtain edge information. In some embodiments, the method includes but is not limited to steps S211 to S215.

[0101] Step S211: Perform a preprocessing operation on the first blood collection tube image to obtain a grayscale value image.

[0102] Step S212: Calculate the gradient magnitude and gradient direction of each pixel point in the grayscale value image through a preset edge detection operator.

[0103] Step S213: Perform non-maximum suppression on the grayscale value image based on the gradient magnitude and gradient direction to obtain an edge image.

[0104] Step S214: Perform edge analysis on the edge image according to a preset threshold to obtain strong edge information and weak edge information.

[0105] Step S215: Obtain edge information based on the strong edge information and the weak edge information.

[0106] In steps S211 to S215 of some embodiments, after image acquisition of the blood collection tube to be measured is performed by controlling the visual recognition module to obtain the first blood collection tube image and the second blood collection tube image, a preprocessing operation is performed on the first blood collection tube image to obtain a grayscale value image. Specific preprocessing operations can adopt methods such as grayscale conversion and Gaussian filtering. For example, perform grayscale conversion on the first blood collection tube image to convert the original color image into a grayscale image to reduce the computational complexity. For example, for a color first blood collection tube image, by converting the RGB value of each pixel point in the image into a grayscale value, a grayscale value image can be obtained, where the grayscale value can be calculated by the weighted average method. In one embodiment, a Gaussian filter can also be used to smooth the grayscale value image to remove noise and reduce noise interference. Further, the gradient magnitude and gradient direction of each pixel point in the grayscale value image are calculated through a preset edge detection operator. For example, use the Sobel operator or other gradient operators to calculate the gradient values of the pixel points in the image in the horizontal and vertical directions to obtain the gradient magnitude and gradient direction.

[0107] It should be noted that non-maximum suppression can be performed on the grayscale image based on the calculated gradient magnitude and gradient direction. For example, at a certain pixel point (x, y) in the image, if its gradient magnitude G is greater than the gradient magnitudes of its surrounding pixel points in the gradient direction, the gradient magnitude of this pixel point is retained; otherwise, the gradient magnitude of this pixel point is suppressed to 0, and then an edge image can be obtained. It can be understood that only the information of edge points is retained in the edge image. The gradient magnitudes of edge points are relatively large, and the gradient magnitudes of non-edge points are 0, enabling the edge image to more clearly display features such as the contour of the blood collection tube to be measured and the boundary of the blood sample. Further, edge analysis is performed on the edge image according to a preset threshold to obtain strong edge information and weak edge information. Specifically, assuming the preset threshold is 50, then in the edge image, pixel points with a gradient magnitude greater than 50 are strong edge points, and their corresponding edge information is strong edge information; pixel points with a gradient magnitude less than 50 but greater than 0 are weak edge points, and their corresponding edge information is weak edge information. It should be understood that strong edge information usually corresponds to areas in the image where the grayscale value changes violently, such as the edge of the tube wall of the blood collection tube and the junction between the blood sample and the tube wall; weak edge information usually corresponds to areas in the image where the grayscale value changes relatively little, such as the fine structure inside the blood sample. Then, edge information is obtained based on the strong edge information and the weak edge information, improving the detection accuracy.

[0108] Referring to Figure 6 , Figure 6 is a specific flowchart of performing image segmentation on the first blood collection tube image based on edge information in step S200 provided by another embodiment of the present application to obtain a tube body region image and a tube cap region image. In some embodiments, the method includes but is not limited to steps S221 to S223.

[0109] It should be noted that steps S221 to S223 occur after edge detection is performed on the first blood collection tube image to obtain edge information.

[0110] Step S221, perform region detection on the first blood collection tube image according to the strong edge information and the weak edge information to obtain a tube cap region image.

[0111] Step S222, perform edge connection on the strong edges and weak edges in the tube cap region image to obtain the contour of the blood collection tube cap.

[0112] Step S223, perform tube body segmentation on the first blood collection tube image based on the contour of the blood collection tube cap to obtain a tube body region image.

[0113] In steps S221 to S223 of some embodiments, after edge detection is performed on the first blood collection tube image to obtain edge information, the embodiments of the present application can also perform region detection on the first blood collection tube image according to strong edge information and weak edge information, where the strong edge information can reflect the region with a large change in gray value at the junction of the tube cap and the tube body, and the weak edge information can reflect the texture information on the surface of the tube cap. Furthermore, the region range of the tube cap in the image can be initially determined, thereby obtaining the tube cap region image. After obtaining the tube cap region image, edge connection is performed on the strong and weak edges therein to obtain a complete contour of the blood collection tube lid. For example, an edge connection algorithm can be used to obtain a smooth and closed curve as the contour of the blood collection tube lid, which can accurately reflect the shape and boundary characteristics of the tube cap.

[0114] It should be noted that after determining the contour of the tube cap, the tube body region can be segmented from the image through some image segmentation algorithms, such as threshold segmentation, region growing, etc. The embodiments of the present application do not make specific limitations. Specifically, in the first blood collection tube image, with the contour of the blood collection tube lid as the boundary, the threshold segmentation algorithm is used to distinguish the pixel points in the tube body region from the background pixel points, thereby obtaining the tube body region image.

[0115] Referring to Figure 7 , Figure 7 is the specific flowchart of color detection on the tube body region image based on the color template in step S400 provided by another embodiment of the present application to obtain the centrifugation detection result. In some embodiments, the method includes but is not limited to steps S421 to S425.

[0116] Step S421, perform color space conversion on the tube body region image to obtain a target color image, and set hue threshold, saturation threshold, and brightness threshold.

[0117] Step S422, perform color segmentation on the target color image according to the hue threshold, saturation threshold, and brightness threshold to obtain a mask image.

[0118] Step S423, multiply the mask image and the target color image pixel by pixel to obtain multiple target color regions.

[0119] Step S424, for each target color region, perform feature extraction on the target color region to obtain color features.

[0120] Step S425, compare all the color features with the color template to obtain the centrifugation detection result.

[0121] In steps S421 to S425 of some embodiments, after the body region image is obtained by performing image segmentation on the first blood collection tube image based on edge information, the blood collection tube sorting system of the embodiments of the present application can also perform color detection on the body region image. Specifically, first, the color space of the body region image is converted, for example, from the RGB space to the HSV space, to obtain the target color image. In the HSV space, color information is represented by three components: hue (H), saturation (S), and value (V). Taking the identification of the red color of blood as an example, the range of the H value of red can be set to 0 - 10 and 170 - 180, while the S value and V value are adjusted according to the specific situation of the actual image. According to these thresholds, color segmentation is performed on the target color image to obtain a mask image, where the pixel value of the target color region in the mask image is 1 (or 255), and the pixel value of the background region is 0. Further, the mask image is multiplied by the target color image pixel by pixel to obtain multiple target color regions. For example, if the value of a certain pixel point in the mask image is 1 and the value of the corresponding pixel point in the target color image is (R, G, B), then the pixel value after multiplication is still (R, G, B). That is, through pixel multiplication, an image containing only the target color region can be obtained, removing the interference of the background region. Then, for each target color region, feature extraction is performed to obtain color features. For example, color features such as the hue, saturation, and value of the target color region can be extracted by calculating the color histogram, etc. Furthermore, all the color features are compared with the color template. For example, color templates for plasma and blood cells are preset in advance, which include color features such as the hue, saturation, and value of plasma and blood cells. By comparing the extracted color features with the color template, the color type of the target color region can be determined, and the centrifugation detection result can be determined. For example, if the extracted color features match the color template of plasma, it indicates that this region is a plasma region; if the extracted color features match the color template of blood cells, it indicates that this region is a blood cell region. It can be understood that in the centrifugation detection result obtained by comparison, if the plasma and blood cell regions are clearly visible, it indicates that the blood sample has been centrifuged and the centrifugation effect is good; if the color comparison result shows that the plasma and blood cell regions are not clear or not separated, it indicates that the blood sample has not been centrifuged or the centrifugation effect is poor. Thus, according to the centrifugation detection result, it can be determined whether the blood sample meets the detection requirements, improving the accuracy of the detection.

[0122] Refer to Figure 8 , Figure 8 is a specific flowchart of a blood collection tube detection method provided by another embodiment of the present application. In some embodiments, the method further includes but is not limited to steps S600 to S700.

[0123] Step S600, when the target detection result is that the centrifugation detection result meets the preset centrifugation condition and the liquid level detection result meets the preset liquid level condition, move the blood collection tube to be tested to the preset qualified area through the transportation component.

[0124] Step S700, when the target detection result is that the centrifugation detection result does not meet the preset centrifugation condition, or the liquid level detection result does not meet the preset liquid level condition, move the blood collection tube to be tested to the preset unqualified area through the transportation component.

[0125] In steps S600 to S700 of some embodiments, after obtaining the centrifugation detection result, the blood collection tube sorting system can determine whether the blood collection tube to be tested meets the preset qualified standard according to the target detection result and the liquid level detection result. Specifically, the transportation component in the blood collection tube sorting system can move the blood collection tube to be tested to the preset qualified area when the target detection result is that the centrifugation detection result meets the preset centrifugation condition and the liquid level detection result meets the preset liquid level condition for subsequent detection or use; when the target detection result is that the centrifugation detection result does not meet the preset centrifugation condition, or the liquid level detection result does not meet the preset liquid level condition, move the blood collection tube to be tested to the preset unqualified area for reprocessing or marking.

[0126] It should be noted that the preset centrifugation condition is a centrifugation detection standard preset according to the detection requirements, and this standard can include whether the plasma and blood cells are completely separated, whether the color characteristics after separation meet the normal range, etc. And the preset liquid level condition is a liquid level detection standard preset according to the detection requirements, and this standard can include whether the actual liquid level height of the blood in the blood collection tube is within the allowable error range of the target liquid level height. For example, the preset liquid level condition can be that the error between the actual liquid level height and the target liquid level height does not exceed ±2 mm. By means of automation, quickly move the blood collection tube to be tested to the preset qualified area or the preset unqualified area according to the target detection result and the liquid level detection result, which greatly improves the sorting efficiency. Compared with the traditional manual sorting method, it can save a large amount of time and labor costs when processing a large number of blood collection tubes.

[0127] The embodiment of the present application also provides a controller, including a memory and a processor. Among them, a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is used to execute the blood collection tube detection method in the above embodiments of the present application.

[0128] Please refer to Figure 9 , Figure 9 which shows the hardware structure of the controller provided by the embodiment of the present application. The controller includes:

[0129] The processor 901 can be implemented in ways such as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0130] The memory 902 can be implemented in forms such as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 902 and are called by the processor 901 to execute the blood collection tube detection method of the embodiments of the present application;

[0131] The input / output interface 903 is used to implement information input and output;

[0132] The communication interface 904 is used to implement communication interaction between this device and other devices, and can implement communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);

[0133] The bus 905 transmits information between the various components of the device (such as the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0134] Among them, the processor 901, the memory 902, the input / output interface 903, and the communication interface 904 achieve communication connections with each other inside the device through the bus 905.

[0135] The embodiments of the present application also provide a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned blood collection tube detection method is implemented.

[0136] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0137] The embodiments described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art will know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0138] Those skilled in the art can understand that Figures 1-9 the technical solutions shown in do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown, or combine certain steps, or different steps.

[0139] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0140] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices can be implemented as software, firmware, hardware, and appropriate combinations thereof.

[0141] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0142] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (item) of the following" or its similar expression refers to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0143] In several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the above units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the system or unit can be in electrical, mechanical or other forms.

[0144] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0145] In addition, in each embodiment of this application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0146] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes: various media that can store programs, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0147] The preferred embodiments of the embodiments of this application have been described above with reference to the accompanying drawings, and thus do not limit the scope of the rights of the embodiments of this application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of this application shall be within the scope of the rights of the embodiments of this application.

Claims

1. A method for detecting blood collection tubes, characterized in that, Applied to a blood collection tube sorting system, the blood collection tube sorting system includes a visual recognition module; the method includes: Controlling the visual recognition module to collect images of the blood collection tube to be tested, obtaining a first blood collection tube image and a second blood collection tube image, wherein the second blood collection tube image is obtained by moving the blood collection tube to be tested to a preset light source for collection; Performing edge detection on the first blood collection tube image to obtain edge information, and performing image segmentation on the first blood collection tube image based on the edge information to obtain a tube body region image and a tube cap region image; Performing color matching on the tube cap region image with a preset color template to determine the blood color type corresponding to the tube cap region image; Performing color detection on the tube body region image based on the color template to obtain a centrifugation detection result, and performing liquid level detection on the second blood collection tube image based on the blood color type to obtain a liquid level detection result; Determining the target detection result of the blood collection tube to be tested according to the centrifugation detection result and the liquid level detection result.

2. The blood collection tube detection method according to claim 1, wherein, The visual recognition module includes a color acquisition component and a black-and-white acquisition component, and the blood collection tube sorting system further includes a transportation component; the controlling the visual recognition module to collect images of the blood collection tube to be tested, obtaining a first blood collection tube image and a second blood collection tube image, includes: Controlling the color acquisition component to collect an image of the blood collection tube to be tested to obtain a first blood collection tube image; Controlling the transportation component to move the blood collection tube to be tested to a preset light source, and controlling the black-and-white acquisition component to collect an image of the blood collection tube to be tested to obtain a second blood collection tube image, Or, Controlling the transportation component to move the blood collection tube to be tested to a preset light source to control the color acquisition component to collect an image of the blood collection tube to be tested to obtain an intermediate image, and performing color conversion on the intermediate image to obtain a second blood collection tube image.

3. The blood collection tube detection method according to claim 1, wherein, The performing liquid level detection on the second blood collection tube image based on the blood color type to obtain a liquid level detection result, includes: Determining the required blood volume corresponding to the blood color type, and determining the target liquid level height of the required blood volume; Performing binarization processing on the second blood collection tube image to obtain a binarized image; Performing region extraction on the binarized image to obtain a liquid level region; Performing contour analysis on the liquid level region based on a preset line segment detection algorithm to obtain a liquid level contour line; Determining the pixel coordinates of the liquid level contour line, and determining the actual liquid level height of the blood collection tube to be tested according to the pixel coordinates; Comparing the actual liquid level height with the target liquid level height to obtain a liquid level detection result.

4. The blood collection tube detection method according to claim 1, characterized in that, The performing edge detection on the first blood collection tube image to obtain edge information, includes: Performing preprocessing operations on the first blood collection tube image to obtain a grayscale value image; Calculating the gradient amplitude and gradient direction of each pixel point in the grayscale value image through a preset edge detection operator; Performing non-maximum suppression on the grayscale value image based on the gradient amplitude and the gradient direction to obtain an edge image; Performing edge analysis on the edge image according to a preset threshold to obtain strong edge information and weak edge information; Edge information is obtained based on the strong edge information and the weak edge information.

5. The blood collection tube detection method according to claim 4, wherein Performing image segmentation on the first blood collection tube image based on the edge information to obtain a tube body region image and a tube cap region image, including: Performing region detection on the first blood collection tube image according to the strong edge information and the weak edge information to obtain a tube cap region image; Connecting the strong edges and weak edges in the tube cap region image to obtain the contour of the blood collection tube cap; Performing tube body segmentation on the first blood collection tube image based on the contour of the blood collection tube cap to obtain a tube body region image.

6. The blood collection tube detection method according to claim 1, characterized in that, Performing color detection on the tube body region image based on the color template to obtain a centrifugation detection result, including: Performing color space conversion on the tube body region image to obtain a target color image, and setting a hue threshold, a saturation threshold, and a brightness threshold; Performing color segmentation on the target color image according to the hue threshold, the saturation threshold, and the brightness threshold to obtain a mask image; Multiplying the mask image and the target color image pixel by pixel to obtain multiple target color regions; For each of the target color regions, performing feature extraction on the target color region to obtain color features; Comparing all the color features with the color template in terms of color to obtain a centrifugation detection result.

7. The blood collection tube detection method according to claim 1, characterized in that, The blood collection tube sorting system further includes a transportation component; after determining the target detection result of the blood collection tube to be tested according to the centrifugation detection result and the liquid level detection result, the method further includes: When the target detection result is that the centrifugation detection result meets the preset centrifugation condition and the liquid level detection result meets the preset liquid level condition, moving the blood collection tube to be tested to a preset qualified area through the transportation component; When the target detection result is that the centrifugation detection result does not meet the preset centrifugation condition, or the liquid level detection result does not meet the preset liquid level condition, moving the blood collection tube to be tested to a preset unqualified area through the transportation component.

8. A controller, characterized in that, The controller includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the blood collection tube detection method according to any one of claims 1 to 7.

9. A blood collection tube sorting system, characterized in that, The blood collection tube sorting system includes a visual recognition module, a transportation component, and a controller according to claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to execute the blood collection tube detection method according to any one of claims 1 to 7.