An automatic reading method for glass liquid thermometer based on image processing technology

Through image processing technology, the glass liquid thermometer is subjected to inclination correction and scale ratio calculation, which solves the problems of low manual reading efficiency and large error, and realizes automated and accurate thermometer readings.

CN114926625BActive Publication Date: 2025-08-15CHINA JILIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210554324.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2025-08-15
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

The existing glass liquid thermometer reading method relies on manual operation, resulting in large workload, low efficiency and large errors, making it difficult to meet the needs of modern intelligent measurement.

Method used

Image processing technology is used to correct the tilt of the glass liquid thermometer image, extract the cutoff point of the temperature-sensitive liquid column and its two adjacent scale lines, and calculate the reading using its proportional relationship and the index value of the thermometer, avoiding the separate extraction and length calculation of the temperature-sensitive liquid column.

Benefits of technology

Improve reading efficiency and accuracy, reduce the complexity of image processing, and achieve efficient and accurate automated readings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114926625B_ABST
    Figure CN114926625B_ABST
Patent Text Reader

Abstract

The present invention discloses an automatic reading method for a liquid-in-glass thermometer based on image processing technology, comprising the following steps: performing image binarization processing on the original image; calculating the lengths of the long and short scale lines; straightening a sub-image of the region of interest based on the inclination angle of a straight line fitted from the center coordinates of the short scale line; obtaining a sub-image of the scale line region, determining the center of each scale line and the cutoff point of the temperature-sensing liquid column, and determining the two scale lines closest to the cutoff point; obtaining a sub-image of the scale value region, identifying the leftmost scale value, and finding the corresponding main scale line; and calculating the final reading of the liquid-in-glass thermometer based on the positional relationship between the thermometer's graduation value, the cutoff point of the temperature-sensing liquid column, and each scale line. This method improves reading accuracy and solves the problem of manual reading being time-consuming, labor-intensive, and inefficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a glass liquid thermometer reading method, in particular to an automatic glass liquid thermometer reading method based on image processing technology in the field of computer vision. Background Art

[0002] Against the backdrop of today's scientific and technological advancements, modern testing technology is also constantly evolving. As an indispensable temperature measurement tool in today's testing technology landscape, liquid-in-glass thermometers are widely used in various fields, including the shipbuilding industry, mechanical processing, and petrochemicals. Their demand and usage are enormous. However, while liquid-in-glass thermometers offer convenience, their inherent calibration cycle presents numerous challenges for relevant calibration departments. This large number of units increases the workload for calibration personnel, and the detection method relies on manual reading of the thermometer, which can lead to fatigue, low efficiency, and large reading errors.

[0003] Today, the world demands more intelligent measurement methods, reducing human intervention and improving automation and efficiency. Using machine vision technology to identify readings from liquid-in-glass thermometers has become mainstream. For example, Xiang Yi et al. from Chongqing University of Science and Technology performed a Hough transform on thermometer images to extract the characteristic information of the thermometer's scale lines and mercury column. Based on the positional relationship between the scale lines, they determined the temperature corresponding to each pixel, calculated the length of the mercury column, and ultimately calculated the thermometer reading. Li Ning et al. from Guangdong University of Technology first calculated the temperature represented by each pixel along the mercury column in the collected mercury thermometer image, namely the temperature calibration value. Then, through image processing, they obtained the length of the mercury column in the image, multiplied it by the temperature calibration value, and added the starting temperature to obtain the actual temperature reading of the thermometer. Hao Zhenghui et al. from North University of China first extracted the mercury thermometer's temperature-sensing liquid column from the thermometer image. They then used the image pixel and temperature difference between two scale lines to calculate the corresponding temperature scaling coefficient. Finally, they calculated the thermometer reading based on the position of the temperature-sensing liquid column, the position of the scale lines, and the temperature scaling coefficient.

[0004] Current research on using machine vision technology to identify glass liquid thermometer readings shows that most methods require separating the thermometer's temperature-sensing liquid column from the background image, and ultimately obtaining the thermometer's reading value through the temperature value corresponding to a single pixel in the image and the length of the temperature-sensing liquid column. Summary of the Invention

[0005] In view of the shortcomings of the background technology, the purpose of the present invention is to provide an automatic reading method for a glass liquid thermometer based on image processing technology. By performing tilt correction on the glass liquid thermometer image, the cutoff point of the temperature-sensitive liquid column and its two nearest scale lines are extracted, and the thermometer reading is calculated according to the proportional relationship between the cutoff point of the temperature-sensitive liquid column and its two nearest scale lines, the thermometer graduation value, and the first main scale value in the thermometer image.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] Follow the steps below to implement:

[0008] Step 1: perform image binarization on the original image;

[0009] Step 2: Obtain some thermometer scale lines and calculate the length of the long scale line and the length of the short scale line;

[0010] Step 3: Obtain the center coordinates of the short scale lines and calculate the inclination angle of the straight line fitted by the center coordinates of the short scale lines;

[0011] Step 4: Get the sub-image of the region of interest and perform straightening processing;

[0012] Step 5: Get the scale line area sub-image and the scale value area sub-image;

[0013] Step 6: Obtain the central abscissa of each scale line and the abscissa of the temperature-sensing liquid column cutoff point in the scale line region sub-image, and determine the two scale lines closest to the cutoff point.

[0014] Step 7: Perform character recognition on the leftmost scale value in the scale value area sub-image, and find the main scale line closest to the horizontal coordinate of the center of the scale value area;

[0015] Step 8: Calculate the final reading of the glass liquid thermometer based on the thermometer's graduation value, the cutoff point of the temperature-sensing liquid column, and the positional relationship between each scale line.

[0016] The beneficial effects of the present invention are:

[0017] 1. The present invention uses the center of the short scale line of the thermometer to perform least squares linear fitting to obtain the tilt angle of the thermometer, and performs tilt correction on the thermometer image without requiring the computationally intensive Hough transform to calculate the tilt angle, thereby improving the speed of image processing and reading efficiency.

[0018] 2. The present invention utilizes the proportional relationship between the extracted cutoff point of the temperature-sensitive liquid column and its two nearest scale lines, the serial number difference between the nearest left scale line of the cutoff point of the temperature-sensitive liquid column and the first main scale line in the thermometer image, the first scale value in the thermometer image, and the graduation value of the thermometer to calculate the thermometer reading. There is no need to extract the temperature-sensitive liquid column separately, nor to calculate the length of the entire temperature-sensitive liquid column, and even more no need to obtain a temperature calibration value, thereby improving the reading accuracy of the thermometer.

[0019] 3. The present invention only needs to identify the first scale value in the thermometer image without identifying the scale value near the cutoff point of the temperature-sensitive liquid column, which reduces the complexity of the image processing algorithm and improves the reading efficiency of the thermometer. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is an overall flow chart of the automatic reading of the glass liquid thermometer of the present invention.

[0021] Figure 2 This is an original image of the glass liquid thermometer to be read according to the present invention.

[0022] Figure 3 This is the preprocessed binary image of the glass liquid thermometer of the present invention.

[0023] Figure 4 It is the center mark image of some short scale lines of the present invention.

[0024] Figure 5 It is the thermometer region of interest image of the present invention.

[0025] Figure 6 This is the image of the thermometer region of interest after being straightened according to the present invention.

[0026] Figure 7 It is the scale line area sub-image of the present invention.

[0027] Figure 8 It is the scale value area sub-image of the present invention.

[0028] Figure 9 It is the center mark image of all scale lines of the present invention.

[0029] Figure 10 It is a schematic diagram of the horizontal position of the cutoff point of the temperature-sensitive liquid column of the present invention and its nearest left and right scale lines.

[0030] Figure 11 It is a schematic diagram of the scale value at the far left end and the corresponding main scale line of the present invention.

[0031] Figure 12 It is the image of the automatic reading result of the thermometer of the present invention. DETAILED DESCRIPTION

[0032] The present invention will be further described below with reference to the accompanying drawings and specific implementation methods (examples), but they are not intended to limit the present invention.

[0033] like Figure 1 As shown, the steps of the method of the present invention are:

[0034] Step 1: Perform image binarization on the original image.

[0035] Read as Figure 2 The original image src of the glass liquid thermometer to be read is binarized using a fixed threshold determined experimentally to obtain a binarized image bw.

[0036] Step 2: Obtain some thermometer scale lines and calculate the length of the long scale line and the length of the short scale line.

[0037] Perform contour detection on the binary image bw and calculate each contour C i The height H of the minimum bounding rectangle i and contour C i Height H i and width W i The ratio of height to width R i , i=1,2,3,…,n1, n1 is the number of contours in the binary image bw. i The minimum bounding rectangle height H i Greater than the threshold H low And the aspect ratio R of the profile i Greater than R low When the contour C i The area corresponding to the binary image bw is the scale line, and the contour C i The minimum bounding rectangle height H i Then it is the length L of the scale line corresponding to the contour i , H low and R low Through experiments, it is found that H low =20 and R low = 10. Since some scale lines are connected to the temperature-sensing liquid column of the thermometer, they cannot be determined as scale lines according to the above scale line determination rules. Therefore, after all contours are determined, only partial scale lines can be obtained. The obtained partial scale lines are sorted in descending order by length, and the length of the first scale line in the descending order is taken as the length of the long scale line L long , take the average length of the last p% of the scale lines after the total number of scale lines in descending order as the length of the short scale line L short , p ranges from 50 to 70.

[0038] Step 3: Obtain the center coordinates of the short scale lines and calculate the inclination angle of the straight line fitted by the center coordinates of the short scale lines.

[0039] From the scale lines obtained in step 2, the values of the selected scale lines are in the interval [L short -th1,L short The scale lines within the range of [th1] are determined as short scale lines and the center coordinates of the short scale lines are obtained, where th1 is determined according to experiments. In this embodiment, th1 = 3. After all scale lines are determined, the short scale lines and their centers are obtained, such as Figure 4 The least square method is used to perform linear fitting on the central coordinates of each short scale line to obtain a fitting straight line, and the linear inclination angle θ of the fitting straight line is calculated.

[0040] Step 4: Get the sub-image of the region of interest and perform straightening processing.

[0041] In such Figure 3 Find the non-zero area in the binary image bw shown, and construct the minimum vertical boundary rectangle bRect of this non-zero area. Cut out the image within the bounding rectangle bRect from the binary image bw to obtain the thermometer region of interest image roiImg, as shown in Figure 5 As shown. The linear inclination angle θ calculated in step 3 is used to rotate and straighten the region of interest sub-image roiImg to obtain the straightened thermometer region of interest image rotImg, as shown Figure 6 shown.

[0042] Step 5: Get the scale line area sub-image and the scale value area sub-image.

[0043] Perform contour detection in the rectified thermometer region of interest image rotImg and calculate each contour CC j The height h of the minimum bounding rectangle of the vertical boundary j and Contour CC j The height h of the minimum bounding rectangle of the vertical boundary j and width w j The ratio of height to width is r j ,j=1,2,3,…,n2,n2 is the number of contours in the image rotImg. j The aspect ratio r of the minimum bounding rectangle of the vertical boundary j Greater than r low And height h j In the interval [L long -th2,L long +th2], then the contour CC is determined j The area corresponding to the image rotImg is a long scale line; when the contour CC jThe aspect ratio r of the minimum bounding rectangle of the vertical boundary j Greater than r low And height h j In the interval [L short -th2,L short +th2], then the contour CC is determined j The area corresponding to the image rotImg is a short scale line, where th2 is determined by experiment, r low The value is the same as R in step 2 low The same value, L long and L short The lengths of the long and short scale lines obtained in step 2, in this embodiment, th2 = 5, r low = 10. After all the contours in the image rotImg are determined, the vertical coordinate mean of the upper left corner endpoint of the minimum circumscribed rectangle of the long scale line contour is obtained. long and the upper left corner endpoint ordinate mean ybot long And the vertical boundary of the short scale line outline, the minimum circumscribed rectangle, the upper left corner endpoint, the ordinate mean ytop short and the upper left corner endpoint ordinate mean ybot short In the image rotImg, the vertical coordinate range is [ytop long ,ybot long The part of ] is intercepted as the scale line area sub-image slImg containing the scale line and the temperature-sensitive liquid column, as shown in FIG. Figure 7 As shown; the vertical coordinate is greater than ybot long The part of is cut off as the scale value area sub-image svImg containing only the scale value, such as Figure 8 shown.

[0044] Step 6: Obtain the central abscissa of each scale line and the abscissa of the right endpoint of the temperature-sensing liquid column in the scale line region sub-image, and determine the two scale lines on the left and right that are closest to this endpoint.

[0045] In such Figure 7 In the scale line region sub-image slImg shown, the number of non-zero pixels in each column of the image is counted from left to right and stored in an array with a length equal to the number of columns of the scale line region sub-image slImg. The values of each array element are searched in ascending order of the array element index number. If the array element value is greater than the short scale line length L short The index number of this array element is the left horizontal coordinate of the first scale line, and the search continues until the array element value is less than the short scale line length L. shorIf the value is half of the value of the array element, the index number corresponding to the previous element of this array element is the right coordinate of the first scale line. The average of the left horizontal coordinate of the first scale line and the right horizontal coordinate of the first scale line is obtained to obtain the center horizontal coordinate of the first scale line. The method of obtaining the center horizontal coordinate of the first scale line is used to search backward until all elements of the array are traversed. The center horizontal coordinates of all scale lines arranged in order from left to right are obtained. The center positions of all scale lines marked in the scale line area sub-image slImg are as follows: Figure 9 shown.

[0046] Count the number of non-zero pixels in each column of the scale line region sub-image slImg from left to right and store them in an array with a length equal to the number of columns of the scale line region sub-image slImg. The subscript of the array element when the value of the array element changes from non-zero to 0 is the abscissa of the temperature-sensitive liquid column cutoff point. The abscissa of the scale lines is compared with the abscissa of the right end point of the temperature-sensitive liquid column to obtain the scale lines line1 and line2 on the left and right sides of the temperature-sensitive liquid column cutoff point. The position of the temperature-sensitive liquid column cutoff point and its nearest left and right scale lines are shown as follows: Figure 10 shown.

[0047] Step 7: Perform character recognition on the leftmost scale value in the scale value area sub-image, and find the main scale line closest to the horizontal coordinate of the center of the scale value area.

[0048] Perform contour detection on the scale value area sub-image svImg to obtain the scale value character contour. Find the center of the circumscribed rectangle of each character contour, merge the contours with smaller center horizontal coordinate differences, and then find the center of the circumscribed rectangle of the merged contour. In this embodiment, the contours with center horizontal coordinate differences less than 200 pixels are merged. Arrange the center horizontal coordinates of the circumscribed rectangles of all contours after contour merging in ascending order, and the circumscribed rectangular area of the contour with the smallest circumscribed rectangle horizontal coordinate is the scale value area at the far left. Identify the numbers in the scale value area at the far left. Compare the center horizontal coordinate of the scale value area at the far left with the center horizontal coordinate of each scale line obtained in step 6 one by one, and the scale line with the smallest difference is the main scale line line0 closest to the scale value area at the far left. The leftmost scale value marked with a rectangle and its corresponding main scale line are shown as follows. Figure 11 The support vector machine is used to identify the digits of the scale value at the far left, and the scale value sv is obtained by calculation using the decimal weighted method.

[0049] Step 8: Calculate the final reading of the glass liquid thermometer based on the thermometer's graduation value, the cutoff point of the temperature-sensing liquid column, and the positional relationship between each scale line.

[0050] First, calculate the difference in arrangement order tip between the left scale line line 1 closest to the cutoff point of the temperature-sensing liquid column in step 6 and the main scale line line 0 corresponding to the leftmost scale value sv identified in step 8 in the scale line area sub-image slImg. Then, calculate the ratio tdp of the difference between the horizontal coordinates of the cutoff point of the temperature-sensing liquid column and its nearest left scale line line 1 to the difference between the horizontal coordinates of the two scale lines line 2 and line 1 closest to the cutoff point of the temperature-sensing liquid column. The final reading t of the glass liquid thermometer can be calculated using the following formula:

[0051] t=sv+dv×(tip+tdp)

[0052] Where dv is the graduation value of the glass liquid thermometer.

[0053] The result image obtained by marking the calculation result t in the upper left corner of the original image is as follows Figure 12 shown.

[0054] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for automatically reading a liquid-in-glass thermometer based on image processing technology, characterized in that: Processing the collected image containing the scale lines, temperature-sensing liquid column and scale values of the glass liquid thermometer includes the following steps: Step 1: perform image binarization on the original image; Step 2: Obtain some thermometer scale lines and calculate the length of the long scale line and the length of the short scale line; Step 3: Obtain the center coordinates of the short scale lines and calculate the inclination angle of the straight line fitted by the center coordinates of the short scale lines; Step 4: Get the sub-image of the region of interest and perform straightening processing; Step 5: Get the scale line area sub-image and the scale value area sub-image; Step 6: Obtain the central abscissa of each scale line and the abscissa of the temperature-sensing liquid column cutoff point in the scale line region sub-image, and determine the two scale lines closest to the cutoff point. Step 7: Perform character recognition on the leftmost scale value in the scale value area sub-image, and find the main scale line closest to the horizontal coordinate of the center of the scale value area; Step 8: Calculate the final reading of the glass liquid thermometer based on the thermometer's graduation value, the cutoff point of the temperature-sensing liquid column, and the positional relationship between each scale line; The step 2 specifically comprises: 1) performing contour detection in the binarized image; 2) selecting scale lines based on the geometric features of the minimum circumscribed rectangle of each contour, and sorting the scale lines in descending order according to their lengths; 3) determining the length of the first scale line among the scale lines sorted in descending order as the length of the long scale line, and determining the average length of the last p% of the scale lines in the total number of scale lines sorted in descending order as the length of the short scale line, where p is between 50 and 70; In step 3, the least square method is used to perform linear fitting on the center coordinates of the short scale lines to obtain a fitted straight line; The method for obtaining the scale line region sub-image and the scale value region sub-image in step 5 is as follows: intercepting the image between the upper and lower endpoints of the long scale line in the rectified image of the region of interest to obtain the scale line region sub-image; intercepting the image below the lower endpoint of the long scale line in the rectified image of the region of interest to obtain the scale value region sub-image; The method for obtaining the central horizontal coordinate of each scale line in step 6 is specifically as follows: counting the number of non-zero pixels in each column of the scale line area sub-image in order from left to right and storing the counted numbers in an array having a length equal to the number of columns of the scale line area sub-image, searching the values of each array element in order from small to large according to the array element index number, if the array element value is greater than half of the length of the short scale line, then the index number of this array element is the left horizontal coordinate of the first scale line, and continuing to search backward until the array element value is less than half of the length of the short scale line, then the index number corresponding to the previous element of this array element is the right coordinate of the first scale line, obtaining the average of the left horizontal coordinate of the first scale line and the right horizontal coordinate of the first scale line to obtain the central horizontal coordinate of the first scale line; searching backward in sequence according to the method for obtaining the central horizontal coordinate of the first scale line until all elements of the array are traversed, and obtaining the central horizontal coordinates of all scale lines arranged in order from left to right; The method for determining the abscissa of the cutoff point of the temperature-sensitive liquid column in step 6 is as follows: the number of non-zero pixels in each column of the scale line region sub-image is counted from left to right and stored in an array having a length equal to the number of columns of the scale line region sub-image; the subscript of the array element when the array element value changes from non-zero to 0 is the abscissa of the cutoff point of the temperature-sensitive liquid column; The step 7 specifically includes the following steps: 71) performing contour detection in the scale value area sub-image to obtain the scale value character contour; 72) obtaining the center of the circumscribed rectangle of each character contour, merging contours whose center horizontal coordinate difference is less than 200 pixels, and then obtaining the center of the circumscribed rectangle of the merged contour; 73) arranging the horizontal coordinates of the centers of the circumscribed rectangles of all the contours after the contours are merged in ascending order, and the circumscribed rectangle area of the contour with the smallest horizontal coordinate is the scale value area at the leftmost end; 74) identifying the numbers in the scale value area at the leftmost end; 75) comparing the horizontal coordinate of the center of the scale value area at the leftmost end with the horizontal coordinate of the center of each scale line obtained in step 6 one by one, and the scale line with the smallest difference is the main scale line closest to the scale value area at the leftmost end; In step 74), a support vector machine is used to identify each digit of the scale value at the leftmost end, and a decimal weighted method is used to calculate the scale value; The final reading t of the glass liquid thermometer in step 8 can be calculated by the following formula: t=sv+dv×(tip+tdp) Where sv is the leftmost scale value; dv is the thermometer graduation value; tip is the position difference between the left scale line line1 closest to the cutoff point of the temperature-sensing liquid column and the scale line line0 corresponding to the leftmost scale value sv; tdp is the ratio of the temperature-sensing liquid column length between the two nearest scale lines line1 and line2 where the cutoff point of the temperature-sensing liquid column is located to the distance between these two scale lines.

Citation Information

Patent Citations

  • Multi-graduation line level tube air bubble centering error visual measurement method

    CN109900302A

  • Level bubble turning cavity defect detection method based on image processing

    CN111862055A