A method for recognizing pointer meter readings with non-uniform scale

By using a pointer meter reading identification method with non-uniform scale, the problem of high workload and low efficiency of closing current pointer meters in power distribution room inspections has been solved. This method enables automated reading and real-time data acquisition, improving the accuracy and efficiency of readings.

CN115205863BActive Publication Date: 2025-12-02GUANGDONG KEYSTAR INTELLIGENCE ROBOT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210689899.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-17
Publication Date
2025-12-02
Estimated Expiration
2042-06-17

AI Technical Summary

Technical Problem

The existing closing current pointer meter is labor-intensive, inefficient, and poses safety hazards during power distribution room inspections, and cannot achieve automated reading and real-time data acquisition.

Method used

A non-uniform scale pointer meter reading identification method is adopted. By locating the small pointer meter in the closing current pointer meter, the small pointer meter is cut out, and the pointer mechanism and unit letters are detected. The pointer straight line is located using the region growing algorithm and least squares fitting. The coarse scale line is located by combining the circle radius method and the region growing algorithm. The accuracy of the number of coarse scale lines is judged. In the case of missed detection, the missed coarse scale line is adaptively located by adjusting the circle radius value.

Benefits of technology

It improves the accuracy and efficiency of pointer meter readings, ensures the stability and accuracy of coarse scale positioning, avoids the influence of fine scale on readings, and realizes automated reading and real-time data acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115205863B_ABST
    Figure CN115205863B_ABST
Patent Text Reader

Abstract

This invention provides a method for identifying pointer meter readings with non-uniform scales, including the following steps: S1, locating the small pointer meter in the closing current pointer meter; S2, cutting out the small pointer meter; S3, detecting the pointer mechanism and unit letters on the small pointer meter; S4, locating the pointer using a region growing algorithm and fitting the pointer line of the small pointer meter using least squares; S5, locating the coarse scale lines of the small pointer meter; S6, judging the accuracy of the number of coarse scale lines; S7, locating any missed coarse scale lines; S8, sorting the positions of the coarse scale lines and the pointer line; S9, calculating the Euclidean distance pLdist between the starting coordinates pL_start of the pointer line on the pointer mask image and the right vertex of the pointer mask image; S10, calculating the reading of the small pointer meter based on the Euclidean distance pLdist. This invention has high accuracy, high efficiency, and wide applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of reading methods for ammeter pointers, and more particularly to a method for identifying readings of pointers pointers with non-uniform scales. Background Technology

[0002] Pointer-type meters, due to their simple structure, stability, reliability, low cost, and lack of power supply requirements, are still widely used in industrial engineering and power sectors for equipment monitoring and surveillance. However, since most pointer-type meters lack built-in digital communication interfaces, the traditional manual inspection, meter reading, and recording methods are no longer suitable for factory management and production efficiency requirements, nor can they import data into computers for storage and processing in real time. With the development of automation and informatization, automatic reading technology for pointer-type meters has also evolved.

[0003] Existing closing current pointer meters are widely used in power grid distribution rooms and switching stations due to their advantages such as safety, reliability, low price, easy maintenance, and strong resistance to external interference. A closing current meter consists of three small rectangular pointer meters, which can visually display the magnitude of the load current in the corresponding electrical cabinet.

[0004] However, the aforementioned closing current pointer meter has problems such as large workload, low efficiency and safety in power distribution room inspections. Summary of the Invention

[0005] To address the shortcomings of the aforementioned related technologies, this invention proposes a method for recognizing pointer meter readings with non-uniform scales that is highly accurate, efficient, and easy to use.

[0006] To address the aforementioned technical problems, embodiments of the present invention provide a method for recognizing pointer meter readings with non-uniform scales, comprising the following steps:

[0007] S1, the small pointer in the positioning and closing current pointer table;

[0008] S2. Cut out the small pointer table from the image of the closing current pointer table;

[0009] S3. Detect the pointer mechanism and unit letters on the small pointer watch;

[0010] S4. Locate the pointer using the region growing algorithm and fit the pointer line of the small pointer table using least squares.

[0011] S5. Locate the coarse scale line of the small pointer table using the radius method and the region growing algorithm;

[0012] S6. Determine the accuracy of the number of coarse scale lines;

[0013] S61. If two or more coarse scale lines are missed or multiple coarse scale lines are missed, change the circle radius value and return to step S5.

[0014] S62. If less than two of the aforementioned coarse graduation lines are missed, proceed to the next step S7.

[0015] S7. Locate the missing coarse graduation line;

[0016] S8. Sort the positions of the coarse scale lines and the pointer line;

[0017] S9. Calculate the Euclidean distance pLdist between the starting coordinate pL_start of the pointer line on the pointer mask image and the vertex pLdist of the pointer mask image;

[0018] S10. Calculate the reading of the small pointer meter based on the Euclidean distance pLdist.

[0019] Preferably, step S4 specifically includes the following steps:

[0020] S41. Binarize the image of the small pointer table to obtain a binary image;

[0021] S42. Filter out interfering pixels in the binarized image;

[0022] S43. In the region where the pointer is located;

[0023] S44. Fit the pointer line using least squares.

[0024] Preferably, step S5 specifically includes the following steps:

[0025] S51. Calculate the radius of the circle; take N times the Euclidean distance between the lower right corner of the position rectangle of the small pointer unit and the center point of the pointer movement position rectangle as the initial radius R of the circle; where Ax and Ay represent the x and y coordinates of point A, and Bx and By represent the x and y coordinates of point B, and the radius of the circle satisfies the following relationship (1):

[0026]

[0027] S52. Draw a picture; Create a new binary mask image with the same width and height as the small pointer watch image and all pixel values ​​are 0. Use the midpoint coordinates of the rectangle where the pointer movement is located as the center and R as the radius to draw a circle on the mask image.

[0028] S53. Filter out pointer pixels; the specific operation is to subtract the pointer mask image from the binarized image in step S3 to eliminate the interference of pointer pixels and obtain a binarized image with only tick lines.

[0029] S54. Determine the intersection region between the scale line and the circumference; wherein, the binary image containing only the scale line and the image are obtained by performing a logical AND operation based on the pixels to obtain a binary image of the intersection region between the scale line and the circumference. Each white area in the binary image is the intersection region between the circumference and a scale line. Each intersection region is a connected component composed of pixels with preset pixel values.

[0030] S55. The region growing algorithm locates the coarse tick marks and saves all pixel coordinates of each coarse tick mark.

[0031] S551. Select a pixel from each intersecting region in the binary image as the seed point for the region growing algorithm. Find the connected component containing the seed point through region growing. After generating each connected component, count the number of pixels in the connected component (pixel_num) and retain the coordinates (px, py) of each pixel in the connected component. Each connected component representing the tick mark can be represented by the number of pixels and the coordinates of all pixels belonging to the connected component. The pixel coordinates satisfy the following relationship (2):

[0032] tick_mark={pixel_num,pixel_coords}...(2);

[0033] pixel_coords represents the coordinates of all pixels belonging to the same connected component, where n represents the number of pixels in the connected component, and the coordinates of all pixels satisfy the following relationship (3):

[0034] pixel_coords={(px1,py1),(px2,py2),(px3,py3),...,(px n ,py n )}……(3);

[0035] S552. Filter out non-coarse tick marks; First, tick marks with a pixel number (pixel_num) less than 10 are judged as fine tick marks and filtered out. Then, the remaining tick marks are sorted according to the pixel number (pixel_num) and the maximum value (Max) is taken. Tick marks with a pixel number less than half of the maximum value are filtered out. The last remaining tick marks are used as coarse tick marks.

[0036] S56. Based on the pixel coordinates of all pixels of each coarse tick line, the least squares method is used to fit the corresponding straight line mark_line. Each coarse tick line mark_line = [start_x, start_y, end_x, end_y] is retained in the form of start and end points. The small pointer table shows that the straight lines of all coarse tick lines satisfy the following relationship (4):

[0037] Mark_lines={mark_line1,mark_line2,mark_line3,......,mark_line m}…(4).

[0038] Preferably, step S6 specifically includes the following steps:

[0039] Accurate positioning of coarse scale lines means that in step S4, all coarse scales in the small pointer meter are accurately positioned, that is, the number of coarse scale lines is equal to the actual number of coarse scale lines in the small pointer meter; where the number of coarse scale lines is equal to the number of elements in the array; the actual number of coarse scale lines is equal to the number of elements in the range scale value array of the small pointer meter, and the range scale value array of the small pointer meter is manually input.

[0040] When the number of coarse scale lines equals the actual number of coarse scale lines minus 1, it means that only one coarse scale line was missed. There are two reasons for the missed detection: first, the coarse scale line is completely obscured by the pointer; second, the coarse scale line is not completely obscured by the pointer and belongs to the same connected component. In the sub-step S43 of step S4, it is filtered out. For the case where only one coarse scale line is missed, proceed to step S7 for processing.

[0041] When the number of coarse scale lines is greater than the actual number of coarse scale lines or the number of coarse scale lines is less than the actual number of coarse scale lines - 1, it indicates that there is a false detection of coarse scale lines or multiple coarse scale lines are missed. In this case, proceed to step S5 for processing.

[0042] Preferably, step S7 is specifically divided into the following three states:

[0043] S71. The positioning and pointer belong to the same connected region, but are not completely obscured by thick tick marks;

[0044] S72. There is a possibility of misdetecting coarse scale lines;

[0045] S73. Multiple coarse graduation lines were falsely detected.

[0046] Preferably, step S71 specifically includes the following steps:

[0047] S711. Create a mask image with the same size as the pointer mask image and pixel values ​​equal to the preset values, and draw a circle on the mask image using the method of sub-step S42 in step S4.

[0048] S712. Perform a logical AND operation between the circled mask image and the pointer mask image to obtain a result image. Each white area in the result image is the intersection area of ​​the circle and the pointer connected region. Each intersection area is a connected region composed of pixels whose pixel values ​​are all at a preset threshold.

[0049] S713. Count the number of connected components of white pixel values ​​cn in the result image. When cn = 2, proceed to step S714 for processing; when cn = 1, proceed to step S715 for processing.

[0050] S714. Distinguish between the pointer and the coarse scale lines;

[0051] S715. Adaptively change the radius of the circle to locate the missing coarse scale line, locate the coarse scale line that is completely obscured by the pointer, and add the relocated missing coarse scale line to the Mark_lines array of equation (4) to become a new coarse scale line.

[0052] Preferably, step S714 specifically includes the following steps:

[0053] Find the coordinates of the center pixel of the connected component of each white pixel in the resulting image, where P1 = (x1, y1) represents the coordinates of the center pixel of the first connected component, and P2 = (x2, y2) represents the coordinates of the center pixel of the second connected component.

[0054] Create a mask image of the same size as the pointer mask image and with a pixel value of 0, and draw the pointer line fitted in step S4 on the mask image;

[0055] Create a first mask image with the same size as the pointer mask image and a pixel value of 0. Draw a first straight line on the first mask image with P1 = (x1, y1) as the starting point and (px2, py2) as the ending point of the pointer line.

[0056] Create a second mask image with the same size as the pointer mask image and a pixel value of 0. Draw a second straight line on the second mask image with P2 = (x2, y2) as the starting point and (px2, py2) as the ending point of the pointer line.

[0057] The mask image and the first mask image are logically ANDed to obtain the result image. The number of pixels with a preset value in the result image is counted. The number of pixels represents the number of pixels in the pointer line mask image that overlap with the first line.

[0058] Perform a logical AND operation on the mask image and the second mask image, and count the number of pixels with a preset value in the result image. The number of pixels represents the number of pixels in the pointer line mask image that overlap with the second line.

[0059] When the number of the second line is greater than the number of the first line, it means that the first line = [x1,y1,px2,py2] is a missed coarse scale line, and the second line = [x2,y2,px2,py2] is part of the pointer line.

[0060] Preferably, step S715 specifically includes the following steps:

[0061] Set the offset parameter array for changing the circle radius to a preset value [a,b,c,d]. When the number of connected components of white pixel values ​​in the result image is cn=1, the circle radius R will be added to each element value in the offset parameter array to obtain a new circle radius R1. Then, steps S711 to S713 are executed sequentially.

[0062] If, at a certain circle radius R1, the number of connected components of white pixels in the resulting image is cn = 2, then step S714 will be executed, and then step S715 will be exited, proceeding to step S54 for processing; if, after traversing all 4 bias parameters in the bias parameter array, cn is still equal to 1, then it is determined that the missed coarse scale line is completely obscured by the pointer, and proceeding to step S53 for processing.

[0063] Preferably, step S8 specifically includes the following steps:

[0064] S81. Obtain the coordinates of the starting point of each coarse scale line on the indicator table image;

[0065] S82. Sort the starting coordinates of all coarse tick lines in the array;

[0066] S83. Determine the range scale value corresponding to each coarse scale line.

[0067] Preferably, step S9 specifically includes the following steps:

[0068] Determine the positional relationship between the pointer line and the coarse scale line;

[0069] Based on the positional relationship, determine the coarse tick line that has the smallest distance from the pointer line in the Lines array; where Lines = {line1, line2, ..., line...} m In the array, the starting coordinates of the leftmost adjacent thick tick mark of each pointer line are L_start. L =(line_start_x L,line_start_y L The corresponding range scale value is gt_value. L The starting coordinates of the rightmost adjacent thickest tick mark on the pointer line are determined to be L_start. R =(line_start_x R ,line_start_y R The corresponding range scale value is gt_value. R ;

[0070] Create a first mask image with the same size as the pointer mask image and a pixel value of 0, and draw a first straight line in white on the first mask image;

[0071] Create a second mask image with the same size as the pointer mask image and a pixel value of 0, and draw a second straight line in white on the second mask image;

[0072] The first mask image and the second mask image are subjected to a pixel-wise logical AND operation to obtain a result image. The coordinates of the white pixels in the result image are the coordinates of the intersection point of the second line and the first line.

[0073] The intersection point to L_start is calculated based on the following relationship (5). L The Euclidean distance d_pL between the points;

[0074]

[0075] Here, the starting coordinate of the first straight line is defined as L_start. L =(line_start_x L ,line_start_y L Let L_start be the coordinate of the endpoint of the first straight line. R =(line_start_x R ,line_start_y R The intersection point is defined as C_P, and C_P is preset to (cross_x, cross_y);

[0076] L_start is calculated according to the following relationship (6). R and L_start L Euclidean distance d_RL;

[0077]

[0078] Calculate the pointer meter reading according to the following formula (7);

[0079]

[0080] Compared with related technologies, this invention locates the small pointer in the closing current pointer meter; crops the small pointer meter from the image of the closing current pointer meter; detects the pointer mechanism and unit letters on the small pointer meter; locates the pointer using a region growing algorithm and fits the pointer line of the small pointer meter using least squares; locates the coarse scale line of the small pointer meter using the circle radius method and the region growing algorithm; judges the accuracy of the number of coarse scale lines; if two or more coarse scale lines are missed, or multiple coarse scale lines are detected, the circle radius value is changed, and the process returns to step S5; if fewer than two coarse scale lines are missed, the process proceeds to the next step S7; locates the missed coarse scale lines; sorts the positions of the coarse scale lines and the pointer line; and calculates the starting coordinates pL_ of the pointer line on the pointer mask image. The Euclidean distance pLdist between the start and the vertex of the pointer mask image is calculated. The reading of the small pointer meter is calculated based on pLdist. The coarse scale line of the small pointer meter is located using a simple and efficient circle radius method and region growing algorithm. Even if one coarse scale line is missed, by combining the manually input small pointer meter range scale value and the circle radius method, two types of missed coarse scale lines can be relocated: the first is a coarse scale line completely obscured by the pointer; the second is a coarse scale line in the same connected region as the pointer but not completely obscured. By adaptively changing the fixed value of the circle radius R to locate the coarse scale line, the problems of false detection and missed detection of coarse scale lines are solved, ensuring the stability and robustness of the coarse scale line location. At the same time, it also avoids the detection of fine scale lines affecting the pointer reading, thereby improving the accuracy of the reading and making it more widely applicable. Attached Figure Description

[0081] The present invention will now be described in detail with reference to the accompanying drawings. The above and other aspects of the present invention will become clearer and more readily understood through the detailed description following the accompanying drawings. In the drawings:

[0082] Figure 1 This is a flowchart of the pointer meter reading recognition method with non-uniform scale according to the present invention;

[0083] Figure 2 This is a flowchart of step S4 of the pointer meter reading recognition method with non-uniform scale of the present invention;

[0084] Figure 3 This is a flowchart of step S5 of the pointer meter reading recognition method with non-uniform scale of the present invention;

[0085] Figure 4 This is a flowchart of step S7 of the pointer meter reading recognition method with non-uniform scale of the present invention;

[0086] Figure 5This is a schematic diagram of the small pointer meter detection method of the present invention;

[0087] Figure 6 This is a schematic diagram of the pointer mechanism and unit letter detection of the present invention;

[0088] Figure 7 This is a schematic diagram of the pointer linear fitting process of the present invention;

[0089] Figure 8 This is a schematic diagram illustrating the determination of the circle radius in this invention;

[0090] Figure 9 This is a schematic diagram of a circle drawn from the mask image of the present invention;

[0091] Figure 10 This is a schematic diagram illustrating the process of eliminating pointer pixels according to the present invention;

[0092] Figure 11 This is a schematic diagram illustrating the intersection area between the scale line and the circumference in this invention.

[0093] Figure 12 This is a schematic diagram of the growth positioning scale lines of the region in this invention;

[0094] Figure 13 This is a schematic diagram of the straight line fitting process for the coarse scale line in this invention;

[0095] Figure 14 This is a schematic diagram showing that the coarse scale line and the pointer belong to the same connected region in this invention;

[0096] Figure 15 This is a schematic diagram illustrating the logic and operation structure of the mask image and pointer mask image of the present invention. Detailed Implementation

[0097] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0098] The specific embodiments / examples described herein are specific implementations of the present invention, used to illustrate the concept of the invention, and are illustrative and exemplary, and should not be construed as limiting the implementation methods or scope of the present invention. In addition to the embodiments described herein, those skilled in the art can employ other obvious technical solutions based on the content disclosed in the claims and specification of this application. These technical solutions include those that make any obvious substitutions and modifications to the embodiments described herein, all of which are within the protection scope of the present invention.

[0099] Example 1

[0100] Please refer to Figure 1 As shown, where, Figure 1 This is a flowchart of the pointer meter reading recognition method with non-uniform scale according to the present invention.

[0101] This invention provides a method for recognizing the readings of an analog meter with a non-uniform scale, comprising the following steps:

[0102] S1 is the small pointer in the positioning and closing current pointer table.

[0103] Specifically, the purpose of this step is to locate the three smaller pointers from left to right in the closing current pointer table. The high-performance deep learning object detection algorithm YOLOv4-tiny is used for detection, and the specific implementation steps are as follows:

[0104] The power distribution room inspection robot automatically collects 1000 images of the current meter readings under different lighting conditions and shooting angles, such as... Figure 5 As shown.

[0105] The location rectangle and category name (Ameter) of each small pointer meter in each image of the closing current pointer meter were labeled using the third-party labeling software LabelImage. The location rectangle and category name information of each small pointer meter were saved to the XML file corresponding to each image. Finally, a training dataset containing 1,000 images of closing current pointer meters and 1,000 XML files was built.

[0106] The YOLOv4-tiny object detection network was trained using the established training dataset, resulting in a detection model, table_detector, that can accurately detect the three small pointer tables from the image of the closing current pointer table.

[0107] The image of the closing current pointer to be detected is input into `table_detector` to detect the positions of three smaller pointers. The system returns the coordinates of the bounding box and the category name of each pointer in the format `{x1, y1, x2, y2, label}`. Here, `x1`, `y1`, `x2`, and `y2` represent the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner, respectively; `label` represents the category name of the pointer.

[0108] Based on the detection results returned by the table_detector detection model, extract the top-left x-coordinates x1, x2, and x3 of the position rectangles of the three small pointer tables, sort x1, x2, and x3 from smallest to largest, and finally adjust the order of the position rectangles of the three small pointer tables according to the sorted x1, x2, and x3 to complete the sorting of the three small pointer tables.

[0109] S2. Cut out the small pointer table from the image of the closing current pointer table.

[0110] Specifically, based on the detection results of the small pointer meter in step S1, each small pointer meter is cropped from the closing current pointer meter from left to right according to the position rectangle coordinates of the small pointer meter, and the width and height of the small pointer meter image are scaled to 300 pixels.

[0111] S3. Detect the pointer mechanism and unit letters on the small pointer watch.

[0112] Specifically, the purpose of this step is to determine the pointer mechanism and units of the small pointer watch, facilitating subsequent reading recognition and processing. To ensure the accuracy and stability of the detection, the deep learning object detection algorithm YOLOv4-tiny is also used. The specific implementation steps are as follows:

[0113] From the 1000 images of the closing current pointer meter in step S1, 3000 square pointer meter images are cropped out, such as... Figure 6 As shown.

[0114] The location and category name of the pointer mechanism and unit in each small pointer table image were labeled using the third-party labeling software LabelImage. The labeling information was saved in the XML file corresponding to each image, and finally a training dataset containing 3,000 square pointer table images and 3,000 XML files was built.

[0115] The YOLOv4-tiny object detection network was trained using the established training dataset, resulting in a detection model called ameter_detector that can accurately detect the pointer mechanism and unit from images of small pointer watches.

[0116] The image of the square pointer meter to be identified is input into the ameter_detector detection model to detect the pointer mechanism and unit, and the model returns the coordinates of the bounding boxes and the category name information of the pointer mechanism and unit letter in the format {x1, y1, x2, y2, label}. Here, x1, y1, x2, y2 represent the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively; and label represents the category name of the pointer mechanism or unit letter.

[0117] S4. Locate the pointer using the region growing algorithm, and fit the pointer line of the small pointer table using least squares.

[0118] S5. Locate the coarse scale line of the small pointer table using the radius method and the region growing algorithm.

[0119] Among them, the radius method is used to process the data by using the radius of a circle. The pointer table is set according to the relationship between the radius and the circle, and the coarse scale line of the small pointer table is located by using the radius method and the region growing algorithm.

[0120] S6. Determine the accuracy of the number of coarse scale lines.

[0121] S61. If two or more of the coarse scale lines are missed, or if multiple coarse scale lines are missed, change the circle radius value and return to step S5.

[0122] S62. If less than two of the coarse scale lines are missed, proceed to the next step S7. Specifically, if one of the coarse scale lines is missed, proceed to the next step S7; if zero of the coarse scale lines are missed, proceed to the next step S8. Given that one coarse scale line is missed, by combining the manually input small pointer meter range scale value and the circle radius method, two types of missed coarse scale lines can be repositioned: the first type is a coarse scale line completely obscured by the pointer; the second type is a coarse scale line in the same connected region as the pointer but not completely obscured.

[0123] S7. Locate the missing coarse graduation line.

[0124] S8. Sort the positions of the coarse scale lines and pointer lines. A method is proposed to sort all coarse scale lines from largest to smallest by the distance rdist value from the starting coordinate L_start of each coarse scale line to the top right corner of the mask image. This method is more accurate and stable than sorting by the slope or angle of the coarse scale lines, and it also better conforms to the distribution pattern of the pointer meter's range scale. Based on the sorted rdist values, a one-to-one correspondence is achieved between each coarse scale line and each range scale value of the pointer meter.

[0125] S9. Calculate the Euclidean distance pLdist between the starting coordinates pL_start of the pointer line on the pointer mask image and the vertex of the pointer mask image.

[0126] The vertex can be compared to the furthest distance from the right vertex, or it can be compared to the distance between the left bottom corners. Preferably, it only needs to be the same as the comparison target of the coarse scale line, and the specific choice can be made according to the actual situation.

[0127] S10, Euclidean distance pLdist is used to calculate the reading of the small pointer meter.

[0128] In specific implementation, the process involves locating the small pointer in the current-closing pointer meter; cropping the small pointer from the image of the current-closing pointer meter; detecting the pointer mechanism and unit letters on the small pointer; locating the pointer using a region growing algorithm and fitting the pointer line of the small pointer meter using least squares; locating the coarse scale line of the small pointer meter using the circle radius method and the region growing algorithm; judging the accuracy of the number of coarse scale lines; if two or more coarse scale lines are missed, or multiple coarse scale lines are detected, the circle radius value is changed, and the process returns to step S5; if fewer than two coarse scale lines are missed, the process proceeds to the next step S7; locating the missed coarse scale lines; sorting the positions of the coarse scale lines and the pointer line; and calculating the pointer line poin. The starting coordinates pL_start of the pointer on the pointer mask image and the Euclidean distance pLdist between the right vertex of the pointer mask image are calculated. The reading of the small pointer meter is calculated. The coarse scale line of the small pointer meter is located based on the simple and efficient circle radius method and region growing algorithm. Under the premise of missing one coarse scale line, the missed coarse scale line can be relocated in two cases by combining the manually input small pointer meter range scale value and the circle radius method. The first is the coarse scale line that is completely obscured by the pointer. The second is the coarse scale line that is in the same connected region as the pointer but is not completely obscured. By changing the fixed value of the circle radius R, the coarse scale line is adaptively located, which solves the problem of false detection and missed detection of coarse scale, and ensures the stability and robustness of the coarse scale line positioning.

[0129] In this embodiment, please refer to Figure 2 As shown, Figure 2 This is a flowchart of step S4 of the pointer meter reading recognition method with non-uniform scale of the present invention. Step S4 specifically includes the following steps: S41, binarizing the small pointer meter image to obtain a binarized image.

[0130] S42. Filter out the interfering pixels in the binarized image.

[0131] Specifically, this step is to more accurately fit a straight line to the pointer. Step 1: Set all pixel values ​​within the rectangle containing the pointer's movement in the binarized image to 0. Step 2: Reassign pixel values ​​in the width and height directions of the binarized image, starting from the bottom right corner coordinates (pr_x, pr_y) of the pointer's movement rectangle. Specifically: in the width direction of the binarized image, set all pixel values ​​with a horizontal coordinate not less than pr_x to 0; in the height direction, set all pixel values ​​with a vertical coordinate not less than pr_y to 0. The final result is a usable binarized image, bin_image.

[0132] S43, In the region where the growth pointer is located.

[0133] Specifically, on the binarized image `bin_image`, using the coordinates of the non-zero pixel values ​​on the left and top edges of the rectangle containing the pointer mechanism as seeds, region growing is performed to obtain a pointer mask image containing only the pointer pixels, such as... Figure 7 As shown in Figure d, the white pixels are all pointer pixels.

[0134] S44. Fit the pointer line using least squares.

[0135] Specifically, first, the pointer mask image is traversed to save the coordinates of all pointer pixels. Then, the least squares line fitting function built into OpenCV is called to fit the coordinates of all pointer pixels to obtain a line representing the pointer. The line is saved as pointerline = [px1, py1, px2, py2] in the form of starting coordinates and ending coordinates. px1 and py1 represent the starting x and y coordinates of the pointer line, respectively; px2 and py3 represent the ending x and y coordinates of the pointer line, respectively.

[0136] In this embodiment, please refer to Figure 3 As shown, Figure 3 This is a flowchart of step S5 in the non-uniform scale pointer meter reading recognition method of the present invention. Step S5 specifically includes the following steps: S51, calculating the radius of the circle; using the coordinates of the lower right corner of the position rectangle in small pointer meter units (e.g., ...). Figure 8 The initial radius R of the circle is N times the Euclidean distance between point A and the point in the rectangular frame of the pointer mechanism position; where Ax and Ay represent the x and y coordinates of point A, and Bx and By represent the x and y coordinates of point B, and the radius of the circle satisfies the following relationship (1):

[0137]

[0138] Where N is 0.7n, and n is a natural number.

[0139] S52. Draw; Create a new binary mask image circle_mask with the same width and height as the small pointer image and all pixel values ​​of 0, using the coordinates of the midpoint of the rectangle containing the pointer mechanism ( Figure 9 Using point B in the image as the center, draw a circle on the mask image circle_mask with radius R. Set the pixel value on the circumference to 255 and the width of the circumference line to 5 pixels.

[0140] S53, Filter out pointer pixels; such as Figure 10 As shown, the specific operation is to subtract the pointer mask image from the binarized image bin_image in step S3 to eliminate the interference of pointer pixels, and obtain a binarized image line_binimage containing only tick lines.

[0141] S54. Determine the area where the scale line intersects with the circumference; such as Figure 11 As shown, the binarized images `line_binimage` and `circle_mask` (containing only tick marks) are used to perform a logical AND operation on their pixels to obtain a binarized image `ross_image` representing the intersection region between the tick marks and the circle. Each white area in `ross_image` represents the intersection region between the circle and a tick mark, and each intersection region is a connected component composed of pixels with a preset pixel value. The preset pixel value can be 255.

[0142] S55. The region growing algorithm locates the coarse scale lines and saves the pixel coordinates of each coarse scale line.

[0143] S551. Select a pixel from each intersecting region in the binary image as the seed point for the region growing algorithm. Find the connected component containing the seed point through region growing. After generating each connected component, count the number of pixels in the connected component (pixel_num) and retain the coordinates (px, py) of each pixel in the connected component. Each connected component representing the tick mark can be represented by the number of pixels and the coordinates of all pixels belonging to the connected component. The pixel coordinates satisfy the following relationship (2):

[0144] tick_mark={pixel_num,pixel_coords}...(2).

[0145] pixel_coords represents the coordinates of all pixels belonging to the same connected component, where n represents the number of pixels in the connected component, and the coordinates of all pixels satisfy the following relationship (3):

[0146] pixel_coords={(px1,py1),(px2,py2),(px3,py3),...,(px n ,py n )}……(3).

[0147] S552. Filter out non-coarse tick marks; First, tick marks with a pixel count (pixel_num) less than a preset threshold are identified as fine tick marks and filtered out. Then, the remaining tick marks are sorted by pixel count (pixel_num) and the maximum value (Max) is taken. Tick marks less than half of the maximum value are filtered out, and the remaining tick marks are used as coarse tick marks. The preset threshold can be 10, 20, 100, 200, etc. The region growth positioning tick marks are as follows: Figure 12 As shown.

[0148] Specifically, due to the influence of the value of the circle radius R, the thin scale lines may also intersect with the circumference. Therefore, it is necessary to filter out the thin scale lines according to the number of pixel points pixel_num of each scale line. The specific operation is to first determine that the scale lines tick_mark with the number of pixel points pixel_num less than 10 are thin scale lines and filter them out. Then, sort the remaining scale lines according to the number of pixel points pixel_num and take the maximum value Max. Filter out the scale lines less than half of Max, and use the finally retained scale lines as the thick scale lines.

[0149] S56. Use the least squares method to fit a straight line mark_line corresponding to each thick scale line based on all pixel coordinates pixel_coords of each thick scale line, and retain each thick scale straight line mark_line = [start_x, start_y, end_x, end_y] in the form of the starting point and the ending point. The straight lines of all thick scale lines of the small pointer table satisfy the following relationship (4):

[0150] Mark_lines = {mark_line1, mark_line2, mark_line3,......, mark_line m}…(4).

[0151] In this embodiment, the step S6 specifically includes the following steps:

[0152] The accurate positioning of the thick scale lines means that all the thick scale lines in the small pointer table are accurately positioned in step S4, that is, the number of thick scale lines pt_line_num is equal to the actual number of thick scale lines gt_line_num of the small pointer table. Among them, pt_line_num is equal to the number of elements in the Mark_lines array; gt_line_num is equal to the number of elements in the small pointer table range scale value array, and the small pointer table range scale value array is input manually.

[0153] When pt_line_num = gt_line_num - 1, it means that only 1 thick scale line is missed. The reasons for missing inspection include two. First, the thick scale line is completely blocked by the pointer. Second, the thick scale line is not completely blocked by the pointer and belongs to the same connected domain and is filtered out in the sub-step S43 of step S4. For the case where only 1 thick scale line is missed, go to step S7 for processing. [[ID=IPD=19]]

[0154] When pt_line_num > gt_line_num or pt_line_num < gt_line_num - 1, it means that there is a misdetection of the thick scale line or multiple thick scale lines are missed. At this time, go to step S5 for processing.

[0155] The process of fitting the coarse scale line as a straight line is as follows: Figure 13 As shown.

[0156] In this embodiment, please refer to Figure 4 As shown, Figure 4 This is a flowchart of step S7 of the non-uniform scale pointer meter reading recognition method of the present invention. Step S7 is specifically divided into the following three states:

[0157] S71, The positioning and pointer belong to the same connected region, but are not completely obscured by the coarse scale line.

[0158] Specifically, such as Figure 14 As shown in the binarized image in Figure b, the 0-scale line of the small pointer table and the pointer belong to the same connected component. From the pointer mask image in Figure c, it can be seen that although the 0-scale line and the pointer belong to the same connected component, the 0-scale line is not completely obscured by the pointer because there is a clear gap between the pointer and the end of the 0-scale line. This method utilizes this gap to locate the missed coarse scale line.

[0159] S72. There is a possibility of misdetecting coarse scale lines.

[0160] Specifically, a coarse scale line misdetection refers to the situation where a fine scale line is incorrectly detected as a coarse scale line. This indicates that the radius R of the circle is too large, and the value of R needs to be reduced. The specific implementation steps are as follows:

[0161] The offset parameter array for changing the radius of the circle is set by manual experience as r_offset = [-5, -10, -15, -20]. r_offset contains four elements: -5, -10, -15, and -20, representing four new values ​​of R that are successively reduced.

[0162] The value R is first added to the first element of r_offset -5 to obtain a new value R1. Then, using R1 as the radius of the circle, steps S4 and S5 are executed sequentially to reposition the coarse tick mark. If there are still cases where the coarse tick mark is falsely detected, the value R is added to the second element of r_offset -10 to obtain a new radius R2. Steps S4 and S5 are then executed sequentially to reposition the coarse tick mark. This process continues until a value R accurately positions the coarse tick mark, at which point step S7 is exited. Alternatively, if the coarse tick mark is not accurately positioned after iterating through all four parameters of the r_offset array, step S7 is exited, indicating that the coarse tick mark positioning failed.

[0163] S73. Multiple coarse graduation lines were falsely detected.

[0164] Specifically, if multiple coarse scale lines are missed, it indicates that the circle radius R is too small, and the value of R needs to be increased. The specific implementation steps are as follows:

[0165] The offset parameter array for changing the radius of the circle, based on manual experience, is set to r_offset = [5, 10, 15, 20]. r_offset contains four elements: 5, 10, 15, and 20, representing four consecutive new values ​​for the radius of R.

[0166] The value R is first added to the first element 5 of r_offset to obtain a new value R1. Then, using R1 as the radius of the circle, steps S4 and S5 are executed sequentially to reposition the coarse tick mark. If multiple coarse tick marks are still missed, the value R is added to the second element 10 of r_offset to obtain a new radius R2. Steps S4 and S5 are then executed sequentially to reposition the coarse tick mark. This process continues until a value R accurately positions the coarse tick mark, at which point step S7 is exited. Alternatively, if no coarse tick mark is accurately positioned after iterating through all four parameters of the r_offset array, step S7 is exited, indicating that the coarse tick mark positioning failed.

[0167] In this embodiment, step S71 specifically includes the following steps:

[0168] S711. Create a mask image mark_img with the same size as the pointer mask image and a pixel value of 0, and draw a circle on mark_img using the method of sub-step S42 in step S4.

[0169] S712. Perform a logical AND operation between the circled mark_img and the pointer mask image to obtain the result image ms_crossimg. Each white area in ms_crossimg is the intersection region of the circle and the pointer's connected component. Each intersection region is a connected component composed of pixels with a pixel value of 255. The structure of the logical AND operation between the mask image and the pointer mask image is as follows: Figure 15 As shown.

[0170] S713. Count the number of connected components of white pixel values ​​cn in the ms_crossimg image. When cn = 2, proceed to step S4 for processing; when cn = 1, proceed to step S5 for processing.

[0171] S714. Distinguish between pointers and coarse scale lines.

[0172] Specifically, step S714 includes the following steps:

[0173] The coordinates of the center pixel of the connected component of each white pixel in the resulting image ms_crossimg are calculated, where P1 = (x1, y1) represents the coordinates of the center pixel of the first connected component, and P2 = (x2, y2) represents the coordinates of the center pixel of the second connected component.

[0174] Create a mask image pointerline_img with the same size as the pointer mask image and a pixel value of 0, and draw the pointer line pointerline fitted in step S4 on the mask image pointerline_img.

[0175] Create a first mask image line1_img with the same size as the pointer mask image and a pixel value of 0. Draw a first straight line line1 on the first mask image line1_img, starting from P1 = (x1, y1) and ending at (px2, py2) of the pointer line.

[0176] Create a second mask image line2_img with the same size as the pointer mask image and a pixel value of 0. Draw a second straight line line2 on the second mask image line2_img, starting from P2 = (x2, y2) and ending at (px2, py2) of the pointer line.

[0177] Perform a logical AND operation between the mask image pointerline_img and the first mask image line1_img to obtain the result image pointerline1_img. Count the number of pixels with a value of 255 in the result image pointerline1_img, line1_num, where line1_num represents the number of pixels that overlap with the pointer line pointerline and the line1.

[0178] Perform a logical AND operation on the images pointerline_img and line2_img, and count the number of pixels with a value of 255 in the pointerline2_img image, line2_num. line2_num represents the number of pixels where the pointer line pointerline and line2 coincide.

[0179] When line2_num > line1_num, it means that line1 = [x1, y1, px2, py2] is the missed coarse tick line (miss_line), and line2 = [x2, y2, px2, py2] is part of the pointer line. Because line2 is part of the pointer line, it naturally has more pixels overlapping with the pointer line than line1, therefore line2_num > line1_num. The reverse is also true.

[0180] S715. Adaptively change the circle radius to locate the missed coarse scale line, and locate the coarse scale line that is completely obscured by the pointer. When the missed scale line is completely obscured by the pointer, the missed coarse scale line is the pointer line, that is, miss_line = pointerline. Add the relocated missed coarse scale line miss_line to the Mark_lines array of equation (4) to become a new coarse scale line mark_line. Among them, when there is a false detection of coarse scale line or multiple coarse scale lines are missed, it means that the value of the circle radius R initialized in the sub-step S51 of step S5 is unreasonable, and the value of R needs to be adjusted and the coarse scale line relocated.

[0181] In this embodiment, step S715 specifically includes the following steps:

[0182] The offset parameter array for changing the circle radius is set to the preset value [a,b,c,d]. When the number of connected components of white pixel values ​​in the ms_crossimg image is cn=1, the circle radius R will be added to each element value in the offset parameter array to obtain a new circle radius R1. Then, steps S711 to S713 are executed sequentially. The preset value is [-5,-8,5,8].

[0183] If, at a certain circle radius R1, the number of connected components of white pixels in the ms_crossimg image is cn = 2, then step S714 will be executed, and then step S7155 will be exited, proceeding to step S54 for processing; if after traversing all 4 bias parameters in the bias parameter array, cn is still equal to 1, then it is determined that the missed coarse scale line is completely obscured by the pointer, and proceeding to step S53 for processing.

[0184] In this embodiment, the purpose of step S8 is to sort the coarse scale lines from the lower left corner to the upper right corner, so that each coarse scale line, mark_line, can accurately correspond to a range scale value, gt_value, in the manually input array of small pointer dial indicator range scale values. For example, when the maximum range of the small pointer dial indicator is 250A, rang_value = [0, 50, 100, 150, 200, 250], indicating that there are a total of 6 range scale values, gt_value, from the upper left corner to the upper right corner of the dial indicator, in ascending order. After the coarse scale lines are accurately sorted from the left scale line to the upper right corner of the dial indicator, the first coarse scale line corresponds to gt_value = 0, the second coarse scale line corresponds to gt_value = 50, the third coarse scale line corresponds to gt_value = 100, and so on, with the last coarse scale line corresponding to gt_value = 250.

[0185] In this embodiment, step S8 specifically includes the following steps:

[0186] S81. Obtain the coordinates of the starting point of each coarse scale line on the indicator table image.

[0187] Specifically, create a mask image startpoint_img with the same size as the pointer mask image and a pixel value of 0, and draw a thick tick line mark_line from Mark_lines on startpoint_img in white.

[0188] Save the coordinates of all white pixels in startpoint_img. Preferably, the white pixels must be within the image, and the pixels are limited to the area between (0, 0) and (300, 300). Note that in the following methods, the starting point can also be selected by limiting x=0 or y=0 to obtain the same starting point, which should be considered a more preferred solution.

[0189] white_points={(px1,py1),(px2,py2),(px3,py3),...,(px n ,py n )}…(15);

[0190] Calculate the Euclidean distance pdist between the coordinates (px_i, py_i) of each pixel in white_points and the bottom-right vertex r_bottom of the mask image startpoint_img, and store all pdists in the P_Dist array. Here, r_bottom = (width W of the mask image, height H of the mask image). In this method, the width and height of the small pointer table image, the small pointer table binarized image, and the pointer mask image are all set to 300x300 pixels, so r_bottom = (300, 300).

[0191] P_Dist={pdist1,pdist2,pdist3,...,pdist n}…(8).

[0192] Where Pdist1 represents the Euclidean distance between the first pixel (px1, px2) in the first white_points and r_bottom, and n represents the number of pixels.

[0193] Sort all distances in P_Dist from smallest to largest. The pixel coordinates corresponding to the maximum distance pdistmax are the starting coordinates of the coarse scale line on the index table image, L_start = (line_start_x, line_start_y), and stored in the linestart_points array, as shown in Equation 5.6. m represents the number of coarse scale lines.

[0194] linestart_points={L_start1,L_start2,L_start3,......,L_start m}…(9).

[0195] Repeat steps S4 to S44 for the straight line calculation until the starting coordinates of each tick mark in Mark_lines have been determined. Alternatively, the distance (0, 0) at the top right corner can be used for calculation, resulting in a starting point at the bottom right corner of the image.

[0196] S82. Sort the starting coordinates of all coarse tick lines in the linestart_points array.

[0197] Specifically, since each starting point coordinate in the `linestart_points` array corresponds to a thick tick mark, sorting the starting point coordinates from the bottom left to the top right is equivalent to sorting the thick tick mark lines from the bottom left to the top right. The specific implementation steps are as follows:

[0198] The Euclidean distance rdist between the starting coordinates L_start of each coarse tick line in the linestart_points array and the top-right vertex r_up of the mask image startpoint_img is calculated sequentially, and each distance is stored in the linestart_dist array until all starting coordinates in the linestart_points array and the top-right vertex rupdist of the mask image have been calculated. Here, r_up = (width W, 0 of the mask image). In this method, the width and height of the small pointer table image, the small pointer table binarized image, and the pointer mask image are all set to 300x300 pixels, so r_up = (300, 0). Preferably, the example here uses the top-left corner coordinate; the bottom-right corner coordinate can achieve the same effect.

[0199] linestart_dist={rdist1,rdist2,rdist3,...,rdist m}……(10).

[0200] Sort all distances in the `linestart_dist` array from largest to smallest, and map each sorted distance value `rdist` to the starting coordinates in `linestart_points`. Therefore, each thick tick line can be represented by its starting coordinate `L_start` and the Euclidean distance `rdist` from its starting coordinate to the top-right vertex `r_up` of the mask image `startpoint_img`.

[0201] dist_point={first_line, second_line,...,last_line}....(11).

[0202] Where, first_line = (rdist max ,L_start max L_start represents the coarse tick line corresponding to the maximum rdist value. max This indicates the starting coordinates of the coarse scale line. `last_line = (rdist)` last ,L_start last L_start represents the coarse tick line corresponding to the minimum rdist value. last This indicates the coordinates of the starting point of the coarse scale line.

[0203] S83. Determine the range scale value gt_value corresponding to each coarse scale line mark_line.

[0204] Specifically, since each starting point coordinate in the `linestart_points` array corresponds to a coarse scale line `mark_line`, we only need to determine the range scale value `gt_value` corresponding to each starting point coordinate `L_start`. Based on the rule that the range scale values ​​in the pointer table increase sequentially from the lower left to the upper right, the first element `first_line` in the `dist_point` array corresponds to the minimum range scale value 0, and so on, with the last element `last_line` corresponding to the maximum range scale value. Thus, each coarse scale line can be uniquely determined by three parameters: the starting point coordinate `L_start`, the Euclidean distance `rdist` between `L_start` and the upper right vertex `r_up` of the mask image `startpoint_img`, and the corresponding range scale value `gt_value`.

[0205] Lines={line1,line2,.......,line m}…(12).

[0206] Where, line1 = (rdistmax ,L_start max ,gt_value min L_start represents the coarse tick line corresponding to the maximum rdist value. max This indicates the starting coordinates of the coarse scale line; gt_value min This indicates the smallest scale division value of the pointer meter, 0. m =(rdist min ,L_start min ,gt_value max L_start represents the coarse tick line corresponding to the minimum rdist value. min The value gt_value represents the starting coordinates of the coarse scale line. max This indicates the maximum scale value of the pointer meter.

[0207] In this embodiment, step S9 specifically includes the following steps:

[0208] Create a mask image spline_img with the same size as the pointer mask image and a pixel value of 0. Then draw a pointer line in white on spline_img and save the coordinates (spl_x, spl_y) of each white pixel on spline_img that belongs to the pointer line.

[0209] Calculate the Euclidean distance p_dist from the coordinates (spl_x, spl_y) of each white pixel to the coordinates of the bottom right vertex of the image, and take the pixel coordinates corresponding to the maximum value of p_dist as the starting coordinates (start_px, start_py) of the pointer line.

[0210] Calculate the Euclidean distance pLdist from the starting point coordinates pL_start = (start_px, start_py) of the pointer line to the coordinates of the top right vertex of the image.

[0211] The pointer line can be represented by the starting coordinates pL_start and pLdist. All pointer lines satisfy the following relationship (13), and the starting coordinate pL_start satisfies the following relationship (14):

[0212] pointerline={pLdist,pL_start}…(13);

[0213] Where pL_start=(start_px,start_py)…(14).

[0214] In this embodiment, step S10 specifically includes the following steps:

[0215] (1) Determine the positional relationship between the pointer line and the coarse scale line.

[0216] Comparing pLdist with the distance rdist value of the coarse tick line in the Lines array will yield the following three comparison results.

[0217] 1) When pLdist is less than rdist i And greater than rdist i+1 When, it indicates that the pointer is on the line. i and line i+1 Between two thick scale lines. (The line is missing from the original text.) i It is the thickest tick mark line to the left of the pointer line. i+1 It is the coarse tick line adjacent to the right of the pointer line, i∈[1,m-1], representing the i-th coarse tick line in the Lines array. For this result, proceed to step (2) for processing.

[0218] 2) When pLdist equals rdist i When, it means Lines = {line1, line2, ..., line...} m When the i-th coarse etched line in the array is completely aligned with the pointer, the range scale value gt_value corresponding to the i-th coarse etched line is... i It refers to the reading of the pointer meter's recognition result.

[0219] 3) When pLdist is less than rdist i When i = m, it means that the coarse scale line corresponding to the maximum scale range value of the small pointer meter is located to the left of the pointer line, that is, the pointer reading exceeds the maximum scale value of the pointer meter. Therefore, it is determined that the reading of the small pointer meter is out of range, and the string "overfit" is directly returned as the recognition result reading of the small pointer meter.

[0220] (2) Calculate the pointer meter reading using the distance method.

[0221] 1) Determine the thickest tick mark that is closest to the pointer line in the Lines array.

[0222] When i∈[1,m-1], it means that there is a nearest adjacent coarse tick line on the left and right sides of the pointer line. First, according to Lines={line1,line2,.......,line m The representation of each thick tick mark in the array allows for quick determination of the starting coordinates of the nearest thick tick mark to the left of the pointer line, which is L_start. L =(line_start_x L ,line_start_yL The corresponding range scale value is gt_value. L Similarly, the starting coordinates corresponding to the rightmost adjacent thick tick mark on the pointer line can be quickly determined to be L_start. R =(line_start_x R ,line_start_y R The corresponding range scale value is gt_value. R .

[0223] 2) Create a first mask image, points_image, with the same size as the pointer mask image and pixel values ​​equal to 0. Draw a first straight line, c_line, in white on the first mask image, points_image. The starting point of the first straight line c_line is L_start. L =(line_start_x L ,line_start_y L The endpoint is L_start. R =(line_start_x R ,line_start_y R ).

[0224] 3) Create a second mask image pointer_image with the same size as the pointer mask image and a pixel value of 0, and draw a second straight line pointer_line in white on the second mask image pointer_image.

[0225] 4) Perform a logical AND operation on the first mask image pointer_image and the second mask image points_image by pixels to obtain the result image cross_point_img. The coordinates of the white pixels in cross_point_img are the coordinates of the intersection point C_P of the second line and the first line c_line. Let C_P = (cross_x, cross_y).

[0226] 5) Calculate the distance from the intersection point C_P to L_start according to equation (13). L The Euclidean distance d_pL between points.

[0227]

[0228] 6) Calculate L_start according to equation (14) R and L_start L The Euclidean distance d_RL.

[0229]

[0230] 7) Calculate the pointer meter reading according to formula (15).

[0231]

[0232] Compared with existing technologies, this invention locates the coarse scale lines of a small pointer dial indicator based on a simple and efficient circle radius method and region growing algorithm. Even if one coarse scale line is missed, by combining manually input small pointer dial indicator range scale values ​​and the circle radius method, two types of missed coarse scale lines can be relocated: the first is a coarse scale line completely obscured by the pointer; the second is a coarse scale line in the same connected region as the pointer but not completely obscured. By adaptively locating the coarse scale lines by changing the fixed value of the circle radius R, the problems of false detection and missed detection of coarse scale lines are solved, ensuring the stability and robustness of the coarse scale line location. A method is proposed to sort all coarse scale lines from largest to smallest by the distance rdist from the starting coordinate L_start of each coarse scale line on the mask image to the upper right corner vertex of the mask image. This method is more accurate and stable than sorting by the slope or angle value of the coarse scale lines, and also better conforms to the distribution pattern of the pointer dial indicator range scale. Based on the sorted rdist values, a one-to-one correspondence was achieved between each coarse scale line and each range scale value of the pointer table.

[0233] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any alterations, equivalent substitutions, or improvements made within the spirit and principles of the present invention should be included within the scope of the claims of the present invention.

Claims

1. A method for recognizing the readings of a pointer meter with a non-uniform scale, characterized in that, Includes the following steps: S1, the small pointer in the positioning and closing current pointer table; S2. Cut out the small pointer table from the image of the closing current pointer table; S3. Detect the pointer mechanism and unit letters on the small pointer watch; S4. Locate the pointer using the region growing algorithm and fit the pointer line of the small pointer table using least squares. S5. Locate the coarse scale line of the small pointer table using the radius method and the region growing algorithm; S6. Determine the accuracy of the number of coarse scale lines; S61. If two or more coarse scale lines are missed or multiple coarse scale lines are missed, change the circle radius value and return to step S5. S62. If less than two of the aforementioned coarse graduation lines are missed, proceed to the next step S7. S7. Locate the missing coarse graduation line; S8. Sort the positions of the coarse scale lines and the pointer line; S9. Calculate the Euclidean distance pLdist between the starting coordinates pL_start of the pointer line on the pointer mask image and the vertex of the pointer mask image; S10. Calculate the reading of the small pointer meter based on the Euclidean distance pLdist; Step S4 specifically includes the following steps: S41. Binarize the image of the small pointer table to obtain a binary image; S42. Filter out interfering pixels in the binarized image; S43. In the region where the pointer is located; S44. Fit the pointer line using least squares; Step S5 specifically includes the following steps: S51. Calculate the radius of the circle; take N times the Euclidean distance between the lower right corner of the position rectangle of the small pointer unit and the center point of the pointer movement position rectangle as the initial radius R of the circle; where Ax and Ay represent the x and y coordinates of point A, and Bx and By represent the x and y coordinates of point B, and the radius of the circle satisfies the following relationship (1): S52. Draw a picture; Create a new binary mask image with the same width and height as the small pointer watch image. Use the midpoint coordinates of the rectangle containing the pointer movement as the center of the circle and R as the radius to draw a circle on the mask image. S53. Filter out pointer pixels; the specific operation is to subtract the pointer mask image from the binarized image in step S3 to eliminate the interference of pointer pixels and obtain a binarized image with only tick lines. S54. Determine the intersection region between the scale line and the circumference; wherein, the binary image containing only the scale line and the image are obtained by performing a logical AND operation based on the pixels to obtain a binary image of the intersection region between the scale line and the circumference. Each white area in the binary image is the intersection region between the circumference and a scale line. Each intersection region is a connected component composed of preset pixels. S55. The region growing algorithm locates the coarse tick marks and saves all pixel coordinates of each coarse tick mark. S551. Select a pixel from each intersecting region in the binary image as the seed point for the region growing algorithm. Find the connected component containing the seed point through region growing. After generating each connected component, count the number of pixels in the connected component (pixel_num) and retain the coordinates (px, py) of each pixel in the connected component. Each connected component representing the tick mark can be represented by the number of pixels and the coordinates of all pixels belonging to the connected component. The pixel coordinates satisfy the following relationship (2): tick_mark={pixel_num,pixel_coords}...(2); pixel_coords represents the coordinates of all pixels belonging to the same connected component, where n represents the number of pixels in the connected component, and the coordinates of all pixels satisfy the following relationship (3): pixel_coords={(px1,py1),(px2,py2),(px3,py3),......,(px n ,py n )}…(3); S552. Filter out non-coarse tick marks; First, tick marks with the number of pixels (pixel_num) less than a preset threshold are judged as fine tick marks and filtered out. Then, the remaining tick marks are sorted according to the number of pixels (pixel_num) and the maximum value (Max) is taken. Tick marks with the number of pixels less than half of Max are filtered out. The last remaining tick marks are used as coarse tick marks. S56. Based on the pixel coordinates of all pixels of each coarse tick line, the least squares method is used to fit the corresponding straight line mark_line. Each coarse tick line mark_line = [start_x, start_y, end_x, end_y] is retained in the form of start and end points. The small pointer table shows that the straight lines of all coarse tick lines satisfy the following relationship (4): Mark_lines={mark_line1,mark_line2,mark_line3,......,mark_line m }…(4)。 2. The method for recognizing pointer meter readings with non-uniform scales as described in claim 1, characterized in that, Step S6 specifically includes the following steps: Accurate positioning of coarse scale lines means that in step S4, all coarse scales in the small pointer meter are accurately positioned, that is, the number of coarse scale lines is equal to the actual number of coarse scale lines in the small pointer meter; where the number of coarse scale lines is equal to the number of elements in the array; the actual number of coarse scale lines is equal to the number of elements in the range scale value array of the small pointer meter, and the range scale value array of the small pointer meter is manually input. When the number of coarse scale lines equals the actual number of coarse scale lines minus 1, it means that only one coarse scale line was missed. There are two reasons for the missed detection: first, the coarse scale line is completely obscured by the pointer; second, the coarse scale line is not completely obscured by the pointer and belongs to the same connected component. In the sub-step S43 of step S4, it is filtered out. For the case where only one coarse scale line is missed, proceed to step S7 for processing. When the number of coarse scale lines is greater than the actual number of coarse scale lines or the number of coarse scale lines is less than the actual number of coarse scale lines - 1, it indicates that there is a false detection of coarse scale lines or multiple coarse scale lines are missed. In this case, proceed to step S5 for processing.

3. The method for recognizing pointer meter readings with non-uniform scales as described in claim 1, characterized in that, Step S7 is specifically divided into the following three states: S71. The positioning and pointer belong to the same connected region, but are not completely obscured by thick tick marks; S72. There is a possibility of misdetecting coarse scale lines; S73. Multiple coarse graduation lines were falsely detected.

4. The method for recognizing pointer meter readings with non-uniform scales as described in claim 3, characterized in that, Step S71 specifically includes the following steps: S711. Create a mask image with the same size as the pointer mask image and pixel values ​​equal to the preset values, and draw a circle on the mask image using the method of sub-step S42 in step S4. S712. Perform a logical AND operation between the circled mask image and the pointer mask image to obtain a result image. Each white area in the result image is the intersection area of ​​the circle and the pointer connected region. Each intersection area is a connected region composed of pixels whose pixel values ​​are all at a preset threshold. S713. Count the number of connected components of white pixel values ​​cn in the result image. When cn = 2, proceed to step S714 for processing; when cn = 1, proceed to step S715 for processing. S714. Distinguish between the pointer and the coarse scale lines; S715. Adaptively change the radius of the circle to locate the missing coarse scale line, locate the coarse scale line that is completely obscured by the pointer, and add the relocated missing coarse scale line to the Mark_lines array of equation (4) to become a new coarse scale line.

5. The method for recognizing pointer meter readings with non-uniform scales as described in claim 4, characterized in that, Step S714 specifically includes the following steps: Find the coordinates of the center pixel of the connected component of each white pixel in the resulting image, where P1 = (x1, y1) represents the coordinates of the center pixel of the first connected component, and P2 = (x2, y2) represents the coordinates of the center pixel of the second connected component. Create a mask image of the same size as the pointer mask image and with a pixel value of 0, and draw the pointer line fitted in step S4 on the mask image; Create a first mask image with the same size as the pointer mask image and a pixel value of 0. Draw a first straight line on the first mask image with P1 = (x1, y1) as the starting point and (px2, py2) as the ending point of the pointer line. Create a second mask image with the same size as the pointer mask image and a pixel value of 0. Draw a second straight line on the second mask image with P2 = (x2, y2) as the starting point and (px2, py2) as the ending point of the pointer line. The mask image and the first mask image are logically ANDed to obtain the result image. The number of pixels with a preset value in the result image is counted. The number of pixels represents the number of pixels in the pointer line mask image that overlap with the first line. Perform a logical AND operation on the mask image and the second mask image, and count the number of pixels with a preset value in the result image. The number of pixels represents the number of pixels in the pointer line mask image that overlap with the second line. When the number of the second line is greater than the number of the first line, it means that the first line = [x1,y1,px2,py2] is a missed coarse scale line, and the second line = [x2,y2,px2,py2] is part of the pointer line.

6. The method for recognizing pointer meter readings with non-uniform scales as described in claim 5, characterized in that, Step S715 specifically includes the following steps: Set the offset parameter array for changing the circle radius to a preset value [a,b,c,d]. When the number of connected components of white pixel values ​​in the result image is cn=1, the circle radius R will be added to each element value in the offset parameter array to obtain a new circle radius R1. Then, steps S711 to S713 are executed sequentially. If, at a certain circle radius R1, the number of connected components of white pixels in the resulting image is cn = 2, then step S714 will be executed, and then step S715 will be exited, proceeding to step S54 for processing; if, after traversing all 4 bias parameters in the bias parameter array, cn is still equal to 1, then it is determined that the missed coarse scale line is completely obscured by the pointer, and proceeding to step S53 for processing.

7. The method for recognizing pointer meter readings with non-uniform scales as described in claim 1, characterized in that, Step S8 specifically includes the following steps: S81. Obtain the coordinates of the starting point of each coarse scale line on the indicator table image; S82. Sort the starting coordinates of all coarse tick lines in the array; S83. Determine the range scale value corresponding to each coarse scale line.

8. The method for recognizing pointer meter readings with non-uniform scales as described in claim 1, characterized in that, Step S10 specifically includes the following steps: Determine the positional relationship between the pointer line and the coarse scale line; Based on the positional relationship, determine the coarse tick line that has the smallest distance from the pointer line in the Lines array; where Lines = {line1, line2, ..., line...} m In the array, the starting coordinates of the leftmost adjacent thick tick mark of each pointer line are L_start. L =(line_start_x L ,line_start_y L The corresponding range scale value is gt_value. L The starting coordinates of the rightmost adjacent thickest tick mark on the pointer line are determined to be L_start. R =(line_start_x R ,line_start_y R The corresponding range scale value is gt_value. R ; Create a first mask image with the same size as the pointer mask image and a pixel value of 0, and draw a first straight line in white on the first mask image; Create a second mask image with the same size as the pointer mask image and a pixel value of 0, and draw a second straight line in white on the second mask image; The first mask image and the second mask image are subjected to a pixel-wise logical AND operation to obtain a result image. The coordinates of the white pixels in the result image are the coordinates of the intersection point of the second line and the first line. The intersection point to L_start is calculated based on the following formula. L The Euclidean distance d_pL between points; Here, the starting coordinate of the first straight line is defined as L_start. L =(line_start_x L ,line_start_y L Let L_start be the coordinate of the endpoint of the first straight line. R =(line_start_x R ,line_start_y R The intersection point is defined as C_P, and C_P is preset to (cross_x, cross_y); L_start is calculated according to the following relationship (6). R and L_start L Euclidean distance d_RL; Calculate the pointer meter reading according to the following formula (7);

Citation Information

Patent Citations

  • Image-processing-based automatic reading number recognition method of pointer type instrument

    CN108460327A

  • Pointer instrument automatic reading method based on deep learning

    CN112949564A