A visual recognition-based electrical measuring instrument detection method

By preprocessing and edge point detection of electrical measuring instrument images, the scale and pointer endpoints are identified, solving the problems of inconsistent lengths and overlaps in instrument detection and improving detection accuracy.

CN117612187BActive Publication Date: 2026-07-24STATE GRID FUJIAN ELECTRIC POWER CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
STATE GRID FUJIAN ELECTRIC POWER CO LTD
Filing Date
2023-11-30
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In existing electrical measuring instrument testing methods based on neural network algorithms, the inconsistency in length and width between the instrument scale and pointer leads to insufficient detection accuracy, and pixel overlap between the pointer and scale is prone to occur, affecting detection accuracy.

Method used

By acquiring and preprocessing images of electrical measuring instruments, detecting image edge points, calculating the center coordinates and corner coordinates of edge point groups, identifying scale distribution, extracting the instrument center and pointer endpoints, and combining character markings and pointer length and length detection, the scale measurement value is calculated.

Benefits of technology

It improves the accuracy of electrical measuring instrument testing, avoids testing errors caused by pointer and scale overlap, and ensures the accuracy of scale and pointer position identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117612187B_ABST
    Figure CN117612187B_ABST
Patent Text Reader

Abstract

The application relates to a kind of electrical measuring instrument detection methods based on visual recognition, comprising the following steps: detecting image edge point in pre-processing image, calculating the center coordinates of image edge point, identifying the corner point coordinates of image edge point using center coordinates, determine the instrument scale distribution in pre-processing image using corner point coordinates;Detect the character mark in pre-processing image, identify the starting scale in instrument scale distribution;Detect the center of the instrument in pre-processing image, extract the pixel point area in pre-processing image across the center of the instrument, obtain the target pixel point area;Determine the short end of the pointer in the target pixel point area using the center of the instrument, determine the long end of the pointer in the target pixel point area using the short end of the pointer and the center of the instrument;Determine the scale measurement value of the long end of the pointer based on the instrument scale distribution and the starting scale, and take the scale measurement value as the detection result of the electrical measuring instrument.The application can improve the detection accuracy of electrical measuring instrument.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for detecting electrical measuring instruments based on visual recognition, belonging to the field of image processing and computing. Background Technology

[0002] The process of visual recognition-based electrical measuring instrument inspection refers to the process of recognizing the image of an electrical measuring instrument in order to determine the measurement data in the instrument.

[0003] Currently, the technology of using neural network algorithms for instrument scale detection is becoming increasingly mature. However, neural network algorithms still have the following shortcomings in the instrument scale detection process: First, the length and width of the scale and pointer in the instrument are not uniform, which makes the scale and pointer appear as rectangular boxes or pixel areas in the image. Therefore, directly detecting straight line segments in the image and using them as scale and pointer will result in the detected straight line segments only being the boundaries of the scale or pointer. Second, because the pointer is too long, it will overlap with the scale at the pixel level. This leads to insufficient accuracy in directly detecting the endpoint coordinates of the pointer and using the endpoint coordinates as the pointer's direction on the scale. Therefore, the accuracy of electrical measuring instrument detection based on vision recognition is insufficient. Summary of the Invention

[0004] To address the problems existing in the prior art, this invention proposes a method for detecting electrical measuring instruments based on visual recognition.

[0005] The technical solution of the present invention is as follows: On one hand, the present invention provides a method for detecting electrical measuring instruments based on visual recognition, comprising the following steps: Acquire images from electrical measuring instruments and preprocess the images; The edge points of the preprocessed electrical measuring instrument image are detected, the image edge point group is determined by the image edge points, and the center coordinates of the image edge point group are calculated. The corner coordinates of the image edge point group are identified by the center coordinates of the image edge point group, and the scale distribution of the instrument in the image is determined by the corner coordinates of the image edge point group. The system detects characters in the preprocessed image of electrical measuring instruments and marks each character, then identifies the starting scale in the instrument scale distribution based on the character markings. The center of the instrument is detected in the preprocessed image of the electrical measuring instrument, and the pixel area passing through the center of the instrument is extracted. This area is then merged with the center of the instrument to form the target pixel area. Based on the instrument center detecting the short end of the pointer in the target pixel area, the long end of the pointer in the target pixel area is then determined through the short end of the pointer; Finally, the scale measurement value is obtained by analyzing the scale distribution of the instrument, the starting scale of the instrument, and the pointing position of the long end of the pointer in the preprocessed electrical measuring instrument image, and the measurement value is used as the test result of the electrical measuring instrument.

[0006] In a preferred embodiment of the present invention, the edge point detection step of the preprocessed electrical measuring instrument image is as follows: First, the image gradient of the preprocessed electrical measuring instrument image is calculated using the following formula. : in: This is the horizontal filtering result of the preprocessed electrical measuring instrument image; The result of vertical filtering of the preprocessed electrical measuring instrument image; Indicates a preprocessed image; , These represent the x and y coordinates of a pixel in the preprocessed image of the electrical measuring instrument, respectively. The image gradient direction of the preprocessed electrical measuring instrument image is then calculated using the following formula. : Extract each pixel and its neighboring pixels from the preprocessed electrical measuring instrument image. Then, query the gradient and gradient direction of each pixel, as well as the gradient and gradient direction of its neighboring pixels, in the image gradient and image gradient direction of the preprocessed electrical measuring instrument image. When the gradient direction of any pixel is the same as the gradient direction of its neighboring pixels, it is checked whether the gradient of the pixel is greater than the gradient of its neighboring pixels. If the gradient of the pixel is greater than the gradient of its neighboring pixels, the pixel is regarded as an image edge point.

[0007] In a preferred embodiment of the present invention, the step of calculating the center coordinates of the image edge point group is as follows: Calculate the shortest distance between every two image edge points, determine the group of image edge points based on the shortest distance, and then calculate the center coordinates of the group of image edge points using the following formula: in: The x-coordinate of the center coordinates of the group of edge points in the image; The ordinate is the center coordinate of the group of edge points in the image; The first in the image edge point group The x-coordinates of the image edge points; The first in the image edge point group The ordinates of the image edge points; This represents the number of image edge points in the image edge point group.

[0008] In a preferred embodiment of the present invention, the corner coordinate identification step in the image edge point group is as follows: Obtain the center coordinates of a group of image edge points and their corresponding image edge points; Calculate the coordinates of the center point of the image edge point group and the Euclidean distance between the center point and each image edge point in the image edge point group; The image edge point with the largest Euclidean distance from the center coordinates of the image edge point group is selected as the corner coordinates of the image edge point group; The steps for identifying the scale distribution of instruments in the preprocessed electrical measuring instrument image are as follows: The width and length of each mark of the instrument in the preprocessed image of the electrical measuring instrument are determined by the corner coordinates of the edge point group of the image. Multiple types of mark widths and lengths are preset. When the width and length of a mark match any of the preset mark widths and lengths, the mark type is determined based on the width and length of the mark. Then, the relative position of each mark of the corresponding type is determined by the corner coordinates, and the first instrument scale distribution is constructed based on the relative position of each mark of that type; When the width and length of the mark determined by the corner coordinates do not conform to the preset mark width and length, the width and length of the neighboring marks of each mark are obtained, and the mark is corrected according to the width and length of the neighboring marks to obtain the corrected mark width and length. Then, the second instrument scale distribution is constructed based on all the corrected mark widths and lengths.

[0009] In a preferred embodiment of the present invention, the character marking step in the preprocessed electrical measuring instrument image is as follows: Identify character regions in preprocessed electrical measuring instrument images and identify the character structures within those regions; The character region is segmented to obtain segmented regions, and then the character structure within the character region is segmented to obtain segmented structures; The segmented regions are matched with the segmented structures to obtain region-structure matching pairs; Then, the direction of the corresponding character is determined by region-structure matching, and the character direction is used as the marker of the character; The starting scale identification step in the instrument scale distribution is as follows: determine the direction of the instrument by character markings, and match the instrument's scale distribution with the standard scale distribution of the instrument in the corresponding direction to obtain the instrument's starting scale and ending scale.

[0010] In a preferred embodiment of the present invention, the detection step of the instrument center in the preprocessed electrical measuring instrument image is as follows: Based on the constructed instrument scale distribution, each mark in the instrument scale distribution is marked with a rectangle; Extend each rectangular frame mark infinitely along its length to obtain extended rectangular frame marks; Finally, the center of the instrument is obtained by the intersection of each extended rectangular frame mark.

[0011] In a preferred embodiment of the present invention, the short-end detection step of the instrument pointer is as follows: In the target pixel area, construct straight lines passing through the center of the instrument by passing through the pixels that pass through the center, and obtain multiple straight lines passing through the center. Calculate the distances from the two endpoints of each straight line passing through the center to the center of the instrument, and obtain the distances from the first endpoint to the center and the second endpoint to the center for each straight line passing through the center. When the distance from the first endpoint to the center and the distance from the second endpoint to the center of any straight line passing through the center are the same, the straight line passing through the center is taken as the first target line, and a straight line passing through the center perpendicular to the first target line is obtained, and the straight line passing through the center is taken as the second target line. Finally, the endpoint that is closest to the center of the instrument among the two endpoints of the second target line is taken as the short end of the pointer.

[0012] In a preferred embodiment of the present invention, the long end detection step of the instrument pointer is as follows: Construct a Cartesian coordinate system through the center of the instrument, and calculate the coordinates of the longer end of the instrument pointer based on the Cartesian coordinate system using the following formula: in: Indicates the coordinates of the longer end of the instrument pointer; This represents the x-coordinate of the short end of the instrument pointer in a rectangular coordinate system. The ordinate of the short end of the instrument pointer in a rectangular coordinate system; Indicates the length of the long end of the pointer with the center of the instrument as the dividing point; Finally, the coordinate region of the long end of the instrument pointer is taken as the long end of the pointer.

[0013] In a preferred embodiment of the present invention, the calculation steps for the scale measurement value are as follows: When the long end pixel of the instrument pointer overlaps with any mark pixel in the instrument scale distribution, that mark is obtained as the overlapping mark; Calculate the offset of the overlapping mark from the starting mark in the instrument scale distribution, and use this offset as the scale measurement value; When the long end pixel of the instrument pointer does not overlap with any of the scale pixels in the instrument scale distribution, the scale measurement value is calculated using the following formula: in: These are scale measurement values; This represents the number of marks traversed from the initial mark to the current position pointed to by the long end of the pointer; This indicates the number of unit scale divisions between the current position pointed to by the long end of the pointer and the starting scale; The scale is in units.

[0014] On the other hand, the present invention also provides an electrical measuring instrument detection device based on visual recognition, including an image preprocessing module, a distribution determination module, a scale recognition module, a region extraction module, a long end determination module, and a measurement determination module; The image preprocessing module is used to acquire images from electrical measuring instruments and preprocess the images; The distribution determination module is used to detect edge points of the preprocessed electrical measuring instrument image, determine the image edge point group by the image edge points and calculate the center coordinates of the image edge point group, identify the corner coordinates of the image edge point group by the center coordinates of the image edge point group, and then determine the scale distribution of the instrument in the image by the corner coordinates of the image edge point group. The scale recognition module is used to detect characters in the preprocessed image of the electrical measuring instrument and mark each character, and recognize the starting scale in the scale distribution of the instrument based on the character marks; The region extraction module is used to detect the center of the instrument in the preprocessed electrical measuring instrument image, extract the pixel region passing through the center of the instrument in the image, and merge the region with the center of the instrument into the target pixel region; The long end determination module is used to determine the long end of the pointer in the target pixel area based on the short end of the pointer detected at the center of the instrument; The measurement determination module uses the scale distribution of the instrument, the starting scale of the instrument, and the pointing position of the long end of the pointer in the preprocessed electrical measuring instrument image obtained by the above module to obtain the scale measurement value, and uses the measurement value as the detection result of the electrical measuring instrument.

[0015] The present invention has the following beneficial effects: This invention proposes a vision-based electrical measuring instrument detection and device, which avoids the problems of inconsistent length and width between the scale and pointer in the table, and insufficient recognition accuracy caused by pixel overlap between the pointer and the scale due to the pointer being too long. This improves the detection accuracy of vision-based electrical measuring instruments. Attached Figure Description

[0016] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a schematic diagram illustrating the types and relative positions of markings in an embodiment of the present invention; Figure 3 This is a schematic diagram of character tag detection in an embodiment of the present invention; Figure 4 This is a diagram showing the positional relationship between the short end and the long end of the pointer in an embodiment of the present invention; Figure 5 This is a schematic diagram of the device module of the present invention; Figure 6 This is a schematic diagram of the internal structure of the electronic device in an embodiment of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.

[0019] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0020] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0021] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.

[0022] Example 1: See Figure 1 A method for detecting electrical measuring instruments based on visual recognition includes the following steps: Acquire images from electrical measuring instruments and preprocess the images; The edge points of the preprocessed electrical measuring instrument image are detected, the image edge point group is determined by the image edge points, and the center coordinates of the image edge point group are calculated. The corner coordinates of the image edge point group are identified by the center coordinates of the image edge point group, and the scale distribution of the instrument in the image is determined by the corner coordinates of the image edge point group. The system detects characters in the preprocessed image of electrical measuring instruments and marks each character, then identifies the starting scale in the instrument scale distribution based on the character markings. The center of the instrument is detected in the preprocessed image of the electrical measuring instrument, and the pixel area passing through the center of the instrument is extracted. This area is then merged with the center of the instrument to form the target pixel area. Based on the instrument center detecting the short end of the pointer in the target pixel area, the long end of the pointer in the target pixel area is then determined through the short end of the pointer; Finally, the scale measurement value is obtained by analyzing the scale distribution of the instrument, the starting scale of the instrument, and the pointing position of the long end of the pointer in the preprocessed electrical measuring instrument image, and the measurement value is used as the test result of the electrical measuring instrument.

[0023] In this embodiment, the image refers to a frontal image of an electrical measuring instrument captured by a camera. The preprocessing steps for the image of the electrical measuring instrument include: The image is converted to grayscale to obtain a grayscale image; the grayscale image is then subjected to image smoothing filtering to obtain a smoothed image; the smoothed image is then binarized to obtain the preprocessed image. Optionally, the process of performing image smoothing filtering on the grayscale image to obtain a smoothed filtered image involves replacing the value of each pixel in the image with the average grayscale value of the pixels in the neighborhood determined by the filter template; the process of performing image binarization on the smoothed filtered image to obtain the preprocessed image involves setting the grayscale value of pixels greater than a certain critical grayscale value as the grayscale maximum value and setting the grayscale value of pixels less than this value as the grayscale minimum value, thereby achieving binarization.

[0024] This embodiment converts a color image to a grayscale image, performs noise filtering on the image, and binarizes the image. This reduces the amount of image data, simplifies the image, and highlights the outlines of areas of interest such as scale lines and pointers.

[0025] In a preferred embodiment of this example, the edge point detection step of the preprocessed electrical measuring instrument image is as follows: First, the image gradient of the preprocessed electrical measuring instrument image is calculated using the following formula. : in: This is the horizontal filtering result of the preprocessed electrical measuring instrument image; The result of vertical filtering of the preprocessed electrical measuring instrument image; Indicates a preprocessed image; , These represent the x and y coordinates of a pixel in the preprocessed image of the electrical measuring instrument, respectively. The image gradient direction of the preprocessed electrical measuring instrument image is then calculated using the following formula. : Extract each pixel and its neighboring pixels from the preprocessed electrical measuring instrument image. Then, query the gradient and gradient direction of each pixel, as well as the gradient and gradient direction of its neighboring pixels, in the image gradient and image gradient direction of the preprocessed electrical measuring instrument image. When the gradient direction of any pixel is the same as the gradient direction of its neighboring pixels, it is checked whether the gradient of the pixel is greater than the gradient of its neighboring pixels. If the gradient of the pixel is greater than the gradient of its neighboring pixels, the pixel is regarded as an image edge point.

[0026] In a preferred embodiment of this invention, the center coordinates of the image edge points are calculated to determine the center of the rectangle formed by the image edge points. Calculate the shortest distance between every two image edge points, determine the group of image edge points based on the shortest distance, and then calculate the center coordinates of the group of image edge points using the following formula: in: The x-coordinate of the center coordinates of the group of edge points in the image; The ordinate is the center coordinate of the group of edge points in the image; The first in the image edge point group The x-coordinates of the image edge points; The first in the image edge point group The ordinates of the image edge points; This represents the number of image edge points in the image edge point group.

[0027] In a preferred embodiment of this example, the center coordinates are used to identify the corner coordinates of the image edge points in order to determine the coordinates of the four corner points of the rectangle formed by the image edge points. This allows us to know the length, width, and position of the rectangle. The corner coordinate identification steps are as follows: Obtain the center coordinates of a group of image edge points and their corresponding image edge points; Calculate the coordinates of the center point of the image edge point group and the Euclidean distance between the center point and each image edge point in the image edge point group; The image edge point with the largest Euclidean distance from the center coordinates of the image edge point group is selected as the corner coordinates of the image edge point group; The distribution of instrument scales in the preprocessed image is determined using the corner coordinates. This allows the system to identify the position of the scales in the current image when the image undergoes position shifts or rotations, i.e., the distribution position from the start scale to the end scale. Furthermore, when the scales and pointers overlap, making it impossible to distinguish the width and length of the scales, the system can determine the type and distribution position of the unidentifiable scales.

[0028] The steps for identifying the scale distribution of the instrument in the image are as follows: The width and length of each mark of the instrument in the preprocessed image of the electrical measuring instrument are determined by the corner coordinates of the edge point group of the image. Multiple types of mark widths and lengths are preset. When the width and length of a mark match any of the preset mark widths and lengths, the mark type is determined based on the width and length of the mark. Then, the relative position of each mark of the corresponding type is determined by the corner coordinates, and the first instrument scale distribution is constructed based on the relative position of each mark of that type; When the width and length of the mark determined by the corner coordinates do not conform to the preset mark width and length, the width and length of the mark in the neighborhood of each mark are obtained, and the mark is corrected according to the width and length of the neighborhood mark to obtain the corrected mark width and length. Then, the second instrument scale distribution is constructed based on all the corrected mark widths and lengths. See Figure 2 The marking categories include three types: medium, long, and short markings. The process of correcting the mark width and mark length using the mark width and mark length is as follows: Query the area of ​​the mark width and the mark length to find rectangles that meet the preset width and the preset length. Use the type of these rectangles to determine the type of the mark that cannot be distinguished at present, and use the distance (relative position) between these rectangles to determine the position of the mark that cannot be distinguished at present.

[0029] In a preferred embodiment of this embodiment, the character markers in the preprocessed image are detected to determine the left, right, up, and down directions of the current dial based on the direction of the character content on the dial. This allows the detected dial scale distribution to correspond to the scale distribution of a standard dial, thus enabling the identification of the start and end scales on the dial. The steps for marking characters in the image are as follows: Identify character regions in preprocessed electrical measuring instrument images and identify the character structures within those regions; The character region is segmented to obtain segmented regions, and then the character structure within the character region is segmented to obtain segmented structures; The character structure is used to represent the structure of different meanings and different types of fonts, such as the font types "you" and "me", which have different structures; the segmentation structure refers to the structure obtained by dividing the character structure into multiple modules, for example, dividing the structure of the font type "me" into four structural modules: top, bottom, left, and right. See Figure 3 The character area in the first row is divided into 4 blocks, and the standard character structure in the second row is also divided into 4 blocks. The 4 blocks in the first row are subjected to feature extraction and similarity calculation with the 4 blocks in the second row respectively. The similarity calculation results determine the 4 blocks in the first row that correspond one-to-one with the 4 blocks in the second row. The matching results can determine whether the font in the character area of ​​the first row is tilted to the right, tilted to the left, or not tilted, etc. The segmented regions are matched with the segmented structures to obtain region-structure matching pairs; Then, the direction of the corresponding character is determined by region-structure matching, and the character direction is used as the marker of the character; The starting scale identification step in the instrument scale distribution is as follows: the direction of the instrument is determined by the character mark, and the scale distribution of the instrument is matched with the standard scale distribution of the instrument in the corresponding direction. The size of the scale in the up, down, left and right directions of the character is queried in the standard historical dial. The size of the scale in the current image dial is determined by the queried scale size, and the starting scale and ending scale of the instrument are obtained. This is used to determine the order of the detected scale from small to large. In a preferred embodiment of this example, the detection step for the instrument center in the preprocessed electrical measuring instrument image is as follows: Based on the constructed instrument scale distribution, each mark in the instrument scale distribution is marked with a rectangle; Extend each rectangular frame mark infinitely along its length to obtain extended rectangular frame marks; Finally, the center of the instrument is obtained by the intersection of each extended rectangular frame mark.

[0030] In a preferred embodiment of this invention, the short end of the pointer in the target pixel area is detected by the center of the instrument to infer the position of the long end of the pointer. In the instrument, the long end of the pointer points to the scale result of the measurement. Therefore, it is necessary to detect the position of the long end of the pointer. This can avoid the problem that the long end of the pointer will overlap with the scale part on the pixel point, which would lead to insufficient accuracy in directly detecting the coordinates of the long end of the pointer and using the coordinates of the long end of the pointer as the pointer's direction on the scale.

[0031] The short-end detection step of the instrument pointer is as follows: In the target pixel area, construct straight lines passing through the center of the instrument by passing through the pixels that pass through the center, and obtain multiple straight lines passing through the center. Calculate the distances from the two endpoints of each straight line passing through the center to the center of the instrument, and obtain the distances from the first endpoint to the center and the second endpoint to the center for each straight line passing through the center. When the distance from the first endpoint to the center and the distance from the second endpoint to the center of any straight line passing through the center are the same, the straight line passing through the center is taken as the first target line, and a straight line passing through the center perpendicular to the first target line is obtained, and the straight line passing through the center is taken as the second target line. Finally, the endpoint that is closest to the center of the instrument among the two endpoints of the second target line is taken as the short end of the pointer.

[0032] The two endpoints of the second target line include the short end of the pointer and the long end of the pointer, which may be offset from the actual long end of the pointer due to overlap with the mark.

[0033] Detecting the long end of a pointer by its short end: Construct a Cartesian coordinate system through the center of the instrument, and calculate the coordinates of the longer end of the instrument pointer based on the Cartesian coordinate system using the following formula: in: Indicates the coordinates of the longer end of the instrument pointer; This represents the x-coordinate of the short end of the instrument pointer in a rectangular coordinate system. The ordinate of the short end of the instrument pointer in a rectangular coordinate system; Indicates the length of the long end of the pointer with the center of the instrument as the dividing point; Finally, the coordinate region of the long end of the instrument pointer is taken as the long end of the pointer.

[0034] See Figure 4 This is a diagram showing the positional relationship between the short end and the long end of the pointer in this embodiment.

[0035] In a preferred embodiment of this invention, the calculation steps for the scale measurement value are as follows: When the long end pixel of the instrument pointer overlaps with any mark pixel in the instrument scale distribution, that mark is obtained as the overlapping mark; Calculate the offset of the overlapping mark from the starting mark in the instrument scale distribution, and use this offset as the scale measurement value; When the long end pixel of the instrument pointer does not overlap with any of the scale pixels in the instrument scale distribution, the scale measurement value is calculated using the following formula: in: These are scale measurement values; This represents the number of marks traversed from the initial mark to the current position pointed to by the long end of the pointer; This indicates the number of unit scale divisions between the current position pointed to by the long end of the pointer and the starting scale; The scale is in units.

[0036] As can be seen, this embodiment preprocesses the visual image to convert the color image to a grayscale image, performs noise filtering, and binarizes the image. This reduces the amount of image data, simplifies the image, and highlights the contours of areas of interest such as scale lines and pointers. This embodiment detects image edge points in the preprocessed image to detect the edges of the scale portion. Furthermore, this embodiment calculates the center coordinates of the image edge points to calculate the center of the rectangle formed by the image edge points. Further, this embodiment uses the center coordinates to identify the image. The corner coordinates of the edge points are used to determine the coordinates of the four corner points of the rectangle formed by the edge points of the image. This allows us to know the length, width, and position of the rectangle. Furthermore, this embodiment uses the corner coordinates to determine the distribution of instrument scales in the preprocessed image. This allows us to identify the position of the scales in the current image (i.e., the distribution from the start to the end scale) when the current image experiences positional shifts or rotations. Additionally, when the scales and pointers overlap, making the width and length of the scales indistinguishable, we can determine the type and distribution of the indistinguishable scales. This embodiment also detects character markers in the preprocessed image to... The left, right, up, and down directions of the current dial are determined by the direction of the characters on the dial, thus allowing the detected dial scale distribution to correspond with the standard dial scale distribution. This enables the identification of the starting and ending scales within the dial. Furthermore, this embodiment identifies the starting scale in the instrument scale distribution based on the character markers to determine the ascending order of the detected scales. This embodiment detects the instrument center in the preprocessed image to determine the pointer's position by using the instrument center. Further, this embodiment extracts the preprocessed... The target pixel region is obtained by examining the pixel region passing through the center of the instrument in the image. This target pixel region is used to determine the area containing the pixels corresponding to the instrument center, i.e., the pointer pixel region. In this embodiment, the short end of the pointer in the target pixel region is detected using the instrument center to infer the position of the long end of the pointer. In instruments, the long end of the pointer points to the measurement scale result, so it is necessary to detect the position of the long end of the pointer. This avoids the problem that directly detecting the coordinates of the long end of the pointer and using them as the pointer's direction on the scale would result in insufficient accuracy, as the long end of the pointer might overlap with the scale pixels. Therefore, the vision-based electrical measuring instrument detection method proposed in this embodiment can improve the accuracy of vision-based electrical measuring instrument detection.

[0037] Example 2: See Figure 5An electrical measuring instrument detection device based on visual recognition includes an image preprocessing module 501, a distribution determination module 502, a scale recognition module 503, a region extraction module 504, a long end determination module 505, and a measurement determination module 506. The module described in this embodiment can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and are stored in the memory of the electronic device.

[0038] The image preprocessing module 501 is used to acquire images of electrical measuring instruments and preprocess the images; The distribution determination module 502 is used to detect edge points in the preprocessed electrical measuring instrument image, determine a group of image edge points based on the edge points, calculate the center coordinates of the group of image edge points, identify the corner coordinates of the group of image edge points based on the center coordinates of the group of image edge points, and then determine the scale distribution of the instrument in the image based on the corner coordinates of the group of image edge points. The calculation of the center coordinates of the image edge points includes: calculating the shortest distance between every two image edge points, determining the group of image edge points using the shortest distance, and calculating the center coordinates corresponding to the group of edge points using the following formula: in: The x-coordinate of the center coordinates of the group of edge points in the image; The ordinate is the center coordinate of the group of edge points in the image; The first in the image edge point group The x-coordinates of the image edge points; The first in the image edge point group The ordinates of the image edge points; This represents the number of image edge points in the image edge point group. The scale recognition module 503 is used to detect characters in the preprocessed electrical measuring instrument image and mark each character, and recognize the starting scale in the instrument scale distribution based on the character mark; The region extraction module 504 is used to detect the center of the instrument in the preprocessed electrical measuring instrument image, extract the pixel area passing through the center of the instrument in the image, and merge the region with the center of the instrument into the target pixel area; The long end determination module 505 is used to determine the long end of the pointer in the target pixel area based on the short end of the pointer detected by the center of the instrument. The measurement determination module 506 uses the scale distribution of the instrument, the starting scale of the instrument, and the pointing position of the long end of the pointer in the preprocessed electrical measuring instrument image obtained by the above module to obtain the scale measurement value, and uses the measurement value as the detection result of the electrical measuring instrument.

[0039] The modules in the vision-based electrical measuring instrument detection device 500 described in this embodiment of the invention employ the same methods as described above during use. Figures 1 to 4 The method used is the same as the vision-based electrical measuring instrument detection method described above, and it can produce the same technical effect, so it will not be repeated here.

[0040] Example 3: See Figure 6 This embodiment proposes an electronic device for a vision-based electrical measuring instrument detection method. The electronic device may include a processor 60, a memory 61, a communication bus 62, and a communication interface 63. It may also include a computer program stored in the memory 61 and executable on the processor 60, such as a vision-based electrical measuring instrument detection program.

[0041] In some embodiments, the processor 60 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 60 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 61 (e.g., executing a vision-based electrical measurement instrument detection program) and calls data stored in the memory 61 to perform various functions of the electronic device and process data.

[0042] The memory 61 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 61 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 61 can include both internal and external storage units of the electronic device. The memory 61 can be used not only to store application software and various types of data installed on the electronic device, such as the code of a database configuration connection program, but also to temporarily store data that has been output or will be output.

[0043] The communication bus 62 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 61 and at least one processor 60, etc.

[0044] The communication interface 63 is used for communication between the aforementioned electronic device 6 and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or, optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.

[0045] It will be understood by those skilled in the art that Figure 6The structure shown does not constitute a limitation on the electronic device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0046] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 60 via a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be elaborated further here.

[0047] The database configuration connection program stored in the memory 61 of the electronic device is a combination of multiple computer programs, which, when run in the processor 60, can achieve the following: Visual images of electrical measuring instruments are acquired, and image preprocessing is performed on the visual images to obtain preprocessed images; The image edge points in the preprocessed image are detected, the center coordinates of the image edge points are calculated, the corner coordinates of the image edge points are identified using the center coordinates, and the distribution of instrument scale in the preprocessed image is determined using the corner coordinates. The calculation of the center coordinates of the image edge points includes: calculating the shortest distance between every two image edge points, determining an edge point group using the shortest distance, and calculating the center coordinates corresponding to the edge point group using the following formula: in: The x-coordinate of the center coordinates of the group of edge points in the image; The ordinate is the center coordinate of the group of edge points in the image; The first in the image edge point group The x-coordinates of the image edge points; The first in the image edge point group The ordinates of the image edge points; This represents the number of image edge points in the image edge point group. Detect character markers in the preprocessed image, and identify the starting scale in the instrument scale distribution based on the character markers; The instrument center in the preprocessed image is detected, and the pixel region passing through the instrument center in the preprocessed image is extracted to obtain the target pixel region. The short end of the pointer in the target pixel area is detected by the instrument center, and the long end of the pointer in the target pixel area is determined by the short end of the pointer and the instrument center. Based on the scale distribution of the instrument and the starting scale, the scale measurement value of the long end of the pointer is determined, and the scale measurement value is used as the test result of the electrical measuring instrument.

[0048] Example 4: This embodiment provides a storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following: Visual images of electrical measuring instruments are acquired, and image preprocessing is performed on the visual images to obtain preprocessed images; The image edge points in the preprocessed image are detected, the center coordinates of the image edge points are calculated, the corner coordinates of the image edge points are identified using the center coordinates, and the distribution of instrument scale in the preprocessed image is determined using the corner coordinates. The calculation of the center coordinates of the image edge points includes: calculating the shortest distance between every two image edge points, determining an edge point group using the shortest distance, and calculating the center coordinates corresponding to the edge point group using the following formula: in: The x-coordinate of the center coordinates of the group of edge points in the image; The ordinate is the center coordinate of the group of edge points in the image; The first in the image edge point group The x-coordinates of the image edge points; The first in the image edge point group The ordinates of the image edge points; This represents the number of image edge points in the image edge point group. Detect character markers in the preprocessed image, and identify the starting scale in the instrument scale distribution based on the character markers; The instrument center in the preprocessed image is detected, and the pixel region passing through the instrument center in the preprocessed image is extracted to obtain the target pixel region. The short end of the pointer in the target pixel area is detected by the instrument center, and the long end of the pointer in the target pixel area is determined by the short end of the pointer and the instrument center. Based on the scale distribution of the instrument and the starting scale, the scale measurement value of the long end of the pointer is determined, and the scale measurement value is used as the test result of the electrical measuring instrument.

[0049] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0050] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0051] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0052] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0053] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for detecting electrical measuring instruments based on visual recognition, characterized in that, Includes the following steps: Acquire images from electrical measuring instruments and preprocess the images; The edge points of the preprocessed electrical measuring instrument image are detected, the image edge point group is determined by the image edge points, and the center coordinates of the image edge point group are calculated. The corner coordinates of the image edge point group are identified by the center coordinates of the image edge point group, and the scale distribution of the instrument in the image is determined by the corner coordinates of the image edge point group. The system detects characters in the preprocessed image of electrical measuring instruments and marks each character, then identifies the starting scale in the instrument scale distribution based on the character markings. The center of the instrument is detected in the preprocessed image of the electrical measuring instrument, and the pixel area passing through the center of the instrument is extracted. This area is then merged with the center of the instrument to form the target pixel area. Based on the instrument center detecting the short end of the pointer in the target pixel area, the long end of the pointer in the target pixel area is then determined through the short end of the pointer; Finally, the scale measurement value is obtained by analyzing the scale distribution of the instrument, the starting scale of the instrument, and the pointing position of the long end of the pointer in the preprocessed electrical measuring instrument image, and the measurement value is used as the test result of the electrical measuring instrument. The steps for detecting the short end of the instrument pointer are as follows: In the target pixel area, construct straight lines passing through the center of the instrument by passing through the pixels that pass through the center, and obtain multiple straight lines passing through the center. Calculate the distances from the two endpoints of each straight line passing through the center to the center of the instrument, and obtain the distances from the first endpoint to the center and the second endpoint to the center for each straight line passing through the center. When the distance from the first endpoint to the center and the distance from the second endpoint to the center of any straight line passing through the center are the same, the straight line passing through the center is taken as the first target line, and a straight line passing through the center perpendicular to the first target line is obtained, and the straight line passing through the center is taken as the second target line. Finally, the endpoint that is closest to the center of the instrument among the two endpoints of the second target line is taken as the short end of the pointer; The procedure for testing the long end of the instrument pointer is as follows: Construct a Cartesian coordinate system through the center of the instrument, and calculate the coordinates of the longer end of the instrument pointer based on the Cartesian coordinate system using the following formula: in: Indicates the coordinates of the longer end of the instrument pointer; This represents the x-coordinate of the short end of the instrument pointer in a rectangular coordinate system. The ordinate of the short end of the instrument pointer in a rectangular coordinate system; Indicates the length of the long end of the pointer with the center of the instrument as the dividing point; Finally, the coordinate region of the long end of the instrument pointer is taken as the long end of the pointer; The calculation steps for the scale measurement value are as follows: When the long end pixel of the instrument pointer overlaps with any mark pixel in the instrument scale distribution, that mark is obtained as the overlapping mark; Calculate the offset of the overlapping mark from the starting mark in the instrument scale distribution, and use this offset as the scale measurement value; When the long end pixel of the instrument pointer does not overlap with any of the scale pixels in the instrument scale distribution, the scale measurement value is calculated using the following formula: in: These are scale measurements; This represents the number of marks traversed from the initial mark to the current position pointed to by the long end of the pointer; This indicates the number of unit scale divisions between the current position pointed to by the long end of the pointer and the starting scale; The scale is in units.

2. The method for detecting electrical measuring instruments based on visual recognition according to claim 1, characterized in that, The edge point detection step for the preprocessed electrical measuring instrument image is as follows: First, the image gradient of the preprocessed electrical measuring instrument image is calculated using the following formula. : in: This is the horizontal filtering result of the preprocessed electrical measuring instrument image; The result of vertical filtering of the preprocessed electrical measuring instrument image; Indicates a preprocessed image; , These represent the x and y coordinates of a pixel in the preprocessed image of the electrical measuring instrument, respectively. The image gradient direction of the preprocessed electrical measuring instrument image is then calculated using the following formula. : Extract each pixel and its neighboring pixels from the preprocessed electrical measuring instrument image. Then, query the gradient and gradient direction of each pixel, as well as the gradient and gradient direction of its neighboring pixels, in the image gradient and image gradient direction of the preprocessed electrical measuring instrument image. When the gradient direction of any pixel is the same as the gradient direction of its neighboring pixels, it is checked whether the gradient of the pixel is greater than the gradient of its neighboring pixels. If the gradient of the pixel is greater than the gradient of its neighboring pixels, the pixel is regarded as an image edge point.

3. The method for detecting electrical measuring instruments based on visual recognition according to claim 1, characterized in that, The steps for calculating the center coordinates of the image edge point group are as follows: Calculate the shortest distance between every two image edge points, determine the group of image edge points based on the shortest distance, and then calculate the center coordinates of the group of image edge points using the following formula: in: The x-coordinate of the center coordinates of the group of edge points in the image; The ordinate is the center coordinate of the group of edge points in the image; The first in the image edge point group The x-coordinates of the image edge points; The first in the image edge point group The ordinates of the image edge points; This represents the number of image edge points in the image edge point group.

4. The method for detecting electrical measuring instruments based on visual recognition according to claim 1, characterized in that, The steps for identifying the corner coordinates in the image edge point group are as follows: Obtain the center coordinates of a group of image edge points and their corresponding image edge points; Calculate the coordinates of the center point of the image edge point group and the Euclidean distance between the center point and each image edge point in the image edge point group; The image edge point with the largest Euclidean distance from the center coordinates of the image edge point group is selected as the corner coordinates of the image edge point group; The steps for identifying the scale distribution of instruments in the preprocessed electrical measuring instrument image are as follows: The width and length of each mark of the instrument in the preprocessed image of the electrical measuring instrument are determined by the corner coordinates of the edge point group of the image. Multiple types of mark widths and lengths are preset. When the width and length of a mark match any of the preset mark widths and lengths, the mark type is determined based on the width and length of the mark. Then, the relative position of each mark of the corresponding type is determined by the corner coordinates, and the first instrument scale distribution is constructed based on the relative position of each mark of that type; When the width and length of the mark determined by the corner coordinates do not conform to the preset mark width and length, the width and length of the neighboring marks of each mark are obtained, and the mark is corrected according to the width and length of the neighboring marks to obtain the corrected mark width and length. Then, the second instrument scale distribution is constructed based on all the corrected mark widths and lengths.

5. The method for detecting electrical measuring instruments based on visual recognition according to claim 1, characterized in that, The steps for character marking in the preprocessed electrical measuring instrument image are as follows: Identify character regions in preprocessed electrical measuring instrument images and identify the character structures within those regions; The character region is segmented to obtain segmented regions, and then the character structure within the character region is segmented to obtain segmented structures; The segmented regions are matched with the segmented structures to obtain region-structure matching pairs; Then, the direction of the corresponding character is determined by region-structure matching, and the character direction is used as the marker of the character; The starting scale identification step in the instrument scale distribution is as follows: the direction of the instrument is determined by the character mark, and the scale distribution of the instrument is matched with the standard scale distribution of the instrument in the corresponding direction to obtain the starting scale and ending scale of the instrument.

6. The method for detecting electrical measuring instruments based on visual recognition according to claim 1, characterized in that, The detection steps for the center of the instrument in the preprocessed electrical measuring instrument image are as follows: Based on the constructed instrument scale distribution, each mark in the instrument scale distribution is marked with a rectangle; Extend each rectangular frame mark infinitely along its length to obtain extended rectangular frame marks; Finally, the center of the instrument is obtained by the intersection of each extended rectangular frame mark.

7. A vision-based electrical measuring instrument detection device, used to implement the method as described in any one of claims 1 to 6, characterized in that, It includes an image preprocessing module, a distribution determination module, a scale recognition module, a region extraction module, a long end determination module, and a measurement determination module; The image preprocessing module is used to acquire images from electrical measuring instruments and preprocess the images; The distribution determination module is used to detect edge points of the preprocessed electrical measuring instrument image, determine the image edge point group by the image edge points and calculate the center coordinates of the image edge point group, identify the corner coordinates of the image edge point group by the center coordinates of the image edge point group, and then determine the scale distribution of the instrument in the image by the corner coordinates of the image edge point group. The scale recognition module is used to detect characters in the preprocessed image of the electrical measuring instrument and mark each character, and recognize the starting scale in the scale distribution of the instrument based on the character marks; The region extraction module is used to detect the center of the instrument in the preprocessed electrical measuring instrument image, extract the pixel region passing through the center of the instrument in the image, and merge the region with the center of the instrument into the target pixel region; The long end determination module is used to determine the long end of the pointer in the target pixel area based on the short end of the pointer detected at the center of the instrument; The measurement determination module is used to obtain the scale measurement value from the scale distribution of the instrument, the starting scale of the instrument, and the pointing position of the long end of the pointer in the preprocessed electrical measuring instrument image obtained by the above module, and to use the measurement value as the detection result of the electrical measuring instrument.