Sample identification method and device, computer equipment, medium and program product
By acquiring sample images and identifying the deflection angle in a fully automated laboratory system, and rotating the sample to fit the detector, the problems of low accuracy and efficiency in label recognition in traditional systems are solved, achieving efficient and accurate label recognition and reducing system costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2026-03-24
AI Technical Summary
In traditional fully automated laboratory systems, the accuracy and efficiency of sample label recognition are low, and the reading method that combines rotation with label is costly and structurally complex.
After the sample is placed in the preset area, the sample image is acquired, the deflection angle between the label and the reference position is identified, and the sample is rotated according to the deflection angle so that the label orientation is adapted to the detector. The movement of the sample and the image acquisition are realized synchronously by using a camera and a rotating encoder.
It improves the accuracy and processing efficiency of sample label recognition, reduces system costs, simplifies the moving structure, and ensures the processing efficiency and label reading accuracy of the fully automated laboratory system.
Smart Images

Figure CN119229215B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automated laboratory technology, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for sample identification. Background Technology
[0002] As equipment becomes increasingly automated and intelligent, fully automated laboratory systems are now being adopted in many scenarios. Samples within these systems undergo processes such as collection, data entry, pre-processing, testing, and post-processing. After samples are uploaded online, their information and ID codes are identified. Online samples are then processed based on the identified unit label information. Therefore, the accuracy and reliability of sample label identification are particularly crucial for fully automated laboratory systems.
[0003] Traditional techniques require reading sample information by combining rotation and labeling, which is complex and requires designing a rotation mechanism for each module, resulting in high costs. Summary of the Invention
[0004] Therefore, it is necessary to provide a sample identification method, apparatus, computer equipment, computer-readable storage medium, and computer program product that are highly accurate and efficient in addressing the aforementioned technical problems.
[0005] Firstly, this application provides a method for identifying samples, the method comprising:
[0006] The sample is placed in a preset area, and an image of the sample is acquired to obtain a sample image; the sample is labeled.
[0007] Based on the position of the label in the sample image and the reference position of the sample in the sample image, the deflection angle between the label and the reference position is identified;
[0008] When the sample is moved out of the preset area, the sample is rotated according to the deflection angle;
[0009] After the sample is transferred and rotated, the label of the sample peripheral is identified by a detector with a preset orientation.
[0010] In one embodiment, placing the sample in a preset area and acquiring an image of the sample includes:
[0011] During the rotation of the sample gripper around the sample, if the sample gripper contacts the groove of the rotating encoder disk, an image is acquired by the camera towards the sample to obtain a sample image; wherein, the groove of the rotating encoder disk is circumferentially distributed.
[0012] After the sample gripper rotates around the sample, the sample is placed into a preset area by the sample gripper.
[0013] In one embodiment, identifying the deflection angle between the label and the reference position based on the position of the label in the sample image and the reference position of the sample in the sample image includes:
[0014] Among the sample images acquired by rotating the sample to different angles, the target sample image at the target angle is selected according to the length of the label in the reference direction;
[0015] Based on the position of the label in the target sample image and the reference position of the sample in the target sample image, the deflection angle between the label and the reference position is identified.
[0016] In one embodiment, identifying the deflection angle between the label and the reference position based on the position of the label in the sample image and the reference position of the sample in the sample image includes:
[0017] In the sample image, the center position of the label in the reference direction is detected to obtain the label position in the sample image;
[0018] In the sample image, the reference position of the sample is determined based on the center position of the sample in the reference direction;
[0019] The pixel position difference is calculated based on the label position and the reference position of the sample;
[0020] Based on the camera parameters of the sample image, the pixel position difference is converted into a deflection angle.
[0021] In one embodiment, the camera parameters include the camera distance and the number of pixels the camera has at that camera distance; the camera distance is the distance between the camera and the sample.
[0022] The step of converting the pixel position difference into a deflection angle according to the camera parameters of the sample image includes:
[0023] Based on the ratio between the camera distance and the number of pixels, the pixel position difference is converted into a deviation position;
[0024] The deflection angle is obtained by performing an angle conversion based on the ratio between the deviation position and the container radius of the sample.
[0025] In one embodiment, converting the pixel position difference into a deflection angle according to the camera parameters of the sample image includes:
[0026] Based on the camera parameters of the sample image, the pixel position difference is converted into an initial deflection angle;
[0027] The initial deflection angle is adjusted according to a preset correspondence to obtain the converted deflection angle; the preset correspondence is obtained by fitting the dataset of the initial deflection angle and the dataset of the converted deflection angle.
[0028] The step of rotating the sample according to the deflection angle when the sample is moved out of the preset area includes:
[0029] When the sample is moved out of the preset area, the sample is rotated according to the deflection angle after conversion.
[0030] Secondly, this application also provides a sample identification device, comprising:
[0031] The sample placement module is used to place the sample in a preset area and acquire an image of the sample to obtain a sample image; the sample is labeled.
[0032] An angle calculation module is used to identify the deflection angle between the label and the reference position based on the position of the label in the sample image and the reference position of the sample in the sample image;
[0033] The sample transfer module is used to rotate the sample according to the deflection angle when the sample is transferred out of the preset area;
[0034] The label recognition module is used to identify the label of the sample peripheral device by a detector with a preset orientation after the sample is removed and rotated.
[0035] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the sample identification steps in any of the above embodiments.
[0036] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the sample identification steps in any of the above embodiments.
[0037] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of sample identification in any of the above embodiments.
[0038] The aforementioned sample identification method, apparatus, computer equipment, computer-readable storage medium, and computer program product place the sample in a preset area and simultaneously acquire an image of the sample, obtaining a sample image. This allows for simultaneous sample movement and image acquisition, ensuring processing efficiency. Since the sample itself and the externally attached label are relatively independent, forming two independent dimensions, the position of the label in the sample image and the reference position of the sample in the sample image are different. The deflection angle between the label and the reference position can be identified. Furthermore, when the sample moves out of the preset area, it is rotated according to the deflection angle, allowing the process of moving the sample out of the preset area and rotating the sample to be executed synchronously, ensuring processing efficiency and ensuring that the label orientation matches the preset orientation detector. Therefore, after sample transfer and rotation, when identifying the external label of the sample using the preset orientation detector, the accuracy of label identification is ensured, and no angle adjustment of the label is required. Thus, in sample testing scenarios such as medical laboratories, this approach ensures processing efficiency, saves on moving structures, and improves label reading accuracy. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is an application environment diagram of sample image acquisition and sample movement into a preset area in one embodiment;
[0041] Figure 2 This is an application environment diagram of sample image acquisition and sample transfer in one embodiment;
[0042] Figure 3 This is a structural environment diagram when the sample is a test tube in one embodiment;
[0043] Figure 4 This is a structural environment diagram of the sample recognition gripper in one embodiment;
[0044] Figure 5 This is a flowchart illustrating a sample identification method in one embodiment;
[0045] Figure 6 This is a schematic diagram of the structure of a sample and its label in one embodiment;
[0046] Figure 7 This is a schematic diagram of the deflection angle and its compensation value in one embodiment;
[0047] Figure 8 This is a schematic diagram of the fitting of a preset correspondence in one embodiment;
[0048] Figure 9 This is a structural block diagram of a sample identification device in one embodiment;
[0049] Figure 10 This is an internal structural diagram of a computer device in one embodiment.
[0050] Explanation of reference numerals in the attached figures:
[0051] 10-Sample rack; 20-Sample identification gripper; 21-Camera; 22-Rotating encoder; 23-Sample gripper; 30-Buffer sample rack; 40-Sample injection gripper; 50-Inlet; 60-Transfer rail; 70-Test tube; 71-Test tube center; 72-Label. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0053] The sample identification method provided in this application is applied to application scenarios with a sample transfer device and an imaging device; wherein, the sample transfer device includes, but is not limited to, grippers or jigs, the imaging device includes, but is not limited to, cameras, mobile terminals, etc., and the preset area includes, but is not limited to, the area where equipment such as test tube racks and test tube stands are located.
[0054] Optionally, in a fully automated laboratory system (TLA), samples undergo pre-processing, analysis, and post-processing sequentially via a track transport system, starting from sample loading. Upon entering a unit module, sample information must be identified and verified to prevent matching errors. When the sample barcode is re-identified in the unit module, two methods can be used: rotational scanning and fixed-angle scanning. Rotational scanning requires an additional rotating scanning mechanism, increasing cost and impacting system efficiency. Fixed-angle scanning, on the other hand, places higher demands on the accuracy of barcode reading and angle recognition during sample loading. For detectors that use fixed-position scanning, this method avoids the need for additional rotational scanning devices in other units during sample loading, reducing costs. Furthermore, it optimizes the camera barcode angle recognition calculation method, ensuring the consistency of angle and barcode recognition accuracy as samples flow through other units in the automated system.
[0055] Optionally, the sample identification method provided in this application embodiment can be applied to, for example, Figure 1 In the illustrated application scenario, the scenario includes a sample rack 10, a sample identification gripper 20, and a buffer sample rack 30 in a preset area. The sample identification gripper 20 can place the sample from the sample rack 10 into the buffer sample rack 30. The sample identification gripper 20 is equipped with a camera 21, a rotating encoder 22, and sample grippers 23. Before the sample is placed into the buffer sample rack 30, the rotating encoder 22 detects the rotation of the sample grippers 23, thereby controlling the camera 21 to acquire the corresponding sample image. Based on the position of the sample peripheral tag in the sample image and the reference position of the sample in the sample image, the deflection angle between the tag and the reference position is identified. When the sample is transferred out of the buffer sample rack 30, the sample is rotated according to the deflection angle. Finally, after the sample transfer and rotation, the label of the sample peripheral is identified by a detector with a preset orientation.
[0056] Optionally, in Figure 1 Based on this, the sample identification method provided in the embodiments of this application can be applied to, for example... Figure 2 In the scenario shown, during sample injection, the sample is transferred out of the buffer sample rack 30 by the sample injection gripper 40, and the sample is rotated by the sample injection gripper 40 according to the deflection angle so that the sample label faces the outside of the injection port 50. Then, the sample is transported to the detector of the corresponding identification unit by the transport rail 60, and the label of the sample peripheral is identified by the detector with the preset orientation.
[0057] Optionally, such as Figure 3As shown, the sample is test tube 70; correspondingly, before the sample gripper 23 grasps the test tube 70, the rotation of the sample gripper 23 is detected by the rotating code disk 22 to control the camera 21 to acquire sample images of the test tube 70 at different angles; then, the sample gripper 23 grasps the test tube 70 to place it in the preset area. At this time, the center 71 of the test tube is at a different position than the label 72, and the center 71 of the test tube can be the reference position of the sample.
[0058] In one exemplary embodiment, such as Figure 5 As shown, a sample identification method is provided, applicable to scenarios such as medical laboratories, which includes the following steps 502 to 508. Wherein:
[0059] Step 502: Place the sample in the preset area and acquire an image of the sample to obtain a sample image; the sample is labeled.
[0060] A sample is a container holding the liquid to be tested. Optionally, the sample can be a test tube, sampling bottle, cryovial, or other container; the liquid to be tested includes, but is not limited to, biological samples and microbial samples; biological samples include blood, saliva, etc.; microbial samples include cell samples, microbial samples, etc.
[0061] A preset area is an area used to place samples. At least one sample is placed in the preset area, which can be a sample holder or a sample stage. Optionally, the preset area serves as a buffer for the sample loading process. The samples in the preset area are the samples to be tested, and before testing the samples in the preset area, appropriate processing such as rotation is required. Optionally, because the sample collection process and the tag scanning process have different rates, use different devices, or cover different areas, a preset area is needed for buffering. For example, if a sample gripper places 20 samples per minute into the preset area, while the tag detector scans 90 samples per minute, samples from multiple preset areas are placed separately and transmitted to the same tag detector, ensuring that the collection process and the tag scanning process have a matching rate.
[0062] Sample images convert information from physical samples into sample data. They reflect information about the sample itself, as well as information about the labels attached to its exterior, providing two dimensions of information. Sample images are captured during the process of placing the sample into a predetermined area to ensure processing efficiency.
[0063] A label is an identifier that carries sample information. The label supports the scanning function of the detector. The label can be a barcode, QR code, or RFID tag to accurately reflect the sample information. Optionally, the label can indicate the object to which the sample belongs, the sample's components, or other sample information. For example, a barcode might indicate that the sample belongs to user A and that the sample's components are blood.
[0064] Optionally, during the rotation of the sample gripper around the sample, if the sample gripper rotates to a preset position, an image is acquired by a camera pointing towards the sample to obtain a sample image; after the sample gripper has rotated around the sample, the sample is placed into a preset area using the sample gripper. The sample gripper, also called a gripper finger, is used to grasp or place the sample. Optionally, the sample gripper can move in three-dimensional space X / Y / Z, and simultaneously has rotational freedom in the Z-axis direction. The sample gripper grasps the sample and places it into a buffer sample holder in the preset area through three-dimensional motion.
[0065] Step 504: Based on the position of the label in the sample image and the reference position of the sample in the sample image, identify the deflection angle between the label and the reference position.
[0066] The reference position is the location of the sample itself within the sample image. It reflects the location where the label detector performs label recognition. Since the sample image is a view from the camera's perspective, there is a positional difference between the reference position and the label's location within the sample image. Optionally, the reference position can be the sample's centerline or center point, representing the sample's location from the corresponding camera's perspective.
[0067] The deflection angle is the angle by which the label's position in the sample image deviates from a reference position. Once the deflection angle is determined, the label can be rotated to match the reference position, thereby improving the accuracy of label recognition. Since the label in the sample is positioned on the columnar part, after calculating the deflection angle, rotation can be used to adjust the label's orientation more efficiently and accurately.
[0068] Optionally, one or more sample images can be selected from sample images acquired at different angles, based on the label's attributes within the sample images. The selected sample images are then used to identify the deflection angle between the label and a reference position, ensuring accuracy. For example, a sample image can be selected based on the length of the label in the reference direction, and this selected image can be used to identify the deflection angle between the label and the reference position. Therefore, selecting information from multiple angles results in a relatively small deflection angle, and consequently, a relatively small rotation angle, improving processing efficiency and accuracy.
[0069] Optionally, the angular difference between the label and the reference position can be used as the deflection angle, or a mapping can be performed based on the angular difference, and the mapping result can be used as the deflection angle.
[0070] Step 506: When the sample is transferred out of the preset area, rotate the sample according to the deflection angle.
[0071] Optionally, the sample can be rotated along a preset rotation direction until the deflection angle is reached, at which point the rotation stops.
[0072] Optionally, after the sample is transferred out of the buffer sample rack in the preset area by the sample injection gripper, the sample is rotated until it reaches the deflection angle, then the rotation around the sample is stopped, and the sample is placed on the transfer rail. The sample is then transferred to the outside of the preset area by the transfer rail, and the detector outside the preset area identifies the label of the sample peripheral.
[0073] Optionally, the sample loading gripper can move in three-dimensional space (X / Y / Z) and simultaneously has a rotational degree of freedom in the Z-axis direction. The sample loading gripper grasps the sample and places it on a transport track in a preset area through three-dimensional motion. The sample loading gripper may have sample clamps.
[0074] Optionally, the sample is placed from the sample rack into a buffer sample rack in a preset area using a sample recognition gripper. Upon receiving a sample loading command from the system, the sample loading gripper transfers the sample from the preset area to the sample loading port on the track. Simultaneously, the sample loading gripper rotates the sample along the Z-axis according to the deflection angle bound to the sample to ensure the consistency of the barcode orientation of all loaded sample tubes. Both the sample recognition gripper and the sample loading gripper include their own sample grippers, and the sample recognition gripper is also equipped with a camera for acquiring sample images.
[0075] Step 508: After the sample is transferred and rotated, the label of the sample peripheral is identified by a detector with a preset orientation.
[0076] A detector is a device used to identify labels. Because the detector is pre-oriented, it can detect labels in a single direction. The detector and the label have matching technologies; for example, if a sample has a barcode, then the detector is a barcode detector.
[0077] Optionally, after the sample is moved out of the preset area and rotated until the offset angle is reached, the label of the sample peripheral is scanned by a detector with a preset orientation to perform sample identification.
[0078] Because the sample has been rotated according to the deflection angle, it can be adapted to the detector with the preset orientation, thus ensuring accuracy. With the detector orientation fixed, it can provide high processing efficiency. Therefore, it can balance efficiency and accuracy.
[0079] In the aforementioned sample identification method, the sample is placed in a preset area while simultaneously acquiring an image of the sample. This allows for simultaneous sample movement and image acquisition, ensuring processing efficiency. Since the sample itself and the externally placed label are relatively independent, forming two separate dimensions, the position of the label in the sample image and the reference position of the sample in the sample image are different. This allows for the identification of the deflection angle between the label and the reference position. Furthermore, when the sample moves out of the preset area, it is rotated according to the deflection angle. This ensures that the process of moving the sample out of the preset area and rotating the sample are executed synchronously, maintaining processing efficiency and ensuring that the label orientation matches the preset orientation detector. Therefore, after sample transfer and rotation, the label identification using the preset orientation detector ensures accurate label recognition without requiring angle adjustments. Thus, in sample testing scenarios such as those in medical laboratories, this method ensures processing efficiency, saves on moving structures, and improves label reading accuracy.
[0080] In one embodiment, placing a sample in a preset area and acquiring an image of the sample includes: during the rotation of the sample gripper around the sample, if the sample gripper contacts the groove of the rotating encoder, an image is acquired by a camera towards the sample to obtain a sample image; wherein the groove of the rotating encoder is circumferentially distributed; after the sample gripper rotates around the sample, the sample is placed in the preset area by the sample gripper.
[0081] The rotary code disk is used to detect when the sample gripper rotates to a preset position. The rotary code disk has circumferentially distributed grooves, so when the sample gripper rotates to the preset position, a corresponding signal change is generated through the grooves to instruct the camera to acquire an image. Optionally, the grooves of the rotary code disk are evenly distributed circumferentially, so that the barcode information of the sample can be photographed from multiple directions upon signal triggering.
[0082] In an optional embodiment, if the sample gripper contacts the groove of the rotary encoder, an image is acquired by a camera towards the sample to obtain a sample image. This includes: if the gripper finger of the sample gripper rotates into the groove of the rotary encoder and triggers the groove to generate a sensor signal, the rotary encoder transmits the sensor signal to a camera at a preset position and controls the camera to acquire an image to obtain a sample image. Thus, the sample image acquisition process is accurately controlled by the rotational relationship between the gripper finger and the groove.
[0083] In an optional embodiment, if the sample gripper contacts the groove of the rotary encoder, an image is acquired by a camera towards the sample to obtain a sample image. This includes: if the sample gripper of the sample recognition gripper contacts the groove of the rotary encoder, an image is acquired by a camera fixed to the sample recognition gripper towards the sample to obtain a sample image.
[0084] Optionally, the sample recognition gripper is equipped with a barcode recognition camera, which takes pictures sequentially as the sample gripper rotates around the Z-axis. During the 360° rotation of the sample gripper around the Z-axis, the four notches on the rotating code disk trigger four signal transitions from the sensor, which in turn triggers the camera to take four pictures. Since the notches on the rotating code disk are evenly distributed circumferentially, sample images can be captured in four directions (front, back, left, and right) under signal triggering.
[0085] In this embodiment, the image acquisition process is controlled by rotating the sample gripper around the sample and using grooves distributed circumferentially on the rotating encoder. This allows for image acquisition at the corresponding angle of the groove by triggering a corresponding acquisition signal through the grooves, even with a fixed camera, without needing to adjust camera parameters such as focal length. This ensures relatively high image clarity and improves processing efficiency. After the sample gripper rotates around the sample, it places the sample into a preset area. The same gripper can be used to perform both the rotation and placement processes, avoiding equipment redundancy and ensuring processing efficiency.
[0086] In one embodiment, identifying the deflection angle between the label and the reference position based on the position of the label in the sample image and the reference position of the sample in the sample image includes: selecting a target sample image at a target angle according to the length of the label in the reference direction in sample images acquired by rotating the sample to different angles; and identifying the deflection angle between the label and the reference position based on the position of the label in the target sample image and the reference position of the sample in the target sample image.
[0087] The reference direction is a partial direction within the image dimensions contained in the sample image. Optionally, the reference direction is the direction of the sample image in the width dimension, and correspondingly, the length of the label in the reference direction is the width of the label in the sample image. In this case, when the label is set along the height direction on the test tube, the length of the label in the reference direction is relatively small, and the deflection angle is relatively small, to ensure processing efficiency.
[0088] Optionally, the reference direction is the direction of the sample image in the height dimension, and correspondingly, the length of the label in the reference direction is the height of the label in the sample image. In this case, when the label is set on the test tube along the width direction, the length of the label in the reference direction is relatively small, and the deflection angle is relatively small, so as to ensure processing efficiency.
[0089] The target angle is one of many angles. The target angle is determined based on the conditions satisfied by the length of the label in the reference direction. For example... Figure 6 As shown, camera 21 acquires corresponding sample images of sample 70, where the radius of sample 70 is r and the width of label 72 is w.
[0090] In an optional embodiment, among sample images acquired by rotating the sample to different angles, a target sample image at a target angle is selected according to the length of the label in the reference direction, including: among sample images acquired by rotating the sample to different angles, selecting the target sample image with the largest label width; wherein, the angle at which the target sample image with the largest label width is located is the target angle.
[0091] Optionally, since the sample images are acquired, they are related to the camera's viewpoint. Therefore, when the sample tube is placed in the preset area, the angle at which the label faces is difficult to determine. However, the widest label from the camera's viewpoint can always be found among the four acquired images, which can make the deflection angle relatively small. For example, the deflection angle between the barcode center and the sample tube center can be less than or equal to 45 degrees.
[0092] In this embodiment, the samples are rotated to different angles, thus eliminating the need to adjust camera parameters such as focal length, ensuring relatively high image clarity and improving processing efficiency. Furthermore, by selecting the target sample image at the target angle based on the label's length in the reference direction, the data dimensionality of the sample image can be reduced, converting the image dimension to the reference direction dimension, thereby ensuring processing efficiency with less data. Moreover, the length in the reference direction accurately measures the difference between the label position and the reference position, ensuring the accuracy of the deflection angle. Finally, determining the deflection angle based on the target sample image removes redundant sample images, further improving processing efficiency.
[0093] In one embodiment, identifying the deflection angle between the label and the reference position based on the label's position in the sample image and the sample's reference position in the sample image includes: detecting the center position of the label in the reference direction in the sample image to obtain the label position in the sample image; determining the reference position of the sample based on the center position of the sample in the reference direction in the sample image; calculating the pixel position difference based on the label position and the sample's reference position to obtain the pixel position difference; and converting the pixel position difference into a deflection angle according to the camera parameters of the sample image.
[0094] The center position is the center point or center line of the object contained in the sample image. Optionally, the center position of the label in the reference direction is the center point of the label, and the center position of the sample in the reference direction is the center point of the sample; for example: on the x-axis of the sample image, if the coordinates of a set of opposite sides of the label are A and B, then the center position of the label is (A+B) / 2; on the x-axis of the sample image, if the coordinates of a set of opposite sides of the sample are C and D, then the center position of the label is (C+D) / 2.
[0095] The label position is the location of the label within the sample image. The label position can be the center position of the sample in the reference direction, or it can be an adjusted version of the center position of the sample in the reference direction.
[0096] Pixel position difference refers to the difference in pixel position between the label position and the reference position along the reference direction. Optionally, the pixel position difference can be the distance difference between individual pixels, or the distance difference between pixel blocks composed of multiple pixels. When the pixel position difference is the distance difference between pixel blocks, the amount of data can be further reduced, thereby improving processing efficiency.
[0097] Camera parameters are the shooting parameters of the sample image during the acquisition process, used to reflect the camera's viewpoint. Optionally, camera parameters include camera distance and camera resolution in a reference direction; camera distance is the distance between the camera and the sample, used to convert information in the sample image into information from the actual scene.
[0098] In an optional embodiment, detecting the center position of the label in the reference direction in the sample image to obtain the label position in the sample image includes: determining the center position of the label in the width direction based on the length of the label in the width direction in the sample image; and obtaining the label position in the sample image based on the center position.
[0099] In an optional embodiment, determining the reference position of the sample based on the center position of the sample in the reference direction in the sample image includes: determining the center position of the sample in the width direction based on the length of the sample in the width direction in the sample image; and obtaining the reference position of the sample based on the center position of the sample in the width direction.
[0100] In an optional embodiment, the pixel position difference is calculated based on the label position and the reference position of the sample to obtain the pixel position difference, including: calculating the difference between the x-coordinate of the label center point in the sample image and the x-coordinate of the sample center point in the sample image to obtain the pixel position difference.
[0101] In this embodiment, both the label position and the reference position of the sample are positions in the reference direction. Therefore, both belong to the position data in the same dimension. Thus, the pixel position difference also belongs to the pixel difference in the reference direction dimension. Then, according to the camera parameters of the sample image, the pixel position difference is converted into a deflection angle, which can convert the data to the dimension of the actual scene and help improve the accuracy of the deflection angle.
[0102] In one embodiment, camera parameters include camera distance and the number of pixels the camera captures at that distance; camera distance is the distance between the camera and the sample. Camera distance represents the distance between the camera's mounting location and the sample. The farther the camera is from the sample, the more pixels it captures, and the longer the corresponding shooting distance. In this case, the ratio between camera distance and the number of pixels can more accurately reflect the positional difference between the location in the sample image and the actual location.
[0103] Based on the camera parameters of the sample image, the pixel position difference is converted into a deflection angle, including: converting the pixel position difference into a deviation position based on the ratio between the camera distance and the number of pixels; and performing angle conversion based on the ratio between the deviation position and the container radius of the sample to obtain the deflection angle.
[0104] The deviation position is the positional difference between the label and the detected position in the actual coordinate system. The difference between pixel position difference and deviation position is that pixel position difference pertains to positional differences within an image sample; conversely, deviation position is the actual positional difference between the label and the sample. For example, pixel position difference is the pixel position difference between the label position (x1, y2) and the reference position x2, i.e., P = |x1 - x2|; while deviation position is the angle by which the label deviates from the central axis of the test tube, derived from the ratio k between camera distance and pixel count, i.e., Z = k|x1 - x2|.
[0105] The container radius of the sample is the radius of the sample tube or sample bottle. Since the reference position is determined based on the center position of the sample in the sample image, the deviation position can be determined more accurately by using its container radius.
[0106] Alternatively, the expression for the deflection angle is as follows:
[0107] α=arctan [(P*109.1 / 1536) / r]*180 / π;
[0108] Where arctan is the inverse trigonometric function, P is the number of pixels whose center point of the barcode deviates from the central axis of the test tube, i.e., the pixel position difference; r is the radius of the sample container; 109.1 is the camera distance; 1536 is the number of pixels in the perpendicular direction between the camera and the sample tube. When the camera distance is 91mm, the corresponding number of pixels is 109.4mm; (P*109.1 / 1536) is the deviation position; 180 / π is the constant of the radian value to the angle value.
[0109] In this embodiment, the ratio between camera distance and the number of pixels can reflect the camera's viewing angle for image acquisition. Therefore, by using this ratio, the pixel position difference can be converted into the deviation position, which can more accurately determine the distance of the label from the center of the sample. Furthermore, by performing angle conversion based on the ratio between the deviation position and the container radius of the sample, the deviation position can be further refined based on the structure of the sample to obtain a deflection angle that is closer to the actual scene, so as to more accurately identify the label.
[0110] In one embodiment, converting pixel position differences into deflection angles according to camera parameters of the sample image includes: converting pixel position differences into initial deflection angles according to camera parameters of the sample image; adjusting the initial deflection angles according to a preset correspondence to obtain the converted deflection angles; the preset correspondence is obtained by fitting the dataset of the initial deflection angles and the dataset of the converted deflection angles.
[0111] Correspondingly, when the sample is transferred out of the preset area, the sample is rotated according to the deflection angle, including: when the sample is transferred out of the preset area, the sample is rotated according to the converted deflection angle.
[0112] The initial deflection angle is obtained by mapping pixel position differences based on camera parameters. Optionally, the pixel position differences can be converted into angles to obtain the initial deflection angle; alternatively, the pixel position differences can be converted into deviation positions based on the ratio between camera distance and the number of pixels; the initial deflection angle is obtained by performing angle conversion based on the ratio between the deviation position and the sample's container radius.
[0113] The preset correspondence is obtained by fitting the dataset of initial deflection angles and the dataset of transformed deflection angles. Optionally, the preset correspondence is obtained based on polynomial linear fitting.
[0114] Optionally, the expression for the preset correspondence is as follows:
[0115] α0 = 0.0128α 2 + 0.9947α;
[0116] Where α0 is the deflection angle after conversion, and α is the initial deflection angle.
[0117] like Figure 7 As shown, the initial deflection angle is α, and the corresponding compensation value is β; correspondingly, the fitting process of the preset correspondence is as follows: Figure 8 As shown; after obtaining the preset correspondence, α can be transformed to obtain the transformed deflection angle α0 to ensure accuracy. The relationship between the initial deflection angle, compensation value, and transformed deflection angle is shown in Table 1, as follows:
[0118] Table 1
[0119] Calculated value α Compensation value β <![CDATA[Deflection angle α0 after conversion]]> 31.37 13.628 44.998 29.14 9.726 38.866 26.244 8.758 35.002 23.479 6.461 29.94 20.162 4.778 24.94 16.486 3.454 19.94 12.635 2.304 14.939 8.561 1.378 9.939 4.338 0.602 4.94 0 0 0
[0120] In this embodiment, given that the angle between the maximum width of the barcode center and the test tube center in the sample image is relatively small, the initial deflection angle will deviate from the actual angle between the barcode center and the sample center due to the planar perspective of the camera. To eliminate the angle deviation, parameter values are taken from the dataset under different angle conditions and fitted to improve accuracy.
[0121] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0122] Based on the same inventive concept, this application also provides a sample identification device for implementing the sample identification method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more sample identification device embodiments provided below can be found in the limitations of the sample identification method described above, and will not be repeated here.
[0123] In one exemplary embodiment, such as Figure 9 As shown, a sample identification device is provided, comprising:
[0124] The sample placement module 902 is used to place the sample in a preset area and acquire an image of the sample to obtain a sample image; the sample is labeled.
[0125] An angle calculation module 904 is used to identify the deflection angle between the label and the reference position based on the position of the label in the sample image and the reference position of the sample in the sample image;
[0126] The sample transfer module 906 is used to rotate the sample according to the deflection angle when the sample is transferred out of the preset area;
[0127] The tag recognition module 908 is used to identify the tag of the sample peripheral by a detector with a preset orientation after the sample is removed and rotated.
[0128] In one embodiment, the sample placement module 902 is used for:
[0129] During the rotation of the sample gripper around the sample, if the sample gripper contacts the groove of the rotating encoder disk, an image is acquired by the camera towards the sample to obtain a sample image; wherein, the groove of the rotating encoder disk is circumferentially distributed.
[0130] After the sample gripper rotates around the sample, the sample is placed into a preset area by the sample gripper.
[0131] In one embodiment, the angle calculation module 904 is used for:
[0132] Among the sample images acquired by rotating the sample to different angles, the target sample image at the target angle is selected according to the length of the label in the reference direction;
[0133] Based on the position of the label in the target sample image and the reference position of the sample in the target sample image, the deflection angle between the label and the reference position is identified.
[0134] In one embodiment, the angle calculation module 904 is used for:
[0135] In the sample image, the center position of the label in the reference direction is detected to obtain the label position in the sample image;
[0136] In the sample image, the reference position of the sample is determined based on the center position of the sample in the reference direction;
[0137] The pixel position difference is calculated based on the label position and the reference position of the sample;
[0138] Based on the camera parameters of the sample image, the pixel position difference is converted into a deflection angle.
[0139] In one embodiment, the camera parameters include the camera distance and the number of pixels the camera has at that camera distance; the camera distance is the distance between the camera and the sample.
[0140] The angle calculation module 904 is used for:
[0141] Based on the ratio between the camera distance and the number of pixels, the pixel position difference is converted into a deviation position;
[0142] The deflection angle is obtained by performing an angle conversion based on the ratio between the deviation position and the container radius of the sample.
[0143] In one embodiment, the angle calculation module 904 is used for:
[0144] Based on the camera parameters of the sample image, the pixel position difference is converted into an initial deflection angle;
[0145] The initial deflection angle is adjusted according to a preset correspondence to obtain the converted deflection angle; the preset correspondence is obtained by fitting the dataset of the initial deflection angle and the dataset of the converted deflection angle.
[0146] Correspondingly, the sample transfer module 906 is used for:
[0147] When the sample is moved out of the preset area, the sample is rotated according to the deflection angle after conversion.
[0148] Each module in the aforementioned sample identification device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0149] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a sample identification method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0150] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0151] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0152] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0153] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0154] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0155] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0156] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0157] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for identifying samples, characterized in that, The method includes: The sample is placed in a preset area, and an image of the sample is acquired to obtain a sample image; the sample is labeled. In the sample image, the center position of the label in the reference direction is detected to obtain the label position in the sample image; in the sample image, the reference position of the sample is determined based on the center position of the sample in the reference direction; the pixel position difference is calculated based on the label position and the reference position of the sample to obtain the pixel position difference; Based on the ratio between camera distance and pixel count, the pixel position difference is converted into a deviation position; based on the ratio between the deviation position and the container radius of the sample, an angle conversion is performed to obtain the deflection angle; the pixel count is the number of pixels of the camera at the specified camera distance; the camera distance is the distance between the camera and the sample. When the sample is moved out of the preset area, the sample is rotated according to the deflection angle; After the sample is transferred and rotated, the label of the sample peripheral is identified by a detector with a preset orientation.
2. The method according to claim 1, characterized in that, The step of placing the sample in a preset area and acquiring an image of the sample includes: During the rotation of the sample gripper around the sample, if the sample gripper contacts the groove of the rotating encoder disk, an image is acquired by the camera towards the sample to obtain a sample image; wherein, the groove of the rotating encoder disk is circumferentially distributed. After the sample gripper rotates around the sample, the sample is placed into a preset area by the sample gripper.
3. The method according to claim 1, characterized in that, The method further includes: Among the sample images acquired by rotating the sample to different angles, the target sample image at the target angle is selected according to the length of the label in the reference direction; Wherein, the label position and the reference position are both positions in the target sample image.
4. The method according to claim 1, characterized in that, The angle conversion based on the ratio between the deviation position and the container radius of the sample to obtain the deflection angle includes: An initial deflection angle is obtained by performing angle conversion based on the ratio between the deviation position and the container radius of the sample; The initial deflection angle is adjusted according to a preset correspondence to obtain the converted deflection angle; the preset correspondence is obtained by fitting the dataset of the initial deflection angle and the dataset of the converted deflection angle. The step of rotating the sample according to the deflection angle when the sample is moved out of the preset area includes: When the sample is moved out of the preset area, the sample is rotated according to the deflection angle after conversion.
5. The method according to claim 1, characterized in that, The step of detecting the center position of the label in the reference direction in the sample image to obtain the label position in the sample image includes: In the sample image, the center position of the label in the width direction is determined based on the length of the label in the width direction; The label position in the sample image is obtained by detection based on the center position.
6. The method according to claim 1, characterized in that, Determining the reference position of the sample in the sample image based on the center position of the sample in the reference direction includes: In the sample image, the center position of the sample in the width direction is determined based on the length of the sample in the width direction; The reference position of the sample is determined based on the center position of the sample in the width direction.
7. A sample identification device, characterized in that, The device includes: The sample placement module is used to place the sample in a preset area and acquire an image of the sample to obtain a sample image; the sample is labeled. An angle calculation module is used to detect the center position of the label in the reference direction in the sample image to obtain the label position in the sample image; determine the reference position of the sample based on the center position of the sample in the reference direction in the sample image; and calculate the pixel position difference based on the label position and the reference position of the sample to obtain the pixel position difference. The angle calculation module is used to convert the pixel position difference into a deviation position based on the ratio between the camera distance and the number of pixels; and to perform angle conversion based on the ratio between the deviation position and the container radius of the sample to obtain the deflection angle; the number of pixels is the number of pixels of the camera at the camera distance; the camera distance is the distance between the camera and the sample; The sample transfer module is used to rotate the sample according to the deflection angle when the sample is transferred out of the preset area; The label recognition module is used to identify the label of the sample peripheral device by a detector with a preset orientation after the sample is removed and rotated.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device, and non-transitory computer readable medium for detecting label on curved container
US20230368420A1
System and method for automatically orienting product containers
US20240278952A1