Visual accurate measurement method for reagent adding amount
Through machine vision detection technology, the accurate measurement of the amount of reagent added is achieved, solving the problems of insufficient support for any concentration and low operating tolerance in traditional solutions, and improving the accuracy and robustness of reagent preparation.
Patent Information
- Application Number
- CN202510354134.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-05-30
AI Technical Summary
Traditional automated reagent preparation solutions lack support for any concentration, lack of general functionality, and have strict requirements on sensor installation accuracy and equipment placement direction, and insufficient operating tolerance, making it difficult to accurately measure the amount of reagent liquid.
By consuming visual images containing the container, linear detection and arc detection are implemented, the longitudinal edge and liquid level line of the container are determined, the least squares method is used for elliptical fitting, the attitude and liquid level height of the container are calculated, and the liquid level height of the container is then determined.
It realizes accurate measurement of the amount of liquid added, supports continuous measurement of any amount of liquid added and detection of the entire process of liquid adding, improves the accuracy and robustness of reagent preparation, and is suitable for intelligent automated liquid adding.
Smart Images

Figure CN120063421A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for visual feature extraction and pose estimation, particularly a method for visually accurate measurement of the reagent addition volume, and belongs to the field of machine vision. Background Art
[0002] The reagent preparation technology is widely used in industries such as food processing, petroleum, pesticides, pharmacology, biochemistry, materials, medicine, and environmental protection. Especially in the fields of pharmacology, biochemistry, medicine, and environmental protection, due to the strict requirements for the proportion of substance components, greater challenges are posed to the accuracy and robustness of reagent preparation. With the expansion of the R & D and production scale, the demand for automation and intelligence in this professional field is also continuously increasing.
[0003] In traditional automated reagent preparation schemes, time, weight, or optoelectronic signals at fixed positions are usually used as feedback quantities for control. However, such schemes either lack support for arbitrary concentrations and have insufficient functional versatility, or have strict requirements for the installation accuracy of sensors and the placement direction of equipment, and have insufficient fault tolerance for related operations. On this basis, strengthening the process monitoring performance and introducing the self-calibration technology for the addition volume are the key technologies to solve the new requirements for automatic reagent preparation. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for visually accurate measurement of the reagent addition volume based on machine vision detection to achieve accurate measurement of the addition volume.
[0005] The technical solution of the present invention is as follows: A method for visually accurate measurement of the reagent addition volume, obtaining (acquiring) a visual image (referred to as an image for short) containing a container, performing straight line (straight line segment, or short straight line segment) detection and arc (arc segment) detection on the visual image, determining the longitudinal (longitudinally extending) edge (long boundary) of the container according to the straight line detection result, determining each arc corresponding to the liquid level line and the auxiliary line respectively according to the arc detection result, performing ellipse fitting on some (at least including the arc corresponding to the liquid level line) or all arcs by using the least square method, taking the fitted ellipse as the image ellipse of the corresponding liquid level line or auxiliary line, calculating and determining the pose (container inclination angle) of the container based on any image ellipse (for example, the image ellipse of the liquid level line), calculating and determining the liquid level height based on the image ellipse of the liquid level line, and calculating and determining the liquid volume in the container based on the pose of the container and the liquid level height.
[0006] The container can generally be a test tube or other test tube-shaped containers.
[0007] Further, before performing straight line detection and arc detection, pixel clustering analysis is performed on the visual image and / or container edge detection is carried out. The container clustering region (the region where the container is located, which can be a rough region) is identified through clustering analysis, and the edge of the container region (which can be the edge of a rough region) is identified through container edge detection.
[0008] Preferably, in the clustering analysis, the weighted sum of the pixel value and the pixel distance is used as the similarity evaluation function D i,j :
[0009] D i,j = α·||p i - p j || 1 +(1 - α)·||X i - X j || 2 ,
[0010] where p i and X i are the pixel value and the position of point i respectively, p j and X j are the pixel value and the position of point j respectively, α is the weighting coefficient, 0 < α < 1, and point i and point j are any two points (pixel points) in the visual image.
[0011] Preferably, the Canny operator is used to perform the container region edge detection.
[0012] Preferably, the LSD algorithm is used to perform straight line detection on the visual image.
[0013] Preferably, the longest straight line detected in the straight line detection is taken as the reference line, and the sub-longest lines (including equal-length lines) parallel or nearly parallel to the reference line are extracted near the reference line. The reference line and the sub-longest lines parallel or nearly parallel to the reference line are used as the alternative boundaries of the two long sides of the container. Based on the container clustering region obtained through clustering analysis and / or the container region edge obtained through container region edge detection, as well as the aspect ratio of the container, the alternative boundaries of the two long sides of the container are verified. If the area of the region between the two straight lines (line segments) used as the alternative boundary is consistent with the area of the test tube clustering region (the difference is within the allowable / defined range, the same below) and / or the two straight lines used as the alternative boundary match the positions of the two long straight edges of the container region edge, and the aspect ratio (the ratio of the length of the straight line to the distance between the two straight lines) is consistent with the aspect ratio of the container, then it is determined that the two straight lines are the two long boundaries of the container.
[0014] When appropriate, the verification of the alternative boundary can also be omitted, and the two straight lines in the alternative boundary can be directly determined as the two long boundaries of the container.
[0015] If the alternative boundary fails the verification, first eliminate the second-longest straight line that has been used, extract the next second-longest straight line, use the longest straight line and the new second-longest straight line as the new alternative boundary, and re-implement the verification. Repeat this process until two long boundaries that pass the verification are obtained. If two long boundaries that pass the verification still cannot be obtained, eliminate the longest straight line, use the previously eliminated second-longest straight line as the new longest straight line, re-obtain the alternative boundary and conduct the verification. Repeat this process until two long boundaries that pass the verification are obtained. If all combinations of all possible straight line segments cannot pass the verification, the longitudinal edge recognition fails this time.
[0016] Preferably, the elli-LAD algorithm is used to implement the arc detection of the visual image.
[0017] Preferably, taking the relatively complete ellipse as the judgment criterion, select the arc segment that is closest to the complete ellipse and has the sum of the number of auxiliary lines, the number of liquid level lines, and the number of circular openings at the top of the container as the alternative arc segments corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container. Among them, the number of auxiliary lines is one or more (which can be called N, and N is a positive integer), the number of liquid level lines is one, and the number of circular openings at the top of the container is zero (when there is no circular opening at the top) or one. Determine the attributes of the arc segments according to the test tube length, the position of the auxiliary lines, and the morphological similarity relationship between multiple ellipses (the respective image ellipses corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container should be basically the same or similar, and the differences are within the allowable / limited range), confirm that these arc segments belong to the arc segments corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container, and establish the corresponding relationship between each arc segment and the auxiliary lines, liquid level lines, and circular openings at the top of the container (when there is no circular opening at the top of the container, there is no arc segment corresponding to the circular opening at the top of the container).
[0018] In the determination of the attributes of the arc segments, if it is determined that some (one or several) arc segments do not belong to the arc segments corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container, then eliminate these arc segments, re-select an equal number of arc segments to replace these eliminated arc segments with the relatively complete ellipse as the judgment criterion, and re-implement the arc segment judgment. Repeat this process until all the arc segments used for the determination of the attributes of the arc segments belong to the arc segments corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container. If arc segments that meet the quantity requirements and belong to the arc segments corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container still cannot be obtained after searching through all possible arc segments, the recognition of the liquid level lines and auxiliary lines fails this time (or the arc segment detection fails this time).
[0019] When appropriate, it is also possible not to implement the determination of the attributes of the arc segments and directly determine the selected alternative arc segments as belonging to the arc segments corresponding to the auxiliary lines, liquid level lines, and circular openings at the top of the container.
[0020] The auxiliary line is a circular ring line located in a certain cross-section of the container with the central axis of the container (or rather, the intersection of the central axis and the corresponding cross-section) as the center.
[0021] The auxiliary line can usually be set on the outer wall of the container.
[0022] Preferably, when performing ellipse fitting on an arc segment by using the least squares method, the antipodal distance from a point to the ellipse is used as / replaces the distance from the point to the ellipse (the true distance, or the distance commonly referred to).
[0023] The height of the corresponding auxiliary line in the corresponding container posture can be calculated based on the image ellipse of any one or more auxiliary lines. According to the position of the corresponding auxiliary line on the container and the height of the corresponding auxiliary line in the corresponding container posture obtained by calculation, the liquid level height determined by calculating based on the image ellipse of the liquid level line is calibrated or corrected.
[0024] In the case where the liquid surface is perpendicular to the central axis of the container, the liquid volume in the container can be calculated according to the following formula:
[0025]
[0026] In the case where the liquid surface is not perpendicular to the central axis of the container, the liquid volume in the container can be calculated according to the following formula:
[0027]
[0028] In the formula, Q is the liquid volume in the container, D is the inner diameter of the container (the diameter of the pipe hole), h is the height of the liquid level line obtained by calculation, and φ is the inclination angle of the container (the angle with the vertical line).
[0029] The present invention adopts machine vision technology and appropriate algorithms. By using a monocular vision system to collect images of the liquid-adding test tube and the auxiliary lines thereon, extracting the arc segment images of the forward auxiliary lines, fitting and restoring the elliptical image features, solving the rotation relationship between the camera and the test tube according to the co-cone projection relationship of the auxiliary line, elliptical image, and optical center, extracting the actual height of the liquid surface during liquid addition, and calculating the liquid addition volume. Compared with the traditional photoelectric switch trigger determination mode with a fixed liquid addition volume, it can realize continuous measurement of any liquid addition volume and full-process detection of liquid addition, which is an important technical basis for realizing intelligent automatic liquid addition and can be used in intelligent automatic liquid addition or other related occasions. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a schematic flow chart of the present invention;
[0031] Figure 2 is a schematic diagram of the container and auxiliary lines involved in the present invention;
[0032] Figure 3 is a schematic diagram of the geometric definition of the antipodal distance of the present invention;
[0033] Figure 4 is a schematic diagram of the definition of the liquid addition volume and liquid surface height of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0034] See Figures 1-4 , the present invention realizes the automatic detection of the posture and liquid level of test tubes and similar containers through machine vision detection technology, can be used for liquid addition amount monitoring in the automatic reagent preparation process and other similar occasions, has the ability to autonomously calibrate and correct measurement values, and can achieve more accurate measurement of the liquid addition amount.
[0035] The method includes the following steps:
[0036] Step 1: Detect the longitudinal edge, liquid level line and auxiliary line (if necessary) of the liquid storage container through vision.
[0037] Due to the difference in light transmittance, even for a transparent test tube, under the condition of the existence of a background light source, its visual image will be significantly different from the background color. Therefore, fast calculation can be carried out through threshold segmentation and edge detection methods. Taking a pure white background as an example, the test tube area will show gray pixels of different degrees, and the frontal edge of it may show a phenomenon of local color deepening, which is more conducive to the detection of the edge. In order to realize the online self-calibration and correction function, auxiliary lines can be added in the container area (such as engraving / drawing on the container wall). The auxiliary line can adopt a circular ring line located on a certain cross-section of the container with the central axis of the container (or rather, the intersection of the central axis and the corresponding cross-section) as the center (see Figure 2 shown). Since the auxiliary line is preset and the position is known, it can be used for the calibration of the liquid level height.
[0038] Obtain an image (or called a visual image) containing the test tube through an image acquisition device such as a CMOS / CCD (collectively referred to as a camera), and use machine vision technology to detect the image to identify / acquire the longitudinal edge, liquid level line and auxiliary line. The camera is usually set on one side in the horizontal direction of the liquid taking container, and the optical axis of the camera and the longitudinal axis of the container have an angle of not less than 70°. By setting an appropriate installation distance, it is ensured that the camera can obtain an image containing the entire container and the container is located in the middle of the image. According to the detection needs, real-time images can be continuously (periodically) captured during the liquid addition process, and real-time detection results can be obtained based on the real-time images.
[0039] Especially, the relevant installation relationship between the camera and the test tube has been covered in the principle calculation process of this method. The liquid level height can be directly obtained through the calculation process, that is, strict installation relationship does not need to be executed, only the application conditions that the optical axis of the camera and the longitudinal axis of the container have an angle of not less than 70° and the image acquisition range of the camera can cover the whole liquid taking container need to be satisfied, which has the advantage of scene generalization.
[0040] The following image detections can be included:
[0041] 1) Identification of the foreground area (container clustering area) of the image:
[0042] In image detection, the visual image can be used as the input first. The segmentation threshold is calculated through clustering analysis to distinguish the foreground area and the background area of the image. Denote the pixels of four pixel points in the background area / edge area of the visual image (for example, any point on each boundary among the four image boundaries / edges, such as the midpoint, or the four corner points of the image) as the four classification centers (initial clustering centers), and the pixels of the target area / middle area (for example, the central pixel point of the image) as the fifth classification center. Calculate the pixel clustering respectively, and use the weighted sum of the pixel value and the pixel distance as the similarity evaluation function D i,j Calculate the clustering difference degree, that is:
[0043] D i,j =α·||p i -p j || 1 +(1-α)·||U i -U j || 2
[0044] In the formula, p represents the pixel value, U represents the pixel position, the subscripts i and j represent the corresponding values of the i-th point and the j-th point respectively. The class with the initial clustering center as the central pixel point is defined as the area where the container is located. α is the weight value for clustering of position and pixel value. Since the position is a strong constraint and the pixel value is a weak constraint, the value of α should be less than 0.5, and the empirical value is 0.3
[0045] Obtain / determine the approximate area of the container (container clustering area) through clustering analysis, which is used to verify the correctness of the subsequent edge detection results
[0046] 2) Detection of the long boundary of the container:
[0047] Use the Canny operator to detect the area edge, and then perform short line segment detection through the LSD (a Line Segment Detector) algorithm. Take the longest detected line as the reference line, and extract the second longest line (including the equal-length line) parallel or nearly parallel to it near this line. Verify this boundary according to the approximate length-width ratio range of the container and the test tube area obtained by clustering (correctness verification). If the area of the middle region between these two lines occupies most of the test tube clustering area and the length-width ratio meets the expectation, then it can be considered that these two lines are the two long boundaries of the container
[0048] 3) Detection of auxiliary line / liquid level line:
[0049] The auxiliary line and the liquid level line are arc-shaped regions between the two long boundaries, usually appearing as ellipses. When the camera optical axis lies on the plane where the auxiliary line or the liquid level line is located, the auxiliary line or the liquid level line appears as a straight line segment with both ends connected to the two long boundaries respectively. In this case, this straight line segment can also be regarded as an ellipse with a short axis of zero, and it can be confirmed through the detection of short straight line segments. The elli-LAD algorithm is used for feature detection (arc segment detection), and the arc segments of relatively complete ellipses are used as the judgment criteria. The number of detected ones should be the number of set auxiliary lines plus 1 (plus 2 if there is an open container circular ring opening), and the additional 1 part is the liquid level plane. It can be judged according to the test tube length, the position of the auxiliary line, and the morphological similarity relationship between multiple ellipses, distinguish the specific categories of different arcs, and determine the arcs belonging to the liquid level line and the auxiliary line.
[0050] Step 2: Perform ellipse equation fitting based on the arc results detected by image detection (elli-LAD algorithm detection).
[0051] The epipolar distance is used to describe the distance from a point to the ellipse E, and the ellipse equation is fitted accordingly.
[0052] In a two-dimensional plane, the ellipse equation corresponds to a binary quadratic equation, and is described by the parametric model as:
[0053]
[0054] where a, b, c, d, e, f correspond to the description parameters in the ellipse parametric equation, and A is the corresponding quadratic parameter matrix. X T represents the homogeneous representation of the two-dimensional space point coordinates. Denote the plane coordinates of another two-dimensional point as (x 1 , y 1 ), and the homogeneous coordinates of any point (which can be called point m) are m = (x 1 , y 1 , 1) T . According to the different distribution relationships between the point and the ellipse, three types of epipolar lines for the point outside, on, and inside the ellipse can be obtained.
[0055] For the case where the point is outside the ellipse, the epipolar line l 0 intersects with the ellipse E, and the tangents at the two intersection points intersect at the position of the outer point m. For the case where the point is on the ellipse, the epipolar line l 0 is tangent to the ellipse E, and the tangent point is the point m. For the case where the point is inside the ellipse, the polar line l 0 is located outside the ellipse, showing a separated relationship. Since the position of the perpendicular point corresponding to the true distance cannot be directly calculated, the epipolar distance is used for substitution. It is easy to know that the distance from the point m to any point on the ellipse E is not less than the true value d 0 of the distance from the point to the ellipse. Based on this principle, the epipolar distance d is defined as: Denote the perpendicular line from the point m to the epipolar line l 0 as l1 , l 1 intersects the proximal end of the ellipse at point m 1 , then the distance d is the distance between point m and point m 1 (as shown in Figure 3 and Figure 4 ).
[0056] The equation of the epipolar line of pixel point (outlier) m with respect to the ellipse is calculated as:
[0057] l 0 = Am = u(l 01 , l 02 , 1) T
[0058] The steps to calculate the epipolar distance d from pixel point m to the ellipse are as follows:
[0059] ① Calculate the perpendicular line l 0 from point m to the epipolar line l 1 of the ellipse;
[0060] ② Calculate and obtain the intersection point m 1 of l 1 and the proximal end of the ellipse;
[0061] ③ Calculate the distance between point m and point m 1 , which is the epipolar distance d.
[0062] Use the epipolar distance d from a point to the ellipse as a substitute for the true distance d from the point to the ellipse 0 , and use the least squares method to perform ellipse fitting on each detected arc or arc segment (the arcs / arc segments belonging to the liquid level line and the auxiliary line) respectively, to obtain the fitted ellipse E (or the equation of ellipse E).
[0063] Step 3: Calculate the relationship between the camera and the container / liquid surface based on the ellipse fitting result in the image.
[0064] Given that the original auxiliary line on the container is circular, the parametric equation of its image ellipse in the camera coordinate system can be denoted as:
[0065]
[0066] where L is the camera focal length. Then the cone surface σ 1 formed by this ellipse and the camera optical center can be denoted as:
[0067]
[0068] where X c represents the three-dimensional space point coordinates in the camera system, and H is the cone surface parameter matrix. Since the cone surface equation is a ternary quadratic homogeneous equation, the parameter matrix H can be diagonalized, and the diagonalization result is denoted as:
[0069]
[0070] where D is the diagonal matrix obtained after diagonalization, and V is the eigenvector used in the diagonalization process. Since V can be regarded as the basis vector, the diagonalization process can be regarded as a rotation transformation, that is, the conical surface σ 1 can be subjected to coordinate system transformation through diagonalization and enter the diagonal system. At this time, the conical surface is described as σ 2 , and its equation can be written as:
[0071]
[0072] where X d represents the three-dimensional space point coordinates in the diagonal system. In this coordinate system, the horizontal section of the conical surface σ 2 is a standard ellipse (which can be called the section standard ellipse). Then, the intersection line of this section standard ellipse and the liquid level plane satisfies:
[0073]
[0074] The horizontal section of the conical surface after diagonalization intersects with the liquid level plane at a straight line. At this time, the rotation relationship between the two planes can be used to describe the position of the liquid level plane in the diagonal system. Denote the coordinates of the liquid level center in the diagonal system as X d0 =(x d0 , y d0 , z d0 ) T , then it satisfies the constraint:
[0075]
[0076] where g is the undetermined sign function, which may take two possible values of +1 or -1. That is, there may be two solutions to the above equation. Therefore, disambiguation is required. Disambiguation can be carried out using the constraint parallel to the container edge. Denote X i and X j as the pixel points on the two edge lines respectively. At this time, the rotation transformation matrix solved from the camera ellipse image and the liquid level plane is denoted as:
[0077]
[0078] Then, the back-projection lines of the edges can be solved respectively according to the two possible solutions, and further calculate the solution closer to parallel as the correct solution R sel of the rotation transformation matrix, that is:
[0079] R sel =min(arccos(inv(R c )·Δ(X i ), inv(R c )·Δ(Xj )))
[0080] That is to say, according to the boundary straight line parallel constraint, pixel point back-projection is used to eliminate ambiguity and obtain the correct solution R of the rotation transformation matrix. sel :
[0081]
[0082] The solution R selected according to the disambiguation determination sel can be used to calculate the rotation relationship R between the camera and the liquid surface. c At the same time, according to the container outer wall parallel constraint, the rotation and translation transformation relationship (R w T w ) between the camera and the container can be directly calculated by using the Perspective-n-Point algorithm. Furthermore, the coordinates of the liquid surface center point in the container axial system can be calculated as:
[0083]
[0084] Since the liquid surface itself conforms to the plane hypothesis, the inclination angle φ of the liquid level plane and the container central axis to the plumb direction can be estimated by the two-point method. At this time, in the plumb world coordinate system, the liquid level height h is calculated as:
[0085] h = z d0 - D cos(φ)
[0086] where D is the inner diameter (pipe hole diameter) of the container.
[0087] Step 4: Calculate the current liquid filling amount from the relationship between the camera system and the container / liquid surface.
[0088] Under ideal conditions (as shown in the left figure of Figure 4 ), the volume corresponding to the liquid surface can be calculated as the volume of the bottom hemispherical segment + the volume of the cylindrical segment. However, in actual use, due to the existence of installation errors and placement errors, the container axis may not be in the plumb direction itself (as shown in the right figure of Figure 4 ), and at this time, error compensation is required.
[0089] Under ideal conditions (the liquid surface is perpendicular to the container central axis, see the left figure example of Figure 4 ), the liquid volume is calculated as:
[0090]
[0091] Under non-ideal conditions (in actual situations, that is, when the liquid surface is not perpendicular to the container central axis, see the right figure example of Figure 4 ), the liquid volume is calculated as:
[0092]
[0093] Where Q is the amount of liquid in the container, D is the inner diameter of the container (hole diameter of the tube), h is the height of the liquid level line obtained by calculation, and φ is the inclination angle of the container (the angle with the vertical line).
[0094] The container applicable to the above liquid amount calculation is a circular tube-shaped container with a hemispherical bottom (for example, a test tube).
[0095] Since the volume between the auxiliary line and the liquid level line is equal to the cross-sectional area of the inner cavity of the container multiplied by the axial distance between the auxiliary line and the liquid level line, and the position of the auxiliary line and the amount of liquid in the container when the liquid level line coincides with the auxiliary line are determined and can be measured or calculated in advance. Therefore, when the liquid level line is in its actual position, the amount of liquid in the container (calculated by liquid volume) is equal to the sum of the amount of liquid in the container when the liquid level line coincides with the auxiliary line and the volume between the auxiliary line and the liquid level line. Thus, the calibration of the liquid amount (including the calibration of relevant calculation parameters) and the correction of the liquid amount can be implemented based on the auxiliary line.
[0096] All the preferred and optional technical means disclosed in the present invention can be arbitrarily combined to form several different specific embodiments, unless otherwise specified or one preferred or optional technical means is a further limitation of another technical means.
Claims
1. A visual and accurate measurement method for the amount of reagent added, characterized in that A visual image including a container is obtained, and straight line detection and arc detection are performed on the visual image. The longitudinal edge of the container is determined according to the straight line detection result. The arcs corresponding to the liquid level line and the auxiliary line are determined according to the arc detection result. An ellipse fitting is performed on part or all of the arcs including the arc corresponding to the liquid level line by using the least square method. The ellipse obtained by fitting is used as the image ellipse of the corresponding liquid level line or auxiliary line. The posture of the container is determined based on any image ellipse calculation. The liquid level height is determined based on the image ellipse of the liquid level line calculation. The amount of liquid in the container is determined based on the posture and liquid level height of the container calculation.
2. The method for visually accurately measuring the amount of reagent added as claimed in claim 1, characterized in that Before implementing straight line detection and arc detection, pixel clustering analysis and / or container edge detection are performed on the visual image, and the container clustering area is identified by clustering analysis, and the container area edge is identified by container edge detection.
3. The method for visually accurately measuring the amount of reagent added as claimed in claim 2, characterized in that: In cluster analysis, the weighted pixel value and pixel distance are used as the similarity evaluation function D i,j : D i,j =α·||p i -p j ||1+(1-a)·||X i -X j ||2, Where p i and X i are the pixel value and position of point i, respectively, p j and X j are the pixel value and position of point j respectively, α is the weighting coefficient, 0<α<1, point i and point j are any two points in the visual image; The Canny operator is used to implement the container area edge detection.
4. The method for visually accurately measuring the amount of reagent added as claimed in claim 3, characterized in that The LSD algorithm is used to implement line detection in visual images.
5. The method for visually accurately measuring the amount of reagent added as claimed in claim 4, characterized in that The longest straight line detected in the straight line detection is taken as the baseline, and the second longest line parallel or nearly parallel to the baseline is extracted near the baseline. The baseline and the second longest line parallel or nearly parallel to the baseline are used as candidate boundaries of the two long sides of the container. Based on the container clustering area obtained by cluster analysis and / or the container area edge obtained by container area edge detection, as well as the container aspect ratio, the candidate boundaries of the two long sides of the container are verified. If the area between the two straight lines used as candidate boundaries is consistent with the area of the test tube clustering area and / or the two straight lines used as candidate boundaries are consistent with the positions of the two long straight sides of the container area edge, and the aspect ratio is consistent with the container aspect ratio, then it is determined that the two straight lines are the two long boundaries of the container.
6. The method for visually accurately measuring the amount of reagent added as claimed in claim 3, characterized in that The elli-LAD algorithm is used to implement arc detection in visual images.
7. The method for visually accurately measuring the amount of reagent added as claimed in claim 6, characterized in that Taking a relatively complete ellipse as the judgment standard, the arc segments closest to the complete ellipse whose number is the sum of the number of auxiliary lines, the number of liquid level lines and the number of round openings on the top of the container are selected as candidate arc segments corresponding to the auxiliary lines, the liquid level line and the round openings on the top of the container, wherein the number of auxiliary lines is one or more, the number of liquid level lines is one, and the number of round openings on the top of the container is 0 or one. The attributes of the arc segments are judged according to the length of the test tube, the position of the auxiliary lines, and the morphological similarity relationship between multiple ellipses, and it is confirmed that these arc segments belong to the arc segments corresponding to the auxiliary lines, the liquid level lines and the round openings on the top of the container, and the corresponding relationship between each arc segment and the auxiliary lines, the liquid level lines and the round openings on the top of the container is established.
8. The method for visually accurately measuring the amount of reagent added as claimed in claim 9, characterized in that When the least square method is used to fit an ellipse to an arc segment, the distance from the point to the ellipse is used as / instead of the distance from the point to the ellipse.
9. The method for visually accurately measuring the amount of reagent added as claimed in any one of claims 1 to 8, characterized in that The height of the corresponding auxiliary line under the corresponding container posture is calculated based on the image ellipse of any one or more auxiliary lines. According to the position of the corresponding auxiliary line on the container and the calculated height of the corresponding auxiliary line under the corresponding container posture, the liquid level height determined by the image ellipse based on the liquid level line is calibrated or corrected.
10. The method for visually accurately measuring the amount of reagent added as claimed in any one of claims 1 to 8, characterized in that: When the liquid surface is perpendicular to the centerline of the container, the amount of liquid in the container is calculated according to the following formula: When the liquid surface is not perpendicular to the centerline of the container, calculate the amount of liquid in the container according to the following formula: Where Q is the amount of liquid in the container, D is the inner diameter of the container, h is the calculated height of the liquid level, and φ is the inclination angle of the container.
Citation Information
Cited By
Water injection setting method and system for milliliter-level volumetric flask, electronic equipment and storage medium
CN121026279A