Test tube scale line identification method and system
Through computer vision algorithms and image processing technology based on elliptical knowledge, the test tube scale marks are automatically identified, which solves the problems of low manual operation efficiency and insufficient accuracy, and achieves efficient and accurate scale mark recognition, reducing labor costs.
Patent Information
- Application Number
- CN202411174715.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-29
AI Technical Summary
In the laboratory, the identification process of test tube scales relies on manual operations, resulting in low efficiency and large errors. Especially in batch scenarios, the labor cost is high and the accuracy is insufficient, making it easy to introduce personnel reading errors.
Using computer vision algorithms and image processing technology based on prior ellipse knowledge, the color images of the test tube are obtained for preprocessing, edge enhancement, noise reduction, corrosion and expansion processing, combined with Hough transformation and ellipse fitting technology, automatically identify and Correct the test tube scale position.
It improves the accuracy and efficiency of tick mark recognition, reduces manual intervention, enhances the reliability and anti-interference ability of recognition, and reduces labor costs.
Smart Images

Figure CN119048741A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of test tube scale line recognition, and in particular relates to a test tube scale line recognition method and system based on prior ellipse knowledge, computer vision algorithm and image processing algorithm (Hough transform, etc.). Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] With the continuous development of artificial intelligence and automation technology, intelligent machines have been widely used in the industrial field.
[0004] At present, steps such as solution separation, pipetting and volume determination are the most basic experimental operation steps for chemical and biological testing and analysis in laboratories. The accuracy of these steps directly determines the accuracy of the final experimental results. Most laboratory liquid handling operations are still performed manually or semi-automatically with manual assistance.
[0005] Image processing technology mainly includes image acquisition, compression, transmission, transformation, detection, restoration, reconstruction, segmentation, analysis, description, and recognition. Among them, analysis, description, and recognition belong to the advanced part of image processing. They have a short development time, the theory is still immature, and no universal processing method has been formed. The image processing part mainly includes filtering, edge detection, image segmentation, etc. Using image processing for instrument detection can not only avoid drawbacks, improve detection accuracy, improve detection quality, but also improve detection efficiency, which is suitable for large-scale industrial detection fields.
[0006] Commonly used glass measuring vessels are used as volume measuring instruments and are widely used in the fields of biomedicine, food hygiene, scientific research and environmental protection. The accuracy of their capacity indication is the basis and guarantee for the development of industry technology. Due to the large number, variety and different models of glass measuring vessels, the calibration steps are cumbersome and repetitive. Calibrators are required to manually load the calibration medium and observe the readings with the naked eye, which can easily cause visual fatigue and measurement errors. If the calibration personnel are different, it is easy to introduce human reading errors. This problem is particularly prominent in batch measurement scenarios.
[0007] In the process of batch test tube scale line recognition, a lot of manpower is needed, and the efficiency is low and time-consuming. As the fatigue of human vision increases, the recognition of test tube scale lines deviates more and more, causing experimental errors. Due to manual measurement, the reading of the same reagent may be different in the short term, and the repeatability is not strong enough. After the product is batched, the labor cost can be reduced. Summary of the invention
[0008] In order to overcome the above-mentioned deficiencies of the prior art, the present invention provides a test tube scale line recognition method, which solves the scale line recognition problem by using a computer vision algorithm and an image processing algorithm assisted by prior ellipse knowledge.
[0009] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:
[0010] In a first aspect, a method for identifying scale lines on a test tube is disclosed, wherein the scale lines are identified based on the fact that the scale lines are ellipses with different curvatures when observed at different angles;
[0011] By calculating the curvature of the ellipse, the positional relationship between the observation point and the ellipse is determined to determine whether the camera is aligned with the scale line;
[0012] include:
[0013] Acquire a color image of the test tube to be identified and perform preprocessing operations;
[0014] Applying a filter to perform edge enhancement on the preprocessed image to highlight the edge information of the test tube scale line;
[0015] The enhanced image is denoised using the fast non-local means denoising algorithm;
[0016] The image after noise reduction is corroded and expanded to further clarify the scale lines, so as to enhance the recognizability of the scale lines of the test tube in the image;
[0017] The straight lines in the processed image are identified by the Hough transform method. If the straight line detection is unsuccessful, it automatically switches to the ellipse fitting step;
[0018] Ellipse fitting step: Use ellipse fitting technology to determine the position of the test tube scale line to compensate for the shortcomings of straight line detection;
[0019] Outputs the identified and corrected tube graduation positions.
[0020] As a further technical solution, preprocessing includes image flipping and contrast adjustment to adapt to different lighting and test tube placement conditions.
[0021] As a further technical solution, an ellipse fitting technique is used to determine the position of the test tube scale lines. Specifically, a fitting algorithm based on the gradient direction is used to accurately simulate the curvature of the test tube to determine the position of the test tube scale lines.
[0022] As a further technical solution, a filter is applied to perform edge enhancement on the preprocessed image, including: using a Sobel filter to calculate the gradient of the image in the Y direction and converting the negative gradient into a positive number.
[0023] As a further technical solution, the image after noise reduction is corroded and expanded. The specific steps are as follows:
[0024] Read image: read an image in grayscale mode;
[0025] Define the kernel for erosion and dilation: Define a square kernel or structure element, which is used in erosion and dilation operations;
[0026] Dilation operation: dilate the image;
[0027] Erosion operation: perform an erosion operation on the expanded image;
[0028] As a further technical solution, the method further includes the step of enhancing the image after the corrosion and expansion processing: adjusting the contrast and brightness of the image to enhance the visual effect of the image.
[0029] As a further technical solution, the straight line in the processed image is identified by the Hough transform method, and if the straight line detection is unsuccessful, it automatically switches to the ellipse fitting step;
[0030] Ellipse fitting step: Use ellipse fitting technology to determine the position of the test tube scale line and the angle of the camera relative to the scale line to compensate for the shortcomings of straight line detection. The specific implementation process of the above method is as follows:
[0031] Read an enhanced image and convert it into a grayscale image. Then, apply the Canny edge detection algorithm to find the edges in the image. Next, for each contour, calculate its circumscribed rectangle and filter out contours with a width greater than the threshold (the purpose is to remove the interference noise of those small segments and only retain the curve segments of sufficient length that may be scale lines). For the filtered contour fitting ellipse, first determine that the ellipse is horizontal (horizontally for the major axis and vertically for the minor axis), and further filter out the interference line segments; then calculate the ellipse angle, and for the ellipse that is close to being parallel to the x-axis, integrate the part of the curve segment that may be the scale line, and use the general equation of the ellipse Ax^2+Bxy+Cy^2+Dx+Ey+F=0 to establish a linear equation group containing coefficients A, B, C, D, E, and F. Solving this equation group can determine the equation of the ellipse, thereby determining the ellipse, and calculating its eccentricity and curvature and other parameters. According to the comparison results of the eccentricity and curvature with the set threshold, the curve is classified as an ellipse or a straight line. If the eccentricity and curvature are less than the threshold, it is identified as an ellipse; if it is greater than the threshold, it is identified as a straight line. Finally, a series of processing is performed based on the recognition results, including marking on the image, calculating the highest and lowest points, saving difference data, etc., and saving and displaying the processed image to facilitate subsequent operations to continue to identify and align the scale lines.
[0032] By finding contours and analyzing each contour, we try to fit an ellipse, and determine whether it meets specific conditions based on the angle and eccentricity parameters of the ellipse, and compare it with the reference point of the scale line to move the camera;
[0033] Conditional judgment and operation: According to the parameters of the ellipse and the width of the circumscribed rectangle, decide whether to regard the outline as a valid ellipse or a straight line, and perform corresponding operations accordingly;
[0034] Camera movement guidance: Provide guidance on camera movement by analyzing the position and properties of ellipses in the image.
[0035] In a second aspect, a test tube scale line recognition system is disclosed, comprising:
[0036] The image acquisition and preprocessing module is configured to: acquire a color image of the test tube to be identified and perform a preprocessing operation;
[0037] The edge enhancement module is configured to: apply a filter to perform edge enhancement on the preprocessed image to highlight edge information of the test tube scale line;
[0038] The denoising module is configured to: perform denoising on the enhanced image using a fast non-local means denoising algorithm;
[0039] The erosion and expansion processing module is configured to: perform erosion and expansion processing on the image after noise reduction processing to further clarify the scale lines so as to enhance the recognizability of the scale lines of the test tube in the image;
[0040] The straight line recognition module is configured to: recognize straight lines in the processed image by using the Hough transform method, and automatically switch to the ellipse fitting step if the straight line detection is unsuccessful;
[0041] The ellipse fitting module is configured to: determine the position of the test tube scale line using the ellipse fitting technology to compensate for the deficiency of the straight line detection;
[0042] The output module is configured to output the identified and corrected test tube scale line positions.
[0043] One or more of the above technical solutions have the following beneficial effects:
[0044] The technical solution of the present invention is based on steps such as image preprocessing (such as grayscale conversion, noise removal), edge detection (such as using Sobel operator), and pattern recognition (such as Hough transform). These technologies can improve the recognition accuracy of scale lines.
[0045] The technical solution of the present invention is applied to such problems by using a method based on prior ellipse knowledge to assist computer vision algorithms, thereby further improving the accuracy and efficiency of recognition.
[0046] The technical solution of the present invention compares the highest point and the lowest point detected by the ellipse of the fitting scale line with the predefined reference points, and calculates the accuracy based on the normalized error between these points, so that the accuracy is higher.
[0047] Technical fusion of the technical solution of the present invention: the algorithm is based on prior ellipse knowledge and assisted by a variety of image processing techniques (such as Sobel edge detection, morphological operation, Hough transform), demonstrating the potential of technical fusion in the field of image analysis.
[0048] The technical solution of the present invention adopts the method of fitting ellipse to describe the test tube scale line, which increases the accuracy and anti-interference performance, and reduces the interference of the hand environment background.
[0049] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0051] Figure 1 Schematic diagram of sampling of the camera and the scale line of the test tube according to an embodiment of the present invention, (a) unaligned sample; (b) aligned sample;
[0052] Figure 2 is an image after grayscale processing according to an embodiment of the present invention;
[0053] Figure 3 The image is subjected to noise reduction processing by the Soblel filter according to the embodiment of the present invention;
[0054] Figure 4 The image is processed by the erosion and dilation algorithm according to the embodiment of the present invention;
[0055] Figure 5 This is an image recognition result diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0056] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0057] It should be noted that the terms used herein are for describing specific embodiments only and are not intended to be limiting of exemplary embodiments according to the present invention.
[0058] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0059] Embodiment 1
[0060] This embodiment discloses a test tube scale line recognition method, which recognizes the scale line based on the fact that the scale line is an ellipse with different curvatures when observed at different angles; determines the positional relationship between the observation point and the ellipse by calculating the curvature of the ellipse, and determines whether the camera is aligned with the scale line; an algorithm can be introduced to simultaneously control the recognition of multiple cameras and scale lines, which can be used to solve the problem of batch detection of commonly used glass measuring vessels; and includes:
[0061] Acquire a color image of the test tube to be identified and perform preprocessing operations;
[0062] Applying a filter to perform edge enhancement on the preprocessed image to highlight the edge information of the test tube scale line;
[0063] The enhanced image is denoised using the fast non-local means denoising algorithm;
[0064] The image after noise reduction is corroded and expanded to further clarify the scale lines, so as to enhance the recognizability of the scale lines of the test tube in the image;
[0065] The straight lines in the processed image are identified by the Hough transform method. If the straight line detection is unsuccessful, it automatically switches to the ellipse fitting step;
[0066] Ellipse fitting step: Use ellipse fitting technology to determine the position of the test tube scale line to compensate for the shortcomings of straight line detection;
[0067] Outputs the identified and corrected tube graduation positions.
[0068] In this embodiment, the camera reading replaces the naked eye reading to improve the accuracy of volumetric titration. Priori ellipse knowledge, computer vision algorithm and image processing algorithm are used to solve the problem of scale line recognition.
[0069] In this implementation example, accurate scale line recognition results can be obtained through images captured by a movable camera, thereby improving the accuracy of the scale line recognition results.
[0070] In view of the problems of heavy workload, low efficiency and easy occurrence of human fatigue errors in the manual batch measurement of commonly used glass measuring instruments, the development of an automatic detection device for commonly used glass test tube volumetric flasks based on image processing must first solve the problem of eye level between the camera and the liquid level.
[0071] In this implementation example, firstly, a mobile camera is used to take pictures of test tubes at different angles, and the accuracy of the algorithm can be tested while setting relevant parameters in the algorithm.
[0072] Image preprocessing: 1. Set the reference point when aligning the camera and the scale line 2. Read the image and flip it, convert it into a grayscale image, and stretch the contrast 3. Apply the Sobel filter to enhance the edges in the vertical direction 4. Use the non-local mean denoising method to reduce image noise
[0073] Erosion and dilation processing: 1. Perform dilation operation on the preprocessed image to highlight the features of the image 2. Then perform corrosion operation to further highlight the features 3. Perform contrast enhancement on the corroded image to enhance the key features of the image
[0074] Hough transform detection: Apply Hough transform to detect straight lines on the image contour. If a straight line is detected, it means that the camera and the scale lines are aligned; if no straight line is detected, it means that the scale lines are not aligned, and try to fit an ellipse to the contour in the image to identify the alignment of the scale lines. Compare the detected highest and lowest points with pre-defined reference points. The difference distance is calculated based on the normalized difference between these points, and the direction of camera movement is determined by whether the distance gradually decreases.
[0075] Step 1: Image preprocessing, including:
[0076] 1. Image cropping: First, the captured test tube image is converted into a grayscale image, and then the number of pixels to be cropped is calculated, based on the total number of rows and columns of the image multiplied by a percentage (here 10%), and then the image is cropped according to this calculation result. This process can effectively remove parts of the edge of the image and may help remove unnecessary borders or noise.
[0077] 2. Normalization operation: Through normalization, the pixel values of the image are scaled to a specific range (in this case, 0 to 150). This step is usually used to improve the contrast between different images, making subsequent image processing steps more stable.
[0078] 3. Sobel filter: Sobel filter is used to calculate the gradient of the image in the Y direction, which is very useful for detecting vertical edges in the image. In addition, negative gradients are converted to positive numbers, which can keep the positivity of all gradient values for subsequent processing.
[0079] 4. Non-local mean denoising: Finally, the non-local mean denoising algorithm is used to reduce the noise of the image. This method can preserve the details of the image better than traditional local denoising algorithms (such as Gaussian blur), and is particularly suitable for removing random noise in images.
[0080] Step 2: Image processing operation: mainly using dilation and corrosion methods:
[0081] 1. Read the image: First, use the cv2.imread function to read an image in grayscale mode. Grayscale mode means that each pixel has only one intensity value, which is easier to process than color images.
[0082] 2. Define the kernel for erosion and dilation: Next, a square kernel (or structural element) is defined, which is used in the erosion and dilation operations. The size of the kernel (here 4x4) affects the effect of these operations, specifically the intensity of the operation.
[0083] 3. Dilation operation: Use the cv2.dilate function to dilate the image, which usually increases the area of white areas in the image and reduces the black areas. Dilation can be used to fill small holes inside objects or connect close objects.
[0084] 4. Erosion operation: Next, use the cv2.erode function to perform an erosion operation on the dilated image, which will reduce the area of the white area in the image and increase the black area. Erosion can be used to eliminate small white noise, separate objects that are too close, etc.
[0085] 5. Enhance the processed image: Use the cv2.convertScaleAbs function to adjust the contrast and brightness of the image to enhance the visual effect of the image. The alpha parameter is used to adjust the contrast, while the beta parameter is used to adjust the brightness.
[0086] 6. Display and save the image: Finally, save the processing results for subsequent viewing or analysis.
[0087] Step 3: For each contour, calculate its circumscribed rectangle and filter out contours with a width greater than the threshold (the purpose is to remove the interference noise of those small segments and only retain the curve segments of sufficient length that may be identified as scale lines). For the contour fitting ellipse after screening, first determine that the ellipse is horizontal (horizontally for the major axis and vertically for the minor axis), and further filter out the interfering line segments; then calculate the ellipse angle, and for the ellipse that is approximately parallel to the x-axis, integrate the curve segments that may be scale lines together, and use the general equation of the ellipse Ax^2+Bxy+Cy^2+Dx+Ey+F=0 to establish a linear equation group containing coefficients A, B, C, D, E, and F. Solving this equation group can determine the equation of the ellipse, thereby determining the ellipse, and calculating its eccentricity and curvature and other parameters. According to the comparison results of the eccentricity and curvature with the set threshold, the curve is classified as an ellipse or a straight line. If the eccentricity and curvature are less than the threshold, it is identified as an ellipse; if it is greater than the threshold, it is identified as a straight line. Finally, a series of processing is performed based on the recognition results, including marking on the image, calculating the highest and lowest points, saving difference data, etc., and the processed image is saved and displayed to facilitate subsequent operations to continue to identify and align the scale lines:
[0088] The camera is guided to move by identifying ellipses or lines in the image to achieve a certain alignment target. This process involves multiple steps such as reading and saving files, image reading and processing, contour finding, ellipse fitting, eccentricity calculation, condition judgment, and drawing text and shapes on the image.
[0089] 1. File reading and writing: The code starts by opening the save_diff.txt file to read and write data. The w+ mode is used here, which means that if the file does not exist, it will be created and read and write operations are allowed. However, since it is written and then read immediately, it may not work as expected because the file is not closed and reopened for reading after writing.
[0090] 2. Image processing: The code reads a preprocessed image and converts it to grayscale, then applies the Canny edge detection algorithm to find the edges in the image. Then, it tries to fit an ellipse by finding contours and analyzing each contour, and determines whether it meets certain conditions based on parameters such as the angle and eccentricity of the ellipse.
[0091] 3. Conditional judgment and operation: Based on the parameters of the ellipse (such as eccentricity) and the width of the circumscribed rectangle and other conditions, the code decides whether to regard the outline as a valid ellipse or straight line, and performs corresponding operations accordingly, such as drawing an ellipse or straight line, outputting prompt information, etc.
[0092] 4. Camera movement guidance: By analyzing the position and properties of the ellipse in the image, the code attempts to give guidance on camera movement. For example, by comparing the difference between the current ellipse and the previously saved value, the camera can be judged in which direction to move.
[0093] In the above implementation, the ellipse fitting step further includes using a fitting algorithm based on the gradient direction to accurately simulate the curvature of the test tube, thereby improving the recognition accuracy of the scale line position.
[0094] The specific implementation includes: manually building the experimental environment and manually locking the camera position, and manually preliminarily determining whether the camera is level with the test tube scale line. Figure 1 shown.
[0095] Data preprocessing: first convert the captured photos into grayscale images, and then perform subsequent processing; see Appendix Figure 2 shown.
[0096] Noise reduction: Noise reduction is performed using the Soblel filter; see Appendix Figure 3 shown.
[0097] Corrosion and dilation operation: Use the corrosion and dilation algorithm to perform image enhancement and further image processing and optimization; see Appendix Figure 4 shown.
[0098] Image recognition results and evaluation are shown in the attached Figure 5 shown.
[0099] Embodiment 2
[0100] The purpose of this embodiment is to provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.
[0101] Embodiment 3
[0102] The purpose of this embodiment is to provide a computer-readable storage medium.
[0103] A computer-readable storage medium stores a computer program, which executes the steps of the above method when executed by a processor.
[0104] Embodiment 4
[0105] The purpose of this embodiment is to provide a test tube scale line recognition system, comprising:
[0106] The image acquisition and preprocessing module is configured to: acquire a color image of the test tube to be identified and perform a preprocessing operation;
[0107] The edge enhancement module is configured to: apply a filter to perform edge enhancement on the preprocessed image to highlight edge information of the test tube scale line;
[0108] The denoising module is configured to: perform denoising on the enhanced image using a fast non-local means denoising algorithm;
[0109] The erosion and expansion processing module is configured to: perform erosion and expansion processing on the image after noise reduction processing to further clarify the scale lines so as to enhance the recognizability of the scale lines of the test tube in the image;
[0110] The straight line recognition module is configured to: recognize straight lines in the processed image by using the Hough transform method, and automatically switch to the ellipse fitting step if the straight line detection is unsuccessful;
[0111] The ellipse fitting module is configured to: determine the position of the test tube scale line using the ellipse fitting technology to compensate for the deficiency of the straight line detection;
[0112] The output module is configured to output the identified and corrected test tube scale line positions.
[0113] Embodiment 5
[0114] The purpose of this embodiment is to provide a computer program product containing instructions, which, when running on a computer, enables the computer to execute the methods and functions involved in any of the above embodiments.
[0115] The steps involved in the apparatus of the above embodiment correspond to the method embodiment 1, and the specific implementation method can refer to the relevant description part of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.
[0116] Those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computer device, or alternatively, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.
[0117] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A method for identifying test tube scale lines, characterized in that: include: Acquire a color image of the test tube to be identified and perform preprocessing operations; Applying a filter to perform edge enhancement on the preprocessed image to highlight the edge information of the test tube scale line; The enhanced image is denoised using the fast non-local means denoising algorithm; The image after noise reduction is corroded and expanded to further clarify the scale lines, so as to enhance the recognizability of the scale lines of the test tube in the image; The straight lines in the processed image are identified by the Hough transform method. If the straight line detection is unsuccessful, it automatically switches to the ellipse fitting step; Ellipse fitting step: Use ellipse fitting technology to determine the position of the test tube scale line to compensate for the shortcomings of straight line detection; Outputs the identified and corrected tube graduation positions.
2. A test tube scale line recognition method as claimed in claim 1, characterized in that: Preprocessing included image flipping and contrast adjustment to accommodate different lighting and cuvette placement conditions.
3. A test tube scale line recognition method as claimed in claim 1, characterized in that: The positions of the test tube scale lines are determined using an ellipse fitting technique, specifically using a fitting algorithm based on the gradient direction to accurately simulate the curvature of the test tube and determine the positions of the test tube scale lines.
4. A test tube scale line recognition method as claimed in claim 1, characterized in that: Applying filters to perform edge enhancement on the preprocessed image includes: using a Sobel filter to calculate the gradient of the image in the Y direction and converting negative gradients into positive numbers.
5. A test tube scale line recognition method as claimed in claim 1, characterized in that: The denoised image is corroded and expanded. The specific steps are as follows: Read image: read an image in grayscale mode; Define the kernel for erosion and dilation: Define a square kernel or structure element, which is used in erosion and dilation operations; Dilation operation: dilate the image; Erosion operation: Perform an erosion operation on the expanded image.
6. A test tube scale line recognition method as claimed in claim 1, characterized in that: The method also includes the step of enhancing the image after the corrosion and expansion processing: adjusting the contrast and brightness of the image to enhance the visual effect of the image.
7. A test tube scale line recognition method as claimed in claim 1, characterized in that: The straight lines in the processed image are identified by the Hough transform method. If the straight line detection is unsuccessful, it automatically switches to the ellipse fitting step; Ellipse fitting step: Use ellipse fitting technology to determine the position of the test tube scale line to compensate for the shortcomings of straight line detection. The specific implementation process of the above method is as follows: Read an enhanced image and convert it to grayscale. Then, apply the Canny edge detection algorithm to find the edges in the image. Next, try to fit an ellipse by finding contours and analyzing each contour. Then, determine whether it meets certain conditions based on the angle and eccentricity parameters of the ellipse. Conditional judgment and operation: According to the parameters of the ellipse and the width of the circumscribed rectangle, decide whether to regard the outline as a valid ellipse or a straight line, and perform corresponding operations accordingly; Camera movement guidance: Provide guidance on camera movement by analyzing the position and properties of ellipses in the image.
8. A test tube scale line recognition system, characterized in that: include: The image acquisition and preprocessing module is configured to: acquire a color image of the test tube to be identified and perform a preprocessing operation; The edge enhancement module is configured to: apply a filter to perform edge enhancement on the preprocessed image to highlight edge information of the test tube scale line; The denoising module is configured to: perform denoising on the enhanced image using a fast non-local means denoising algorithm; The erosion and expansion processing module is configured to: perform erosion and expansion processing on the image after noise reduction processing to further clarify the scale lines so as to enhance the recognizability of the scale lines of the test tube in the image; The straight line recognition module is configured to: recognize straight lines in the processed image by using the Hough transform method, and automatically switch to the ellipse fitting step if the straight line detection is unsuccessful; The ellipse fitting module is configured to: determine the position of the test tube scale line using the ellipse fitting technology to compensate for the deficiency of the straight line detection; The output module is configured to output the identified and corrected test tube scale line positions.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are performed.
Citation Information
Patent Citations
Fast recognition method for measuring instrument scale lines
CN103559484A
Automatic scale value reading device for glass floating meter verification
CN111595724A
Pointer instrument degree identification method based on coordinate transformation
CN114005108A
Device, method and equipment for measuring field angle of camera and medium
CN117061842A
Measuring plate and device and method for measuring wheel alignment
JP1998002726A
