Automatic deviation rectifying method for liquid taking needle tip of medicine bottle, product, equipment and medium

Automatic correction of the needle tip is achieved through imaging devices and parameter conversion technology, which solves the problem of low correction efficiency of the robotic arm and improves the accuracy and efficiency of the liquid extraction operation of the medicine bottle.

CN118887290APending Publication Date: 2024-11-01美蓝(杭州)医药科技有限公司
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410991944.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The needle tip correction efficiency of the robotic arm during the liquid extraction process of the medicine bottle is low, requiring manual monitoring and intervention, resulting in inconvenience in operation and inefficiency.

Method used

The needle tip image is taken using the camera device, and the feature points are mapped to the three-dimensional image coordinate system and the world coordinate system using internal and external parameters. The needle tip deviation is compared in real time and corrected, and the position and angle adjustment are adjusted through the end effector to achieve automatic deviation correction.

Benefits of technology

It improves the accuracy and stability of the needle tip position, reduces manual intervention, improves work efficiency, and ensures the accuracy and safety of liquid extraction operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887290A_ABST
    Figure CN118887290A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of deviation rectification control, in particular to an automatic deviation rectification method for a medicine bottle liquid taking needle tip, a product, equipment and a medium. The method comprises the following steps: acquiring an image which is shot by a camera device according to a dynamic time interval and comprises a liquid taking needle tip, and internal parameters and external parameters of the camera device; identifying a feature point corresponding to the needle tip from the image, and determining an image coordinate of the feature point in a three-dimensional image coordinate system based on the internal parameters; converting the image coordinates into actual coordinates in a three-dimensional world coordinate system based on the external parameters; and acquiring the preset position of the needle tip, comparing the actual coordinate with the preset position to obtain the deviation of the needle tip, and correcting the deviation of an end effector used for clamping the liquid taking needle tip according to the deviation. The deviation can be found and corrected in time, the deviation correction efficiency is improved, and the accuracy of the position of the needle point can be kept in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of deviation correction control technology, and in particular to a method, product, device and medium for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle. Background Art

[0002] In the process of taking liquid from a medicine bottle, ensuring the precise positioning of the needle tip is crucial to improving the accuracy of taking liquid and the safety of operation. The relevant technology uses high-end equipment such as liquid taking robots and the precise control of the robotic arm to achieve the initial positioning of the needle tip.

[0003] However, when the robotic arm performs positioning tasks, it is limited by its own mechanical precision and motion control algorithm, and the needle tip is prone to deviation when approaching the target, requiring manual monitoring. When deviation is detected, manual intervention or restarting the process occurs, and the correction efficiency is low. Summary of the invention

[0004] In order to solve the problem of low needle tip deviation correction efficiency in the prior art, the present application provides a method, product, equipment and medium for automatically correcting the needle tip for taking liquid from a medicine bottle.

[0005] In the first aspect, the present application provides a method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle, which adopts the following technical solution: A method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle, comprising: Acquire an image including a liquid collection needle tip taken by a camera device at a dynamic time interval, as well as internal and external parameters of the camera device; Identifying a feature point corresponding to the needle tip from the image, and determining the image coordinates of the feature point in a three-dimensional image coordinate system based on the internal parameters; Converting the image coordinates into actual coordinates in a three-dimensional world coordinate system based on the external parameters; The preset position of the needle tip is obtained, the actual coordinates are compared with the preset position to obtain the deviation of the needle tip, and the end effector used to clamp the liquid collection needle tip is corrected according to the deviation.

[0006] By adopting the above technical solution, a camera device is used to capture the image of the liquid collection needle tip, and its internal parameters are used to map the feature points in the image to the three-dimensional image coordinate system, thereby ensuring the accurate extraction of image information, and then using external parameters to convert the image coordinates into actual coordinates in the three-dimensional world coordinate system, thereby achieving accurate mapping from image space to physical space. This process can dynamically acquire the image taken by the camera device and process the image in real time to calculate the current position of the needle tip. After comparing with the preset position, the needle tip deviation can be immediately identified and the end effector can be corrected accordingly. This real-time feedback mechanism ensures that the system can respond quickly to operational errors, thereby maintaining a high degree of accuracy and stability in the needle tip position, and no manual intervention is required to correct the needle tip position, thereby reducing the burden on operators and improving work efficiency.

[0007] In a preferred example, the present application may be further configured as follows: the number of the feature points is multiple, the actual coordinates include the actual coordinates corresponding to the multiple feature points, and the preset positions include the ideal position coordinates corresponding to the multiple feature points; The comparing the actual coordinates with the preset position to obtain the deviation of the needle tip includes: Determining an end feature point corresponding to the end effector from the plurality of feature points; Compare the actual coordinates of the end feature point with the ideal position coordinates to obtain a position offset, wherein the position offset includes an X offset, a Y offset, and a Z offset; The posture offset of the needle tip is determined according to the actual coordinates and the ideal position coordinates corresponding to each of the plurality of feature points, and the position offset and the posture offset constitute the deviation of the needle tip.

[0008] By adopting the above technical solution and comparing the actual coordinates and ideal position coordinates of multiple feature points, more comprehensive deviation information can be obtained, which helps to reduce the deviation calculation error caused by single feature point recognition error or noise interference. The comparison results of multiple feature points can verify and complement each other, so as to more accurately reflect the overall position and posture deviation of the liquid collection needle tip. By comparing the actual coordinates and ideal position coordinates of the terminal feature point separately, the position offset of the needle tip in the three directions of X, Y, and Z can be accurately calculated. Based on the comparison results of multiple feature points, the posture offset of the needle tip can be further analyzed. According to the difference between the position offset and the posture offset, a more targeted correction strategy can be formulated.

[0009] In a preferred example, the present application may be further configured as follows: determining the posture offset of the needle tip according to the actual coordinates and the ideal position coordinates corresponding to each of the plurality of feature points includes: According to the actual coordinates corresponding to the plurality of feature points, the actual direction of the needle tip is obtained, and according to the ideal position coordinates corresponding to the plurality of feature points, the ideal direction of the needle tip is obtained; The rotation axis and the rotation angle of the actual direction and the ideal direction are calculated, and the attitude offset of the needle tip is determined according to the rotation axis and the rotation angle.

[0010] By adopting the above technical solution, based on the coordinate information of multiple feature points, the actual direction vector and ideal direction vector of the needle tip can be accurately calculated. These two vectors represent the current posture and expected posture of the needle tip in the physical space, respectively. The rotation axis and rotation angle between the actual direction and the ideal direction are calculated, and the posture difference is converted into a specific numerical value, providing an accurate quantitative indicator for subsequent correction operations.

[0011] In a preferred example, the present application may be further configured as follows: the deviation correction of the end effector for clamping the liquid collection needle tip according to the deviation includes: Performing position correction on an end effector for clamping the liquid collection needle tip according to the X offset, the Y offset, and the Z offset; Angle correction is performed on the end effector according to the posture offset.

[0012] By adopting the above technical solution, the X offset, Y offset and Z offset are accurately calculated, and the position of the end effector can be accurately adjusted to align it with the ideal position of the liquid collection needle tip, ensuring the success of the liquid collection operation. According to the posture offset (including the rotation axis and the rotation angle), the angle of the end effector can be adjusted to match the ideal posture of the liquid collection needle tip, ensuring that the needle tip can perform the liquid collection operation with the correct posture, avoiding problems such as operation failure or liquid splashing due to incorrect posture.

[0013] In a preferred example, the present application can be further configured as follows: the method further includes: Calculating the distance between the actual coordinates and the ideal position coordinates of each feature point in the plurality of feature points to obtain a plurality of distances, and calculating an average distance of the plurality of distances; comparing the average distance with a preset deviation threshold; If the average distance exceeds the preset deviation threshold, the dynamic time interval is updated, and the updated dynamic time interval is smaller than the dynamic time interval before the update, so that the camera device captures images according to the updated dynamic time interval; the deviation of the needle tip after the dynamic time interval is updated is monitored, and if the deviations of a preset number of times do not exceed the preset deviation threshold, the dynamic time interval is updated, and the updated dynamic time interval is larger than the dynamic time interval before the update, so that the camera device captures images according to the updated dynamic time interval.

[0014] By adopting the above technical solution, the shooting time interval of the camera device is dynamically adjusted according to the deviation monitored in real time. When the deviation is large, the shooting time interval is shortened to acquire images more frequently, so as to respond and correct the deviation more quickly; when the deviation is small, the shooting time interval is extended to reduce unnecessary image acquisition and processing, thereby improving system efficiency.

[0015] In a preferred example, the present application may be further configured as follows: the internal parameters include focal length and optical center; The step of identifying a feature point corresponding to the needle tip from the image and determining the image coordinates of the feature point in a three-dimensional image coordinate system based on the internal parameters includes: Inputting the image into a prediction model to obtain the two-dimensional coordinates of the feature point corresponding to the needle tip in the image, wherein the prediction model is trained by using a plurality of needle tip images with marked feature points; Depth information of the feature point is acquired, and based on the depth information, the focal length and the optical center, the two-dimensional coordinates are converted into image coordinates of the feature point in the three-dimensional image coordinate system.

[0016] By adopting the above technical solution, the prediction model obtained by training with needle tip images that have been annotated with multiple feature points can more accurately identify the feature points of the needle tip in the image. Obtaining the depth information of the feature points is the key to achieving two-dimensional to three-dimensional conversion, enabling the system to perceive the three-dimensional structure of the scene. Based on internal parameters and the depth information of the feature points, the principle of perspective projection is used to convert the two-dimensional coordinates of the feature points into coordinates in the three-dimensional image coordinate system, thereby achieving precise positioning of the feature points in three-dimensional space, providing an important basis for subsequent deviation calculation and correction operations.

[0017] In a preferred example, the present application may be further configured as follows: the external parameters include a rotation matrix and a translation vector; and the step of converting the image coordinates into actual coordinates in a three-dimensional world coordinate system based on the external parameters includes: generating a transformation matrix based on the rotation matrix and the translation vector; Multiplying the image coordinates by the transformation matrix to obtain homogeneous coordinates in the three-dimensional world coordinate system; The actual coordinates are extracted from the homogeneous coordinates.

[0018] By adopting the above technical solution, using the rotation matrix and translation vector, the two-dimensional coordinates in the image can be accurately mapped to the three-dimensional world coordinate system, ensuring the accurate conversion from image space to physical space, and providing a reliable foundation for subsequent deviation calculation and correction operations. Using the transformation matrix for coordinate transformation can reduce the error accumulation that may occur during multiple conversions.

[0019] In a second aspect, the present application provides a computer program product, which adopts the following technical solution: A computer program product includes a computer program. When the computer program is executed by a processor, the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle as described in any one of the first aspects is implemented.

[0020] In a third aspect, the present application provides an electronic device, which adopts the following technical solution: one or more processors; Memory; At least one application, wherein at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle as described in any one of the first aspects.

[0021] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle as described in any one of the first aspects.

[0022] In summary, this application includes the following beneficial technical effects: The present application utilizes a camera device to capture an image of a liquid collection needle tip, and utilizes its internal parameters to map feature points in the image to a three-dimensional image coordinate system, thereby ensuring accurate extraction of image information, and then utilizes external parameters to convert image coordinates into actual coordinates in a three-dimensional world coordinate system, thereby achieving precise mapping from image space to physical space. This process can dynamically acquire images taken by the camera device, and process the images in real time to calculate the current position of the needle tip. After comparing it with the preset position, the needle tip deviation can be immediately identified, and the end effector can be corrected accordingly. This real-time feedback mechanism ensures that the system can respond quickly to operational errors, thereby maintaining a high degree of accuracy and stability in the needle tip position, and does not require manual intervention to correct the needle tip position, thereby reducing the burden on operators and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a schematic flow chart of a method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle provided in an embodiment of the present application; Figure 2 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following is combined with Figure 1 -Attached Figure 2This application is described in further detail.

[0025] This specific embodiment is merely an explanation of the present application and is not a limitation of the present application. After reading this specification, those skilled in the art may make modifications to the present embodiment without any creative contribution as needed, but such modifications are protected by the patent law as long as they are within the scope of the claims of the present application.

[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0027] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.

[0028] It should be noted that in the optional embodiments of the present application, the object information and other related data involved, when the embodiments in the present application are applied to specific products or technologies, need to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. In other words, if the embodiments of the present application involve data related to the object, it needs to be obtained with the authorization and consent of the object, the authorization and consent of the relevant departments, and in compliance with the relevant laws, regulations and standards of the country and region. If personal information is involved in the embodiments, the acquisition of all personal information needs to obtain the consent of the individual. If sensitive information is involved, the separate consent of the information subject needs to be obtained. The embodiments also need to be implemented with the authorization and consent of the object.

[0029] The present application embodiment provides a method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle, such as Figure 1As shown, the method provided in the embodiment of the present application is performed by an electronic device, which can be a server or a terminal device, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The terminal device and the server can be directly or indirectly connected via wired or wireless communication. The embodiment of the present application is not limited here. The method includes steps S101-S104, wherein: S101, obtaining an image of the liquid collection needle tip taken by the camera device at a dynamic time interval, as well as the internal parameters and external parameters of the camera device.

[0030] Specifically, the camera device uses a high-resolution industrial camera, and the camera device is installed at an appropriate position around the liquid collection robot to ensure that the shooting field of view of the camera device covers the liquid collection needle tip. Then, configure the parameters of the camera device, such as exposure time, white balance, etc., to obtain a clear image. The dynamic time interval of shooting is set according to the real-time requirements of the liquid collection process, so that the camera device can be controlled by electronic equipment to capture images according to the set dynamic time interval. The internal parameters of the camera device, including the focal length and the optical center, can be obtained from the configuration file of the camera device. The internal parameters are used to define how the camera device projects points in the three-dimensional world onto the two-dimensional image plane.

[0031] External parameters can be obtained through visual calibration methods. The calibration process includes: selecting a chessboard or the like as a marker, placing the marker at different positions and directions within the field of view of the camera device, acquiring images and performing image processing, using a corner detection algorithm to extract feature points such as corner positions, converting the positions of the feature points in the image into their three-dimensional coordinates in the world coordinate system, and then using a visual calibration algorithm (such as the PnP algorithm, the DLT algorithm, etc.) to determine the external parameters of the camera device. These algorithms use the relationship between the projection of the feature points in the image and their actual positions in the world coordinate system to solve the external parameters of the camera device.

[0032] S102, identifying feature points corresponding to the needle tip from the image, and determining image coordinates of the feature points in a three-dimensional image coordinate system based on internal parameters.

[0033] Specifically, the prediction model is pre-trained through a plurality of needle tip images with marked feature points. The obtained image is input into the prediction model, and the feature points corresponding to the needle tip can be identified from the image. The feature points can be represented by their two-dimensional coordinates in the image. There are multiple feature points, and the multiple feature points include the end feature points corresponding to the clamping position of the end effector for clamping the liquid collection needle tip, and the needle tip feature points corresponding to the other end.

[0034] Furthermore, according to the internal parameters of the camera device, the two-dimensional coordinates of each feature point in the image can be converted into image coordinates in a three-dimensional image coordinate system.

[0035] S103 . Convert the image coordinates into actual coordinates in a three-dimensional world coordinate system based on external parameters.

[0036] Specifically, the external parameters include a rotation matrix and a translation vector. For any one of the multiple feature points, the conversion process is: generate a transformation matrix based on the rotation matrix and the translation vector, convert the image coordinates of the feature point into homogeneous coordinates, called the first homogeneous coordinates, and multiply the first homogeneous coordinates and the transformation matrix to obtain the homogeneous coordinates of the feature point in the three-dimensional world coordinate system, called the second homogeneous coordinates, and convert the obtained second homogeneous coordinates into the actual coordinates in the three-dimensional world coordinate system.

[0037] S104, obtaining a preset position of the needle tip, comparing the actual coordinates with the preset position, obtaining a deviation of the needle tip, and correcting the deviation of the end effector used for clamping the liquid collection needle tip according to the deviation.

[0038] Specifically, the preset position includes the ideal position coordinates corresponding to each of the multiple feature points. The operator sets the ideal position coordinates of the needle tip feature point in the three-dimensional world coordinate system and the spatial relationship (including distance, angle, etc.) of the remaining feature points (including the terminal feature point) relative to the ideal position coordinates of the needle tip feature point according to actual needs. The ideal position coordinates corresponding to each feature point can be calculated based on the spatial relationship to obtain the preset position, which includes the ideal position coordinates corresponding to each feature point. According to the actual coordinates and ideal position coordinates of each feature point, the end effector used to clamp the liquid collection needle tip can be corrected.

[0039] The embodiment of the present application utilizes a camera device to capture an image of the liquid collection needle tip, and utilizes its internal parameters to map feature points in the image to a three-dimensional image coordinate system, thereby ensuring accurate extraction of image information, and then utilizes external parameters to convert image coordinates into actual coordinates in a three-dimensional world coordinate system, thereby achieving precise mapping from image space to physical space. This process can dynamically acquire images taken by the camera device, and process the images in real time to calculate the current position of the needle tip. After comparing it with the preset position, the needle tip deviation can be immediately identified, and the end effector can be corrected accordingly. This real-time feedback mechanism ensures that the system can respond quickly to operational errors, thereby maintaining a high degree of accuracy and stability in the needle tip position, and does not require manual intervention to correct the needle tip position, thereby reducing the burden on the operator and improving work efficiency.

[0040] In a possible implementation manner of the embodiment of the present application, there are multiple feature points, the actual coordinates include the actual coordinates corresponding to each of the multiple feature points, and the preset positions include the ideal position coordinates corresponding to each of the multiple feature points; Compare the actual coordinates with the preset position to obtain the deviation of the needle tip, including: Determine an end feature point corresponding to the end effector from the plurality of feature points; Compare the actual coordinates of the end feature point with the ideal position coordinates to obtain the position offset, which includes X offset, Y offset and Z offset; According to the actual coordinates and ideal position coordinates corresponding to the plurality of feature points, the attitude offset of the needle tip is determined, and the position offset and the attitude offset constitute the deviation of the needle tip.

[0041] In this embodiment, the X-coordinate difference between the ideal position coordinates and the actual coordinates of the terminal feature point, i.e., the X offset, is calculated, the Y-coordinate difference between the ideal position coordinates and the actual coordinates of the terminal feature point, i.e., the Y offset, is calculated, and the Z-coordinate offset between the ideal position coordinates and the actual coordinates of the terminal feature point, i.e., the Z offset, is calculated. For any of the X offset, the Y offset, and the Z offset, if the offset is greater than zero, the end effector is moved in the positive direction of the axis corresponding to the offset by a distance equal to the offset, and if the offset is less than zero, the end effector is moved in the negative direction of the axis corresponding to the offset by a distance equal to the absolute value of the offset.

[0042] The embodiment of the present application can obtain more comprehensive deviation information by comparing the actual coordinates and ideal position coordinates of multiple feature points, which helps to reduce the deviation calculation error caused by single feature point recognition error or noise interference. The comparison results of multiple feature points can verify and complement each other, so as to more accurately reflect the overall position and posture deviation of the liquid collection needle tip. By comparing the actual coordinates and ideal position coordinates of the terminal feature point separately, the position offset of the needle tip in the three directions of X, Y, and Z can be accurately calculated. Based on the comparison results of multiple feature points, the posture offset of the needle tip can be further analyzed. According to the difference between the position offset and the posture offset, a more targeted correction strategy can be formulated.

[0043] A possible implementation of the embodiment of the present application is to determine the posture offset of the needle tip according to the actual coordinates and the ideal position coordinates corresponding to each of the multiple feature points, including: The actual direction of the needle tip is obtained according to the actual coordinates corresponding to the multiple feature points, and the ideal direction of the needle tip is obtained according to the ideal position coordinates corresponding to the multiple feature points; The rotation axis and the rotation angle of the actual direction and the ideal direction are calculated, and the attitude offset of the needle tip is determined according to the rotation axis and the rotation angle.

[0044] In this embodiment, the actual coordinates of the terminal feature point and the needle tip feature point are determined from the actual coordinates corresponding to each of the plurality of feature points, and the vector between the terminal feature point and the needle tip feature point is calculated based on the actual coordinates of the terminal feature point and the needle tip feature point as the actual direction. The ideal coordinates of the terminal feature point and the needle tip feature point are determined from the ideal coordinates corresponding to each of the plurality of feature points, and the vector between the terminal feature point and the needle tip feature point is calculated based on the ideal coordinates of the terminal feature point and the needle tip feature point as the ideal direction.

[0045] Furthermore, after obtaining the actual direction and the ideal direction represented by the vector, the angle between the actual direction and the ideal direction, i.e., the rotation angle, and the rotation axis perpendicular to the actual direction and the ideal direction are calculated. Then, the Rodriguez rotation formula can be used to convert the rotation axis and the rotation angle into a rotation matrix, which is used as a posture offset to indicate that a vector rotates from one direction to another.

[0046] Based on the coordinate information of multiple feature points, the embodiment of the present application can accurately calculate the actual direction vector and the ideal direction vector of the needle tip. These two vectors respectively represent the current posture and the expected posture of the needle tip in the physical space, calculate the rotation axis and rotation angle between the actual direction and the ideal direction, and convert the posture difference into a specific numerical value, thereby providing an accurate quantitative indicator for subsequent correction operations.

[0047] A possible implementation of the embodiment of the present application is to correct the deviation of the end effector for clamping the liquid collection needle tip according to the deviation, including: Performing position correction on an end effector for clamping a liquid collection needle tip according to an X offset, a Y offset, and a Z offset; The angle of the end effector is corrected according to the posture offset.

[0048] In this embodiment, the order of position correction and angle correction is not limited, and the correction order among the X-axis, Y-axis and Z-axis is not limited.

[0049] The embodiment of the present application accurately calculates the X offset, Y offset and Z offset, and can accurately adjust the position of the end effector to align it with the ideal position of the liquid collection needle tip, thereby ensuring a successful liquid collection operation. According to the posture offset (including the rotation axis and the rotation angle), the angle of the end effector can be adjusted to match the ideal posture of the liquid collection needle tip, thereby ensuring that the needle tip can perform the liquid collection operation with the correct posture, thereby avoiding problems such as operation failure or liquid splashing due to incorrect posture.

[0050] In a possible implementation manner of the embodiment of the present application, the method further includes: Calculate the distance between the actual coordinates and the ideal position coordinates of each feature point in the multiple feature points to obtain multiple distances, and calculate the average distance of the multiple distances; comparing the average distance to a preset deviation threshold; If the average distance exceeds the preset deviation threshold, the dynamic time interval is updated, and the updated dynamic time interval is smaller than the dynamic time interval before the update, so that the camera device captures images according to the updated dynamic time interval; Monitor the deviation of the needle tip after updating the dynamic time interval. If the deviations of the preset number of times do not exceed the preset deviation threshold, the dynamic time interval is updated, and the updated dynamic time interval is greater than the dynamic time interval before the update, so that the camera device captures images according to the updated dynamic time interval.

[0051] In this embodiment, the distance between the actual coordinates and the ideal position coordinates of each feature point in the plurality of feature points can be calculated by the Euclidean distance formula, and the distances of all feature points are added and divided by the total number of feature points to obtain the average distance. The preset distance deviation is set based on actual experience and is not specifically limited in this embodiment.

[0052] In a possible case, the average distance does not exceed the preset deviation threshold, indicating that the needle tip deviation is small, and the dynamic time interval may not be adjusted at this time.

[0053] In another possible situation, the average distance exceeds the preset offset threshold, indicating that the needle tip deviation is large, and the dynamic time interval is adjusted. The adjustment method can be based on the first adjustment difference or the first adjustment ratio. The adjustment method based on the first adjustment difference is to use the sum of the dynamic time interval and the first adjustment difference as the updated dynamic time interval; the adjustment method based on the first adjustment ratio is to use the product of the dynamic time interval and the first adjustment ratio as the updated dynamic time interval. Both the first adjustment difference and the first adjustment ratio can be set according to actual needs. The first adjustment difference is a negative number and the first adjustment ratio is greater than 0 and less than 1.

[0054] Furthermore, the images captured by the camera device according to the updated dynamic time interval are obtained, and the needle tip deviation is calculated based on each captured image. Each deviation obtained after the dynamic time interval is updated is compared with the preset deviation threshold. If a certain deviation exceeds the preset deviation threshold before reaching the preset number of times, an alarm signal is issued to remind the operator that the terminal controller may have a fault. If the deviations of the preset number of times do not exceed the preset deviation threshold, the dynamic time interval is updated based on the second adjustment difference or the second adjustment ratio. The method of adjusting based on the second adjustment difference is to use the sum of the dynamic time interval and the first adjustment difference as the updated dynamic time interval; the method of adjusting based on the second adjustment ratio is to use the product of the dynamic time interval and the second adjustment ratio as the updated dynamic time interval. Both the second adjustment difference and the second adjustment ratio can be set according to actual needs. The second adjustment difference is a positive number and the second adjustment ratio is greater than 1.

[0055] The embodiment of the present application dynamically adjusts the shooting time interval of the camera device according to the deviation conditions monitored in real time. When the deviation is large, the shooting time interval is shortened to acquire images more frequently, thereby responding to and correcting the deviation more quickly; when the deviation is small, the shooting time interval is extended to reduce unnecessary image acquisition and processing, thereby improving system efficiency.

[0056] In a possible implementation of the embodiment of the present application, the internal parameters include focal length and optical center; The feature points corresponding to the needle tip are identified from the image, and the image coordinates of the feature points in the three-dimensional image coordinate system are determined based on the internal parameters, including: The image is input into the prediction model to obtain the two-dimensional coordinates of the feature points corresponding to the needle tip in the image. The prediction model is trained by multiple needle tip images with marked feature points. The depth information of the feature point is obtained, and based on the depth information, focal length and optical center, the two-dimensional coordinates are converted into image coordinates of the feature point in the three-dimensional image coordinate system.

[0057] In this embodiment, the process of training the prediction model is: collecting a series of images containing needle tips, and manually annotating the feature points of these images, the annotations indicate the location and type of key feature points (such as end feature points or needle tip feature points), using the annotated images to train a deep learning model such as a convolutional neural network model, the model learns the ability to automatically identify and locate feature points from images, and deploys the trained prediction model in an actual application environment.

[0058] Furthermore, for any feature point among multiple feature points, the process of determining the image coordinates of the point is: obtain the depth information of the feature point, that is, the depth value D (using a depth camera as a camera device, the depth value of each pixel point can be read in the obtained image), express the optical center coordinates in the internal parameters as (m, n), express the focal length as f, express the two-dimensional coordinates of the feature point as (x, y), and the image coordinates (X, Y, Z) of the feature point in the three-dimensional image coordinate system can be calculated by the following formula: X = (xm) × D / f, Y = (yn) × D / f, Z = D.

[0059] The embodiment of the present application uses a prediction model obtained by training a needle tip image with multiple annotated feature points, which can more accurately identify the feature points of the needle tip in the image and obtain the depth information of the feature points, which is the key to achieving two-dimensional to three-dimensional conversion, so that the system can perceive the three-dimensional structure of the scene, and based on internal parameters and the depth information of the feature points, utilizes the principle of perspective projection to convert the two-dimensional coordinates of the feature points into coordinates in the three-dimensional image coordinate system, thereby achieving precise positioning of the feature points in three-dimensional space, and providing an important basis for subsequent deviation calculation and correction operations.

[0060] In a possible implementation of the embodiment of the present application, the external parameters include a rotation matrix and a translation vector; The image coordinates are converted to actual coordinates in the 3D world coordinate system based on external parameters, including: Generate a transformation matrix based on the rotation matrix and translation vector; Multiply the image coordinates and the transformation matrix to obtain homogeneous coordinates in the three-dimensional world coordinate system; Extract the actual coordinates from the homogeneous coordinates.

[0061] In this embodiment, the rotation matrix is ​​a 3×3 matrix, which represents the rotation of the three-dimensional image coordinate system relative to the three-dimensional world coordinate system, and the translation vector is a 3×1 vector, which represents the position of the origin of the three-dimensional image coordinate system in the three-dimensional world coordinate system, that is, the translation relationship between the coordinate origins.

[0062] Specifically, the rotation matrix is ​​expressed as The translation vector is expressed as [t x , t y , t z ], the transformation matrix generated based on the rotation matrix and translation vector is expressed as Multiply the image coordinates and the transformation matrix to obtain a homogeneous coordinate containing four components. Remove the last component, which is 1, and the remaining three components constitute the actual coordinates of the feature point.

[0063] The embodiment of the present application utilizes a rotation matrix and a translation vector to accurately map the two-dimensional coordinates in an image to a three-dimensional world coordinate system, thereby ensuring accurate conversion from image space to physical space, and providing a reliable basis for subsequent deviation calculation and correction operations. Using a transformation matrix for coordinate conversion can reduce the accumulation of errors that may occur during multiple conversions.

[0064] An embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the contents shown in the aforementioned embodiment of the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle are implemented.

[0065] An electronic device is provided in an embodiment of the present application, such as Figure 2 As shown, Figure 2 The electronic device 200 shown includes: a processor 201 and a memory 203. The processor 201 and the memory 203 are connected, such as through a bus 202. Optionally, the electronic device 200 may also include a transceiver 204. It should be noted that in actual applications, the transceiver 204 is not limited to one, and the structure of the electronic device 200 does not constitute a limitation on the embodiments of the present application.

[0066] The processor 201 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 201 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0067] The bus 202 may include a path to transmit information between the above components. The bus 202 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 202 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but it does not mean that there is only one bus or only one type of bus.

[0068] The memory 203 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0069] The memory 203 is used to store the application code for executing the solution of the present application, and is controlled to execute by the processor 201. The processor 201 is used to execute the application code stored in the memory 203 to implement the contents shown in the embodiment of the automatic deviation correction method for taking liquid from a medicine bottle.

[0070] Figure 2 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0071] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer-readable storage medium is run on a computer, the computer can execute the contents shown in the aforementioned embodiment of the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle.

[0072] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0073] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle, characterized in that: include: Acquire an image including a liquid collection needle tip taken by a camera device at a dynamic time interval, as well as internal and external parameters of the camera device; Identifying a feature point corresponding to the needle tip from the image, and determining the image coordinates of the feature point in a three-dimensional image coordinate system based on the internal parameters; Converting the image coordinates into actual coordinates in a three-dimensional world coordinate system based on the external parameters; The preset position of the needle tip is obtained, the actual coordinates are compared with the preset position to obtain the deviation of the needle tip, and the end effector used to clamp the liquid collection needle tip is corrected according to the deviation.

2. The method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle according to claim 1, characterized in that: There are multiple feature points, the actual coordinates include the actual coordinates corresponding to each of the multiple feature points, and the preset positions include the ideal position coordinates corresponding to each of the multiple feature points; The comparing the actual coordinates with the preset position to obtain the deviation of the needle tip includes: Determining an end feature point corresponding to the end effector from the plurality of feature points; Compare the actual coordinates of the end feature point with the ideal position coordinates to obtain a position offset, wherein the position offset includes an X offset, a Y offset, and a Z offset; The posture offset of the needle tip is determined according to the actual coordinates and the ideal position coordinates corresponding to each of the plurality of feature points, and the position offset and the posture offset constitute the deviation of the needle tip.

3. The method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle according to claim 2, characterized in that: The step of determining the posture offset of the needle tip according to the actual coordinates and the ideal position coordinates corresponding to each of the plurality of feature points comprises: According to the actual coordinates corresponding to the plurality of feature points, the actual direction of the needle tip is obtained, and according to the ideal position coordinates corresponding to the plurality of feature points, the ideal direction of the needle tip is obtained; The rotation axis and the rotation angle of the actual direction and the ideal direction are calculated, and the attitude offset of the needle tip is determined according to the rotation axis and the rotation angle.

4. The method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle according to claim 3, characterized in that: The step of correcting the deviation of the end effector for clamping the liquid collection needle tip according to the deviation comprises: Performing position correction on an end effector for clamping the liquid collection needle tip according to the X offset, the Y offset, and the Z offset; Angle correction is performed on the end effector according to the posture offset.

5. The method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle according to claim 2, characterized in that: The method further comprises: Calculating the distance between the actual coordinates and the ideal position coordinates of each feature point in the plurality of feature points to obtain a plurality of distances, and calculating an average distance of the plurality of distances; comparing the average distance with a preset deviation threshold; If the average distance exceeds the preset deviation threshold, the dynamic time interval is updated, and the updated dynamic time interval is smaller than the dynamic time interval before the update, so that the camera device captures images according to the updated dynamic time interval; Monitor the deviation of the needle tip after updating the dynamic time interval. If the deviations of a preset number of times do not exceed the preset deviation threshold, update the dynamic time interval, and the updated dynamic time interval is greater than the dynamic time interval before the update, so that the camera device captures images according to the updated dynamic time interval.

6. The method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle according to claim 1, characterized in that: The internal parameters include focal length and optical center; The step of identifying a feature point corresponding to the needle tip from the image and determining the image coordinates of the feature point in a three-dimensional image coordinate system based on the internal parameters includes: Inputting the image into a prediction model to obtain the two-dimensional coordinates of the feature point corresponding to the needle tip in the image, wherein the prediction model is trained by using a plurality of needle tip images with marked feature points; Depth information of the feature point is acquired, and based on the depth information, the focal length and the optical center, the two-dimensional coordinates are converted into image coordinates of the feature point in the three-dimensional image coordinate system.

7. The method for automatically correcting the deviation of a needle tip for taking liquid from a medicine bottle according to claim 1, characterized in that: The external parameters include a rotation matrix and a translation vector; The converting the image coordinates into actual coordinates in a three-dimensional world coordinate system based on the external parameters comprises: generating a transformation matrix based on the rotation matrix and the translation vector; Multiplying the image coordinates by the transformation matrix to obtain homogeneous coordinates in the three-dimensional world coordinate system; The actual coordinates are extracted from the homogeneous coordinates.

8. A computer program product, characterized in that It includes a computer program, which, when executed by a processor, implements the steps of the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle according to any one of claims 1 to 7.

9. An electronic device, characterized in that: include: at least one processor; Memory; At least one application, wherein at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed in a computer, the computer is caused to execute the method for automatically correcting the deviation of a needle tip for extracting liquid from a medicine bottle as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Flying probe test probe deviation compensation method, device, equipment and medium

    CN119575278A

  • A flying probe test probe deviation compensation method, device, equipment and medium

    CN119575278B

  • Surgical instrument and cannula position alignment method and system

    CN120189232A

  • Biological three-dimensional printer needle point calibration method and system and medium

    CN121179735A

  • Medical test equipment medicament bottle rotating plate motion control method and system

    CN121879432A