A multi-dial and multi-pointer identification method for substations based on template matching

Through template matching and image processing technology, the problems of high cost and low accuracy in identifying multi-dial and multi-pointer instruments have been solved, and automatic and accurate identification of multi-dial and multi-pointer instruments in substations has been achieved, thereby improving recognition accuracy.

CN114863086BActive Publication Date: 2025-09-05TIANJIN UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210502443.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-09
Publication Date
2025-09-05
Estimated Expiration
2042-05-09

AI Technical Summary

Technical Problem

The existing technology for identifying multi-dial and multi-pointer instruments has the problems of high cost and low accuracy, and it is difficult to automatically and accurately identify the readings of multi-dial and multi-pointer instruments in substations.

Method used

A template matching-based method is adopted to obtain the substation dial image, establish a rectangular coordinate system, perform median filtering and template matching, divide the dial area, extract the area of ​​interest, use the HSV color model and Hough transform to detect the pointer coordinates, and calculate the pointer reading.

Benefits of technology

The recognition accuracy of multi-dial and multi-pointer instruments has been significantly improved, and the readings of multi-dial and multi-pointer instruments in substations can be automatically and accurately identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863086B_ABST
    Figure CN114863086B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for identifying multiple dials and multiple pointers in a substation based on template matching. The method comprises the following steps: obtaining an image of a dial in a substation to be read, establishing a rectangular coordinate system within the dial image according to preset rules; performing median filtering on the dial image; performing template matching on the median-filtered dial image, and dividing the dial image into various dial regions based on the template matching results; extracting regions of interest within each dial region; extracting the pointers within each region of interest using the HSV color model to obtain extracted images; detecting straight lines in each extracted image using a Hough transform to obtain the coordinates of the pointers within each region of interest; and identifying the pointer readings within each dial region based on the pointer coordinates. This method can automatically identify the readings of multi-dial, multi-pointer instruments in a substation, significantly improving the accuracy of pointer recognition for multi-dial, multi-pointer instruments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a multi-dial and multi-pointer recognition method for a substation based on template matching. Background Art

[0002] Computer vision is widely used in the security industry, web-based image and video processing, interactive gaming, and quality inspection for modern factories and products. Common methods for collecting device information include IoT sensor-based information collection and computer vision-based information collection. Computer vision-based information collection has gained recognition in the industry due to its advantages, such as eliminating the need for internal device access, ease of installation, and low cost. Pointer instrument recognition is a classic application of computer vision in the industrial field.

[0003] Existing research on pointer instrument recognition focuses on single-dial, single-pointer recognition, multi-dial, single-pointer recognition, and single-dial, multi-pointer recognition. However, relatively little research has been conducted on multi-dial, multi-pointer recognition. Manual reading of multi-dial, multi-pointer instruments has issues such as high cost and low accuracy.

[0004] Therefore, based on the existing pointer instrument recognition technology, how to improve the accuracy of dial positioning of multi-dial multi-pointer instruments and automatically and accurately identify the readings of multi-dial multi-pointer instruments has become an urgent problem that technical personnel in this field need to solve. Summary of the Invention

[0005] In view of the above problems, the present invention proposes a substation multi-dial multi-pointer identification method based on template matching that solves at least some of the above technical problems. This method can automatically and accurately identify the readings of multi-dial multi-pointer instruments in the substation.

[0006] The embodiment of the present invention provides a method for identifying multiple dials and multiple pointers in a substation based on template matching, comprising the following steps:

[0007] S1. Obtain a meter dial image in a substation to be read, establish a rectangular coordinate system in the meter dial image according to a preset rule, and perform median filtering on the meter dial image;

[0008] S2. Performing template matching on the dial image after median filtering, and dividing the dial image into various dial areas according to the template matching results;

[0009] S3, extracting the regions of interest within each dial area respectively; extracting the pointer within each region of interest using the HSV color model to obtain an extracted image;

[0010] S4. Detecting straight lines in each of the extracted images through Hough transform to obtain the coordinates of the pointer in each of the regions of interest; and identifying the readings of the pointer in each of the dial regions based on the coordinates of the pointer.

[0011] Furthermore, the step S2 includes:

[0012] S21, moving the preset template within the dial image after median filtering, performing standard deviation square sum matching, obtaining the maximum and minimum values ​​of the matching results; and obtaining the minimum coordinate and maximum coordinate corresponding to the minimum value;

[0013] S22. Locating the position of the feature point corresponding to the preset template in the dial image according to the minimum coordinate and the maximum coordinate;

[0014] S23 . Divide the dial image into various dial areas according to positions of the feature points in the dial image.

[0015] Furthermore, step S3 includes:

[0016] S31, extracting the regions of interest within each dial area, obtaining the borders of each dial, and setting the interior of the borders to the same identification color;

[0017] S32, extracting the pointers in each of the regions of interest using the HSV color model; eliminating non-pointer parts through a closing operation, and filling holes in the pointers to obtain an extracted image.

[0018] Furthermore, the step S3 further includes:

[0019] S33: Thinning the pointer region in the extracted image to obtain the skeleton of the image.

[0020] Furthermore, the closing operation includes:

[0021] Using a dilation operation to expand the pointer image in each of the regions of interest outward along the boundary through the dilation kernel, and adding new pixels at the edge of the pointer image;

[0022] An erosion operation is performed to cause each pointer image after the dilation operation to shrink inward along the boundary through an erosion core; the erosion core is a pixel block composed of n pixels; the pixel block contains a core; the erosion core moves at the edge of the pointer image to eliminate pixel points that overlap with the erosion core and do not cross the core.

[0023] Furthermore, the step S4 includes:

[0024] S41, determining a mapping relationship between a line in a Hough coordinate system and a point in a Cartesian coordinate system through a Hough transform, determining whether each point in the extracted image forms a line, and extracting the formed line;

[0025] S42, determining the coordinates of the pointers in each of the regions of interest according to the straight line;

[0026] S43. Calculate the slope, arctangent value, and angle of the pointer in sequence according to the coordinates of each pointer, and identify the pointer reading in each dial area.

[0027] Furthermore, the slope, arctangent value, and angle of the pointer are calculated in sequence using the following formulas to identify the pointer readings in each dial area:

[0028]

[0029] In the above formula, k is the slope of the line formed by the coordinates of the two end points of the pointer; (x1, y1) and (x2, y2) are the coordinates of the two ends of the pointer respectively; r is the arctangent of k; d is the angle of rotation of the pointer relative to the zero scale of the dial; a is the rotation angle when rotating counterclockwise from the rightmost scale of the dial to the zero scale of the dial; % is the remainder; max is the maximum value of the dial range; num is the final reading; and s is the maximum rotation angle of the pointer within the dial area.

[0030] Furthermore, if the maximum rotatable angle of the pointer in the dial area is less than 180 degrees, the reading of the pointer is the final reading.

[0031] Further, if the maximum rotatable angle of the pointer in the dial area is greater than or equal to 180 degrees;

[0032] When the pointer in the dial area points within the range of 0-180 degrees, the reading of the pointer is the final reading;

[0033] When the pointer in the dial area points outside the 0-180 degree range, the pointer reading is the sum of the final reading and half of the supplementary maximum range value; the supplementary maximum range value is the maximum value of the dial range when the maximum rotatable angle of the pointer in the dial area is increased to 360 degrees.

[0034] Furthermore, when there are multiple pointers in the same dial area, the length of each pointer is calculated according to the coordinates of the pointers in the dial area, and the different pointers in the dial area are distinguished according to the lengths of each pointer.

[0035] The beneficial effects of the above technical solutions provided by the embodiments of the present invention include at least:

[0036] An embodiment of the present invention provides a template matching-based method for identifying multiple dials and multiple pointers in a substation, including: obtaining an image of a dial within the substation to be read, establishing a rectangular coordinate system within the dial image according to preset rules; performing median filtering on the dial image; performing template matching on the median-filtered dial image, and dividing the dial image into various dial regions based on the template matching results; extracting regions of interest within each dial region; extracting the pointers within each region of interest using the HSV color model to obtain extracted images; detecting straight lines within each extracted image using a Hough transform to obtain the coordinates of the pointers within each region of interest; and identifying the pointer readings within each dial region based on the pointer coordinates. This method can automatically identify the readings of multi-dial, multi-pointer instruments within a substation, significantly improving the accuracy of pointer recognition for multi-dial, multi-pointer instruments.

[0037] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.

[0038] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0040] Figure 1 Flowchart of a method for identifying multiple dials and multiple pointers in a substation based on template matching provided by an embodiment of the present invention;

[0041] Figure 2 A flowchart provided for an embodiment of the present invention;

[0042] Figure 3 The original image of the image acquisition provided by the embodiment of the present invention;

[0043] Figure 4 A schematic diagram of the position of the semicircular arc template provided in an embodiment of the present invention;

[0044] Figure 5 A schematic diagram of the position of the upper pointer area in the figure provided in an embodiment of the present invention;

[0045] Figure 6 A schematic diagram of the position of the lower pointer area in the figure provided in an embodiment of the present invention;

[0046] Figure 7The upper pointer area diagram extracted by HSV provided in an embodiment of the present invention;

[0047] Figure 8 An upper pointer area image generated after a closing operation is performed according to an embodiment of the present invention;

[0048] Figure 9 The upper pointer area image after the thinning operation provided by the embodiment of the present invention;

[0049] Figure 10 A schematic diagram of the extraction result of the lower pointer region of interest provided by an embodiment of the present invention;

[0050] Figure 11 The image of the lower pointer region before the closing operation provided by the embodiment of the present invention;

[0051] Figure 12 The image of the lower pointer area after the closing operation provided by the embodiment of the present invention;

[0052] Figure 13 The image of the lower pointer area after the hole is filled provided by the embodiment of the present invention;

[0053] Figure 14 The image of the lower pointer area after the thinning operation provided by the embodiment of the present invention;

[0054] Figure 15 A schematic diagram of the Hough transform result of the lower pointer area provided by an embodiment of the present invention;

[0055] Figure 16 A schematic diagram of the dial structure that needs to be identified provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0056] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0057] The embodiment of the present invention provides a substation multi-dial multi-pointer identification method based on template matching, referring to Figure 1 As shown, the following steps are included:

[0058] S1. Obtain a meter dial image in a substation to be read, establish a rectangular coordinate system in the meter dial image according to a preset rule, and perform median filtering on the meter dial image;

[0059] S2. Perform template matching on the dial image after median filtering, and divide the dial image into various dial areas according to the template matching results;

[0060] S3, extracting the regions of interest in each dial area respectively; extracting the pointer in each region of interest using the HSV color model to obtain an extracted image;

[0061] S4. Detect straight lines in each extracted image through Hough transform to obtain the coordinates of the pointer in each region of interest; and identify the pointer reading in each dial region based on the coordinates of the pointer.

[0062] This embodiment can automatically and accurately identify the readings of multi-dial and multi-pointer instruments in the substation by processing the acquired dial images in the substation, thereby significantly improving the accuracy of dial positioning of the multi-dial and multi-pointer instruments.

[0063] The following describes in detail the substation multi-dial multi-pointer recognition method based on template matching through a specific embodiment:

[0064] Reference Figure 2 The following is a flow chart of the entire method. The dial image to be identified is generally captured by a camera. Figure 3 The image shown is the original image. This image is saved in PNG format during calculation. In this image, there are two dials. You need to read the pointer (the light yellow pointer) on the upper dial and the two pointers on the lower dial.

[0065] First, the acquired dial image is preprocessed. While preserving the original image information as much as possible, the image is smoothed to remove noise and reduce detail levels. Filters are the most common tool for image smoothing. By adjusting the filter parameters, the degree of image smoothing can be controlled. A median filter can be used to sort all pixel values ​​in the image, extract the middle pixel value, and assign it to the center pixel. The longer the filter kernel side length, the more blurred the processed image.

[0066] Secondly, through template matching, we select positioning points, divide the dial areas in the dial image, divide the multiple dials, and obtain the pointer readings in each dial. The template is the target image to be searched (i.e., the feature point), and template matching is to find the location of the template in the dial image. The feature in the dial image obtained here is the semicircular arc in the pointer area above, which is used as the preset template. The position of the semicircular arc template in the figure is as follows: Figure 4 shown.

[0067] During the template matching process, a preset template is moved within the dial image. The preset template is compared with each pixel within the overlapping area, and the results are stored in an array. In this embodiment, the template matching method used is cv2.TM_SQDIFF_NORMED, which is standard squared deviation matching, also known as standard squared difference matching. The higher the degree of match, the smaller the calculated result. A perfect match results in a value of 0. After template matching, the maximum and minimum values ​​of the matching result are obtained, as well as the minimum and maximum coordinates of the semicircular arc corresponding to the minimum value. This embodiment uses three coordinate systems: the original dial image coordinate system, the upper pointer area coordinate system, and the lower pointer area coordinate system. Their origins are the upper left corner of each area, with the positive x-axis pointing rightward and the positive y-axis pointing downward. The coordinate system used for template matching is created based on the original dial image, with the coordinate origin being the upper left corner of the original image. After template matching, two regions of interest are obtained: the upper pointer area and the lower pointer area. The upper pointer area and the lower pointer area are each extracted as a new image, with the coordinate origin being the upper left corner of each new image. Cutting out the region of interest and performing separate operations prevents the background from affecting the extraction pointer operation. Although three coordinate systems are established separately, they have no effect on the final reading results.

[0068] In the previous template matching step, the minimum and maximum coordinates of the semicircle arc are obtained. The difference between the maximum and minimum coordinates is calculated to get the length and width of the semicircle arc. Based on the minimum coordinates and length and width of the semicircle arc feature, the upper pointer area and the lower pointer area can be located. The position of the upper pointer area in the figure is as follows: Figure 5 As shown, the position of the lower pointer area in the figure is as follows Figure 6 shown.

[0069] Get the pointer reading within the upper pointer area:

[0070] In the upper pointer area (the pointer area on the upper dial), there are three standard lines: green, yellow, and red. The pointer value range is [0, 3]. The pointer color is light yellow. You can extract the light yellow area by adjusting the HSV value range and isolate the light yellow pointer area. HSV (Hue, Saturation, Value) is a color representation method created by AR Smith in 1978 based on the intuitive characteristics of color. The HSV color space is constructed based on hue, saturation, and brightness. Hue (H) refers to the color of light and has a value range of [0, 180]. For example, the hue of red is 0, the hue of yellow is 30, the hue of green is 60, and the hue of blue is 120. Saturation (S) refers to the depth of the color. The saturation value range is [0, 255]. For example, when the saturation is 0, the image will be converted to a grayscale image. Brightness (V) refers to the brightness of the light. Like saturation, the brightness value range is [0, 255]. The larger the brightness value, the brighter the image. For example, when the brightness is 0, the image is pure black. By adjusting the HSV value range, we finally get a light yellow pointer in the upper pointer area, such as Figure 7 shown.

[0071] A closing operation eliminates details within the pointer image to facilitate subsequent accurate readings. Erosion and dilation operations can be used to remove or enhance image details. A closing operation involves first dilating the pointer image and then eroding it. The dilation operation expands the pointer image outward along its boundaries. This operation is performed using a kernel (dilation kernel). As the kernel moves along the edge of the image, it adds new pixels. The dilation operation can magnify some external details in the pointer image. A larger kernel number produces a coarser result; conversely, a smaller kernel number produces a finer result.

[0072] The erosion operation, the opposite of the dilation operation, shrinks the pointer image inward along its boundaries. This shrinkage is achieved using a kernel (the erosion kernel), which is a block of n pixels containing a kernel (usually located at the center). The kernel moves along the edge of the pointer image, removing pixels that overlap the kernel but do not extend beyond the kernel. Erosion can remove some of the outer details of the pointer image. A larger kernel number results in a coarser result, while a smaller kernel number results in a finer result.

[0073] After obtaining the pointer image through the HSV color model in the previous step, due to the similar colors of the yellow standard line and the light yellow pointer, mis-extraction may occur. This requires a closing operation to make adjustments. Figure 8As shown, the pointer image generated after the closing operation is compared with the pointer image before the closing operation. After the closing operation, the non-pointer part is eliminated and the holes in the pointer are filled.

[0074] Since the pointer area is relatively rough, it is necessary to use the skeleton extraction function Skeletonize() in the morphology submodule of the skimage library to refine the pointer area to obtain the skeleton of the image, thereby improving the accuracy of the reading. Refining the pointer image after the closing operation refers to the skeletonization of the binary image. After layer-by-layer peeling, some points are removed from the pointer image, but the original shape of the image is still maintained until the skeleton of the image, that is, the central axis of the image, is obtained. After the thinning operation, Figure 9 shown.

[0075] The Hough transform is used to detect straight lines in the pointer image after the thinning operation and obtain the pointer's coordinates. The Hough transform is a feature detection algorithm that uses algorithms to identify image features and thus determine specific shapes within the image. The mapping relationship between lines in the Hough coordinate system and points in the Cartesian coordinate system is used to determine whether points in the image form a straight line. Using the Hough transform to detect straight lines in the image, the coordinates of the line are obtained, which are also the coordinates of the pointer.

[0076] After a Hough transform, the coordinates of the pointer are obtained (x1, y1) and (x2, y2). The origin of the coordinate system is located in the upper left corner of the image, the horizontal axis is the x-axis, and the rightward direction is the positive x-axis direction, and the vertical axis is the y-axis, and the downward direction is the positive y-axis direction. Calculating the slope k, the arctangent value r, and the angle d ultimately gives the pointer reading num. The specific formula is as follows:

[0077]

[0078] In formula (1), x1, y1, x2, and y2 are the coordinates obtained by Hough transform, k is equal to the difference between y2 and y1 divided by the difference between x2 and x1, and k represents the slope of the straight line formed by the coordinates of the two end points of the pointer. In formula (2), r is the arctangent function value of k, which represents the arctangent value of k. In formula (3), d is equal to r multiplied by 180 divided by π, and d represents the angle of rotation of the pointer relative to the zero scale of the dial; a represents the rotation angle when rotating counterclockwise from the rightmost scale of the dial to the zero scale of the dial; % represents the remainder, the purpose of which is to keep the range of d between 0 and 180; s represents the maximum rotatable angle of the pointer in the dial area, and in this case, it is 180. If d is calculated to be a negative number, 180 needs to be added to d. In this embodiment, when the light yellow pointer in the upper area points to the interval of 1.5-3, d will have a negative value. At this time, 180 needs to be added to d and then assigned to d. In formula (4), num represents the final reading (the pointer reading), and max represents the maximum value of the dial range. In the upper pointer area, max is 3. num equals max multiplied by d divided by 180. The final num reading is the pointer reading.

[0079] Optionally, if the maximum rotatable angle of the pointer in the dial area is less than 180 degrees, the pointer reading is the final reading.

[0080] If the maximum rotatable angle of the pointer in the dial area is greater than or equal to 180 degrees, the readings conflict and the pointer position needs to be determined; when the pointer points within the dial area within the 0-180 degree range, the pointer reading is the final reading; when the pointer points outside the 0-180 degree range, the pointer reading is the final reading plus half of the completed maximum range value; the completed maximum range value is the maximum value of the dial range when the maximum rotatable angle of the pointer in the dial area is increased to 360 degrees, that is, the maximum reading that the dial can reach when the 360-degree dial is completed.

[0081] Specifically, if the maximum rotation angle of the upper pointer dial is 360 degrees and the maximum range is 6, the denominator of the calculated num needs to be adjusted to 360; at the same time, it is necessary to determine whether the center of the pointer is above or below the dial. If it is above the dial, the reading remains unchanged; if it is below the dial, the final reading needs to be increased by 3.

[0082] Get the pointer reading within the lower pointer area:

[0083] Reference Figure 6 As shown in the figure, in the lower pointer area (the pointer area of ​​the lower dial), there are two pointers, one long and one short. The value range of this instrument is [0, 10]. Detect all contours in the lower pointer area and find the contour with the largest area, which is the instrument (dial) border. Set its interior to white. This extracts the region of interest and reduces the impact of the instrument border on subsequent operations. The result of the region of interest extraction is shown in the figure. Figure 10 shown.

[0084] Through the closing operation, some details outside the pointer are removed, such as scales, numbers and Chinese characters. In the end, only the pointer area is retained. Figure 11 As shown, after the closing operation, Figure 12 shown.

[0085] After the closing operation, there are holes inside the pointer and in the center of the dial. In order to avoid the influence of these holes on subsequent operations, hole filling is used to fill these holes. The hole filling results are as follows: Figure 13 As shown in the figure, the refinement of the lower pointer area is the same as that of the upper pointer area. The purpose is to obtain the skeleton of the image and improve the reading accuracy. Figure 14 shown.

[0086] The Hough transform of the lower pointer area is similar to that of the upper pointer area. After Hough transform, two lines are obtained, namely two pointers. The Hough transform result is as follows Figure 15 shown.

[0087] The readings in the lower pointer area are similar to those in the upper pointer area. First, calculate equations (1), (2), and (3). Because the zero scale of the lower pointer dial is directly above, while the zero scale of the upper pointer dial is on the left, when the zero scale is converted from the left to the top, it is necessary to rotate 90 degrees counterclockwise (the rotation angle from the rightmost scale of the dial to the current zero scale of the dial counterclockwise). Therefore, 90 needs to be added to d before assigning it to d. Then calculate equation (4). Because the maximum value of the scale of the lower pointer dial is 10, the max in equation (4) is modified to 10. The maximum rotation angle of the lower pointer is 360 degrees, so the denominator 180 is modified to 360. However, in a 360-degree pointer, pointers with the same angle have the same readings. For example, when the lower pointer reads 2 and 7, their angles are the same. At this time, it is necessary to determine whether it belongs to 2 or 7. By determining the position of the midpoint of the pointer in the lower dial relative to the center axis of the dial, it is determined whether the midpoint of the pointer belongs to the left or right. If the midpoint of the pointer is on the right side (to the right of the central axis), add 5 (half the maximum value of the dial range) to the final num and assign it to num. If the midpoint of the pointer is on the left side (to the left of the central axis), num remains unchanged. The final num is the pointer reading.

[0088] By calculating the length of each pointer, we can distinguish the different pointers in the dial area below:

[0089]

[0090] Where, Equation (5) is the distance formula between two points, and dst is equal to the square root of the difference between x2 and x1 plus the square root of the difference between y2 and y1. (x1, y1) and (x2, y2) represent the coordinates of the two ends of the pointer, respectively. Calculate the length and reading of these two lines (representing the two pointers). If the length is greater than the set threshold, set the label to "long", otherwise, set the label to "short", and store the reading and label in an array. The reading labeled "long" corresponds to the reading of the long pointer, and the reading labeled "short" corresponds to the reading of the short pointer.

[0091] Optionally, when identifying Figure 16 For the dial pointer shown, according to formulas (1)-(4), a is 225, and the dial needs to rotate 225 degrees counterclockwise from the rightmost scale to the zero scale. Max is 6, and the maximum range is 6. S is 270, and the pointer can rotate 270 degrees. Because the readings conflict when the pointer is in the 0-90 degree range and the 180-270 degree range, the readings do not conflict when the pointer is in the 90-180 degree range. Determine whether the pointer is in the 0-90 degree range or the 180-270 degree range, that is, determine whether the center of the pointer is on the left or right side of the dial. If the pointer is within the 0-90 degree range, the final reading remains unchanged; if the pointer is within the 90-180 degree range, there is no conflict in the reading, so the final reading remains unchanged; if the pointer is between 180-270 degrees, the reading at this time conflicts with the reading of the pointer in the 0-90 degree range, then 4 needs to be added to the final reading, that is, when the maximum rotatable angle of the pointer is completed to 360 degrees, the maximum value of the dial range (maximum reading) is 8, half of which is 4.

[0092] Finally, the accuracy of the substation multi-dial multi-pointer recognition method based on template matching is verified through experiments:

[0093] Using the PyCharm development environment, the core image processing method uses OpenCV library functions to achieve automatic reading of multi-dial, multi-pointer instruments. The experimental data comes from six images taken in real scenes with the pointer in different positions. The operations described in the above method are performed on these six experimental data.

[0094] The actual values ​​in the following table are obtained by averaging the readings taken by 10 staff members. The experimental results for the upper pointer area are shown in Table 1, the long pointer experimental results for the lower pointer area are shown in Table 2, and the short pointer experimental results for the lower pointer area are shown in Table 3.

[0095] Table 1 Experimental results of the upper pointer area

[0096]

[0097] Table 2 Experimental results of long pointer in the lower pointer area

[0098] Serial number True value Automatic reading Absolute error Accuracy 1 7.68 7.64 0.04 99.60% 2 7.08 6.95 0.13 98.70% 3 8.22 8.10 0.12 98.80% 4 2.85 2.89 0.04 99.60% 5 2.85 2.86 0.01 99.90% 6 8.80 8.70 0.10 99.00%

[0099] Table 3 Short pointer experiment results in the lower pointer area

[0100]

[0101]

[0102] As can be seen from Tables 1, 2, and 3 above, the absolute errors in the upper pointer region are all less than 0.1 mA, and the accuracy rates are all greater than 97%. The absolute errors in the lower pointer region are all less than 0.15, and the accuracy rates are all greater than 98%. This demonstrates that the method provided in this embodiment has excellent performance, high precision, and good automatic reading performance. This method can more accurately extract the edge image of the dial pointer in a substation, has strong anti-interference capabilities, high precision, and fast operation, and has considerable promotional value.

[0103] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A multi-dial multi-pointer identification method for a substation based on template matching, characterized in that: It is used to identify multiple dials and multiple pointers in a single instrument, including the following steps: S1. Obtain a dial image in a substation to be read, establish a rectangular coordinate system in the dial image according to a preset rule, and perform median filtering on the dial image; S2. Performing template matching on the dial image after median filtering, and dividing the dial image into various dial areas according to the template matching results; S3, extracting the regions of interest within each of the dial areas respectively; Extracting the pointers in each of the regions of interest using the HSV color model to obtain an extracted image; S4, detecting straight lines in each of the extracted images through Hough transform, and obtaining the coordinates of the pointer in each of the regions of interest; Identifying the pointer readings in each of the dial areas according to the coordinates of the pointer; The step S2 comprises: S21, moving the preset template within the dial image after median filtering, performing standard deviation square sum matching, obtaining the maximum and minimum values ​​of the matching results; and obtaining the minimum coordinate and maximum coordinate corresponding to the minimum value; S22. Locating the position of the feature point corresponding to the preset template in the dial image according to the minimum coordinate and the maximum coordinate; S23, dividing the dial image into various dial areas according to the positions of the feature points in the dial image; The step S3 comprises: S31, extracting the regions of interest within each dial area, obtaining the borders of each dial, and setting the interior of the borders to the same identification color; S32, extracting the pointers within each of the regions of interest using the HSV color model; eliminating non-pointer parts through a closing operation, and filling holes within the pointers to obtain an extracted image; The closing operation includes: Using a dilation operation to expand the pointer image in each of the regions of interest outward along the boundary through the dilation kernel, and adding new pixels at the edge of the pointer image; Using an erosion operation to shrink each pointer image after the dilation operation inward along the boundary through an erosion core; the erosion core is a pixel block consisting of n pixels; the pixel block contains a core; the erosion core moves along the edge of the pointer image to eliminate pixel points that overlap with the erosion core and do not cross the core; The step S4 comprises: S41, determining a mapping relationship between a line in a Hough coordinate system and a point in a Cartesian coordinate system through a Hough transform, determining whether each point in the extracted image forms a line, and extracting the formed line; S42, determining the coordinates of the pointers in each of the regions of interest according to the straight line; S43, calculating the slope, arctangent value, and angle of each pointer in sequence according to the coordinates of each pointer, and identifying the pointer reading in each dial area; The slope, arctangent value, and angle of the pointer are calculated in sequence using the following formulas to identify the pointer readings in each dial area: In the above formula, k represents the slope of the line formed by the coordinates of the two end points of the pointer; (x1, y1) and (x2, y2) represent the coordinates of the two end points of the pointer respectively; r represents the arctangent value of k; d represents the angle of rotation of the pointer relative to the zero scale of the dial; a represents the rotation angle when rotating counterclockwise from the rightmost scale of the dial to the zero scale of the dial; % represents the remainder; max represents the maximum value of the dial range; num represents the final reading; and s represents the maximum rotation angle of the pointer within the dial area. When there are multiple pointers in the same dial area, the length of each pointer is calculated according to the coordinates of the pointers in the dial area, and the different pointers in the dial area are distinguished according to the lengths of each pointer. The calculation formula is: Where dst is the distance between the two points, (x1, y1) and (x2, y2) represent the coordinates of the two ends of the pointer, respectively. If the distance is greater than the set threshold, the label is set to "long", otherwise, the label is set to "short". The readings and labels are stored in an array. Readings labeled "long" correspond to readings of the long pointer, and readings labeled "short" correspond to readings of the short pointer.

2. The template matching-based multi-dial multi-pointer identification method for a substation according to claim 1, characterized in that: The step S3 further includes: S33: Thinning the pointer region in the extracted image to obtain the skeleton of the image.

3. The template matching-based multi-dial multi-pointer identification method for a substation according to claim 1, characterized in that: If the maximum rotatable angle of the pointer in the dial area is less than 180 degrees, the reading of the pointer is the final reading.

4. The method for identifying multiple dials and multiple pointers in a substation based on template matching according to claim 1, characterized in that: If the maximum rotatable angle of the pointer in the dial area is greater than or equal to 180 degrees; When the pointer in the dial area points within the range of 0-180 degrees, the reading of the pointer is the final reading; When the pointer in the dial area points outside the 0-180 degree range, the pointer reading is the sum of the final reading and half of the supplementary maximum range value; the supplementary maximum range value is the maximum value of the dial range when the maximum rotatable angle of the pointer in the dial area is increased to 360 degrees.

Citation Information

Patent Citations

  • Automatic reading method of multi-dial-plate pointer instrument

    CN108256524A

  • Intelligent identification system for fire extinguisher pointer type instrument

    CN111666880A