Method, apparatus and electronic device for identifying readings of an instrument

By preprocessing and lateral scanning of the instrument image, and judging the decimal point position with color and length information, the problem of low accuracy in decimal point recognition in the prior art is solved, and the accuracy of instrument reading is improved.

CN114219760BActive Publication Date: 2025-07-04UBTECH ROBOTICS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111338434.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2025-07-04
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

Among the existing instrument reading recognition methods, the accuracy of decimal point recognition is low, resulting in a lower accuracy of the entire instrument reading.

Method used

The binarized image is obtained by preprocessing the target image, and the binarized image is scanned horizontally using a line segment of the preset height to determine the length of the first target color column, and determine the position of the decimal point based on the color information and length information.

Benefits of technology

Improves the accuracy of the identification of decimal point positions, simplifies the identification process, and is suitable for the edge deployment of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114219760B_ABST
    Figure CN114219760B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of image recognition technology, and provides a method, a device and an electronic device for recognizing the reading of an instrument, including: obtaining a target image, where the target image includes the dial of the instrument; preprocessing the target image to obtain a binary image; performing a horizontal scan on the binary image using a line segment with a preset height; determining the horizontal length of a first target color column according to the scan result, where the first target color column includes at least two adjacent first color columns, and the first color column is a pixel column where the sum of the pixel values of each pixel point satisfies a first preset condition; judging whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column. Through the above method, the accuracy of the recognized position of the decimal point can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of image recognition, and particularly relates to a method, apparatus, electronic device, and computer-readable storage medium for reading recognition of instruments. Background Art

[0002] Currently, more and more tasks are completed by robots instead of humans. For example, robots are used to inspect equipment instead of humans.

[0003] Specifically, the robot takes a picture of the instrument it inspects to obtain an image including the dial of the instrument, and then performs object detection on the image to obtain the reading of the instrument.

[0004] However, the existing method for reading recognition of instruments has the problem that the recognition accuracy of the decimal point is relatively low, which in turn leads to a relatively low accuracy of the entire reading of the instrument. Summary of the Invention

[0005] Embodiments of this application provide a method, apparatus, electronic device, and computer-readable storage medium for reading recognition of instruments, which can solve the problem that the accuracy of the existing method for recognizing the position of the decimal point is relatively low.

[0006] In a first aspect, embodiments of this application provide a method for reading recognition of instruments, including:

[0007] Obtain a target image, where the target image includes the dial of the instrument;

[0008] Preprocess the target image to obtain a binary image;

[0009] Horizontally scan the binary image with a line segment of a preset height;

[0010] Determine the horizontal length of a first target color column according to the scanning result, where the first target color column includes at least two adjacent first color columns, and the first color column is a pixel column where the sum of the pixel values of each pixel point satisfies a first preset condition;

[0011] Judge whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column.

[0012] In a second aspect, embodiments of this application provide a device for reading recognition of instruments, including:

[0013] A target image acquisition module, configured to obtain a target image, where the target image includes the dial of the instrument;

[0014] A target image preprocessing module, configured to preprocess the target image to obtain a binary image;

[0015] An image scanning module, configured to perform a horizontal scan on the binarized image by using a line segment of a preset height;

[0016] A first length determination module, configured to determine the horizontal length of a first target color column according to the scanning result, where the first target color column includes at least two adjacent first color columns, and the first color column is a pixel column in which the sum of the pixel values of each pixel point satisfies a first preset condition;

[0017] A decimal point position determination module, configured to determine whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column.

[0018] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method described in the first aspect is implemented.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0020] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on an electronic device, causes the electronic device to execute the method described in the first aspect above.

[0021] The beneficial effects of the embodiments of the present application compared with the prior art are:

[0022] In the embodiments of the present application, since the target image of the dial including the instrument is preprocessed into a binary image, subsequently, only the binary image with only black and white needs to be recognized, thereby reducing the complexity of subsequent recognition, and further facilitating improving the accuracy of determining the position of the decimal point from the binary image subsequently, and facilitating deploying the method at the edge of the electronic device. At the same time, since a line segment with a preset height is used to perform a horizontal scan on the binary image, all pixel values of the pixel points within the preset height range in the binary image can be ensured to be obtained, so that all first color columns satisfying the first preset condition can be determined according to the obtained pixel values, and further the horizontal length of the first target color column including adjacent first color columns can be accurately determined. And since the same decimal point or the same digit displayed on the dial of the instrument is represented by the same color, that is, the sum of the pixel values of the pixel points in each pixel column where the same decimal point or the same digit is located should satisfy the first preset condition, therefore, setting the first target color column to only include adjacent first color columns is more in line with the actual situation, and since the decimal point displayed on the dial is small, that is, the horizontal length of the decimal point has certain limitations, therefore, it is more accurate to determine whether the first target color column includes the position where the decimal point is located according to the length of the first target color column subsequently. That is, the recognition accuracy of the position where the decimal point is located can be improved by combining color information and length information. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art.

[0024] Figure 1 is a schematic flowchart of a method for recognizing the reading of an instrument provided by an embodiment of the present application;

[0025] Figure 2 is a schematic diagram of establishing a coordinate system with the lower left corner of the target image as the origin provided by an embodiment of the present application;

[0026] Figure 3 is a schematic diagram of the distance between a decimal point and the background on both sides thereof provided by an embodiment of the present application;

[0027] Figure 4 is a schematic diagram of a marked connected domain provided by an embodiment of the present application;

[0028] Figure 5 is a schematic diagram of the principle of median filtering provided by another embodiment of the present application;

[0029] Figure 6 is a schematic diagram of the effect of eroding the original image A on the left into A - B on the right provided by an embodiment of the present application;

[0030] Figure 7 It is a schematic structural diagram of a reading recognition device for an instrument provided by another embodiment of the present application;

[0031] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0032] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures and technologies are set forth in order to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should understand that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary details.

[0033] It should be understood that when used in the specification and claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0034] It should also be understood that the term "and / or" used in the specification and claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0035] In addition, in the description of the specification and claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0036] The reference to "one embodiment" or "some embodiments" etc. described in the specification of the present application means that a specific feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way.

[0037] Example 1:

[0038] In robot patrol inspection, it is usually necessary to read the numbers displayed on the instrument as the reading of the instrument. However, since the positions of the numbers displayed on the instrument and the position of the decimal point are usually not fixed (for example, for the same type of power meter, the positions of the numbers and the position of the decimal point are not fixed under different ranges), and the decimal point has the characteristics of small area and close distance to the surrounding environment. Therefore, the accuracy of the position of the read decimal point is relatively low, resulting in a relatively low accuracy of the final reading of the instrument.

[0039] To solve the above technical problems, the embodiment of the present application provides a method for identifying the reading of an instrument. In this method, first, the target image is preprocessed to obtain a binary image, and then a line segment with a preset height is used to perform a horizontal scan on the binary image to obtain the pixel values of each pixel point in each pixel column. The sum of the pixel values of each pixel point is statistically calculated by column (pixel column). The pixel column whose sum of pixel values meets the first preset condition is determined as the first color column, and multiple adjacent color columns are determined as the first target color column. Then, the length of the first target color column in the horizontal direction is determined, and finally, based on the length of the first target color column in the horizontal direction, it is determined whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument.

[0040] Since the decimal point displayed on the instrument is usually small, that is, the length of the decimal point in the horizontal direction must satisfy a certain rule. Therefore, it can be determined whether the position where the first target color column is located includes the position of the decimal point based on the length of the first target color column in the horizontal direction.

[0041] The following describes the method for identifying the reading of an instrument provided by the embodiment of the present application with reference to the accompanying drawings.

[0042] Figure 1 The flowchart of a method for identifying the reading of an instrument provided by the embodiment of the present application is shown and described in detail as follows:

[0043] Step S11, obtain a target image, where the target image includes the dial of the instrument.

[0044] In this embodiment, the electronic device can obtain the target image through its own camera, or obtain the target image by receiving the target image sent by other electronic devices.

[0045] In some embodiments, the electronic device is a robot. When the robot performs patrol inspection on the instrument, the dial of the instrument is photographed through the camera of the robot to obtain the above-mentioned target image.

[0046] Step S12, preprocess the above target image to obtain a binary image.

[0047] In this embodiment, the color of the numbers displayed on the dial of the instrument is different from the background color, but the colors of the displayed numbers are usually the same, and the background color is also usually the same. Due to different lighting conditions and / or shooting angles, the colors of the numbers and the background displayed on the dial in the obtained target image may be different from the actual situation (for example, there are differences in pixel values between the numbers). Therefore, in order to reduce the influence of lighting and shooting angles on the subsequent identification of the position of the decimal point from the target image, the obtained target image (usually a Red Green Blue (RGB) image) in this embodiment is preprocessed into a binary image.

[0048] Among them, the binary image here refers to an image with only two colors, white and black.

[0049] Step S13: Horizontally scan the above binary image with a line segment of a preset height.

[0050] In this embodiment, considering that the height of the decimal point itself is not high, therefore, it is only necessary to horizontally scan the binary image with a line segment of a preset height. For example, horizontally scan the binary image from left to right. Since the line segment of the preset height is horizontally scanning the binary image, that is, it only needs to scan the binary image completely horizontally, so the width range of the line segment of the preset height does not need to be restricted.

[0051] In some embodiments, the vertical coordinate of the bottom end of the line segment of the preset height is 5 (of course, it can also be other values, such as 4, as long as it is close to 0), and the vertical coordinate of the top end is 25 (of course, it can also be other values, as long as it is greater than 20). The unit of the coordinates here is the number of pixels, that is, the height value corresponding to 5 pixel numbers of the vertical coordinate of the bottom end. As Figure 2 shown, a coordinate system is established with the lower left corner of the target image as the origin, and a line segment with the vertical coordinate of the bottom end being 5 and the vertical coordinate of the top end being 25 is used to horizontally scan the target image. Since the height of the decimal point from the horizontal axis is usually low, setting the vertical coordinate of the bottom end to 5 can ensure that the decimal point is scanned when the target image is horizontally scanned, and after setting the vertical coordinate of the top end to 25, it can avoid the line segment of the preset height from scanning too much interference information.

[0052] Step S14: Determine the horizontal length of the first target color column according to the scanning result. The first target color column includes at least two adjacent first color columns, and the first color column is a pixel column in which the sum of the pixel values of each pixel point satisfies a first preset condition.

[0053] Since the binary image only has black (pixel value is 0) and white (pixel value is 255), when the sum of the pixel values of each pixel point in the first color column (the pixel points scanned by the line segment of the preset height, for example, when the preset height is 20, 20 pixel points can be scanned in a pixel column) is greater than a certain value (such as greater than 220), it indicates that there are white pixel points in the first color column.

[0054] In this embodiment, the first target color column includes at least two adjacent first color columns, and the number of adjacent first color columns it includes is equal to its length in the horizontal direction. For example, when the first target color column includes 20 adjacent first color columns, the length of the first target color column in the horizontal direction is 20 (the length corresponding to 20 pixel numbers). It should be noted that the first color columns included in the first target color column are adjacent first color columns. For example, assume there are pixel columns A, B, C, and D. Among them, the sum of the pixel values of each pixel point in pixel columns A, B, and D all meet the first preset condition, but the sum of the pixel values of each pixel point in pixel column C does not meet the first preset condition. Then, the obtained first target color column includes pixel columns A and B, but does not include pixel column D.

[0055] In this embodiment, if the first color column is a white color column, the first preset condition can be set to 220 - 10000, that is, if the sum of the pixel values of the pixel points scanned in a certain pixel column is within the range of the above first preset condition, then this pixel column is the first color column.

[0056] Step S15, determine whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the length of the first target color column in the horizontal direction.

[0057] In this embodiment, according to experience, it can be judged whether the length of the first target color column in the horizontal direction meets the length range requirement of the decimal point in experience, and then according to the comparison result, it can be judged whether the position where the first target color column is located includes the position of the decimal point.

[0058] In the embodiments of the present application, since the target image of the dial including the instrument is preprocessed into a binary image, subsequently, only the binary image with only black and white needs to be recognized, thereby reducing the complexity of subsequent recognition, which is conducive to improving the accuracy of determining the position of the decimal point from the binary image subsequently, and is also conducive to deploying this method at the edge of the electronic device. At the same time, since a line segment with a preset height is used to scan the binary image horizontally, all pixel values of the pixel points within the preset height range in the binary image can be guaranteed to be obtained, so that all first color columns that meet the first preset condition can be determined according to the obtained pixel values, and then the horizontal length of the first target color column including adjacent first color columns can be accurately determined. Since the same decimal point or the same number displayed on the dial of the instrument is represented by the same color, that is, the sum of the pixel values of the pixel points in each pixel column where the same decimal point or the same number is located should meet the first preset condition, therefore, it is more in line with the actual situation to set that the first target color column only includes adjacent first color columns. And since the decimal point displayed on the dial is small, that is, the horizontal length of the decimal point has certain limitations, therefore, it is more accurate to determine whether the first target color column includes the position where the decimal point is located based on the length of the first target color column subsequently. That is, the recognition accuracy of the position where the decimal point is located can be improved by combining color information and length information.

[0059] In some embodiments, considering that the gap on both sides of the decimal point is usually smaller than the gap between numbers (as Figure 3 shown), then, by combining the horizontal length of the first target color column and the horizontal length of the target color column composed of the color columns on both sides of the first target color column, it is determined whether the position where the first target color column is located includes the position of the decimal point. At this time, the method for recognizing the reading of the instrument further includes:

[0060] Determine the horizontal length of the second target color column according to the scanning result, where, for each of the above second target color columns, the second target color column includes at least two adjacent second color columns, there is a second color column adjacent to the first target color column among the respective second color columns, and the color of more than 50% of the pixel points in each of the above second color columns is different from the color of more than 50% of the pixel points in the first color column.

[0061] The above step S15 includes:

[0062] According to the horizontal length of the first target color column and the horizontal length of the second target color column, it is determined whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument.

[0063] In this embodiment, if the colors of more than 50% of the pixel points in the first color column are all white, then the colors of more than 50% of the pixel points in the second color column are all black.

[0064] In this embodiment, the second target color column may be composed of a plurality of adjacent pixel columns including the pixel column closest to the left of the first target color column, or may be composed of a plurality of adjacent pixel columns including the pixel column closest to the right of the first target color column. That is, the number of the second target color columns determined in this embodiment may be 1 or 2.

[0065] Since the second target color column is adjacent to the first target color column, therefore, judging whether the position where the first target color column is located includes the position of the decimal point according to the length of the first target color column in the horizontal direction and the length of the second target color column in the horizontal direction can improve the accuracy of the judgment result. That is, the accuracy of the judgment result is improved by adding other dimensional information.

[0066] In some embodiments, in order to further improve the accuracy rate of the judgment result, the reading recognition method of the instrument further includes:

[0067] Determine the target connected domain in the above binarized image, and the sum of the pixel values of the specified color in the above target connected domain satisfies the second preset condition, and the above specified color is the same as the color of more than 50% of the pixel points in the above first color column.

[0068] Among them, a connected component is also called a connected domain, which generally refers to an image region (Region Blob) composed of foreground pixel points with the same pixel value and adjacent positions in an image. Connected Component Analysis and Connected Component Labeling refer to finding and labeling each connected domain in an image. Among them, Figure 4 shows a schematic diagram of the labeled connected domain. Specifically, assume that the colors of more than 50% of the pixel points in the first color column are all white, then the specified color here is also white. That is, in a connected domain, if the sum of the pixel values of its white color satisfies the second preset condition, then the connected domain is the target connected domain. In some embodiments, the second preset condition is: the first preset pixel sum threshold < the sum of the pixel values of the specified color < the second preset pixel sum threshold. Since the decimal point is represented in the form of a dot on the dial, and the sum of the pixel values in the connected domain of the dot must be within a certain range, therefore, the second preset condition is set as: the first preset pixel sum threshold < the sum of the pixel values of the specified color < the second preset pixel sum threshold. Through the above settings, the connected domains corresponding to too large numbers can be filtered out, and the connected domains corresponding to too small noises can also be filtered out.

[0069] Correspondingly, determining whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument based on the horizontal length of the first target color column and the horizontal length of the second target color column described above includes:

[0070] Determining whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument based on the horizontal length of the first target color column, the horizontal length of the second target color column, and the specified coordinates in the target connected region.

[0071] In this embodiment, since the sum of the pixel values of the specified color in the target connected region satisfies the second preset condition, and the specified color is the same as the color of more than 50% of the pixel points in the first color column, it is ensured that the image content corresponding to the target connected region is the same as the image content corresponding to the first color column. For example, the image content corresponding to both is a number, or the image content corresponding to both is the background. In addition, since the decimal point is represented in the form of a dot, the area where the decimal point is located must be a connected region, that is, if there is a decimal point in the target connected region, the decimal point must have a relationship with the coordinates in the target connected region. That is, determining whether the position where the first target color column is located includes the position of the decimal point based on the horizontal lengths of the two target color columns and the specified coordinates in the target connected region is beneficial to improving the accuracy of the determination result.

[0072] In some embodiments, the specified coordinates are the central coordinates in the target connected region. The determining whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument based on the horizontal length of the first target color column, the horizontal length of the second target color column, and the specified coordinates in the target connected region includes:

[0073] If the horizontal length of the first target color column satisfies the first preset length threshold condition, the horizontal length of the second target color column satisfies the second preset length threshold condition, and the central coordinates in the target connected region are on the target line segment, it is determined that the position where the first target color column is located includes the position of the decimal point in the reading of the instrument; otherwise, it is determined that the position where the first target color column is located does not include the position of the decimal point in the reading of the instrument, where the target line segment is the line segment of the first target color column in the horizontal direction. For example, it is determined whether the abscissa of each pixel point in the target line segment is equal to the abscissa of the central coordinates. If they are equal, it is determined that the central coordinates are on the target line segment.

[0074] In this embodiment, the specified coordinate is taken as the central coordinate of the target connected region, and the central coordinate can better reflect the position of the decimal point represented in the form of a dot. That is, subsequently, the central coordinate and the horizontal lengths of the two target colors are used to determine whether the position of the first target color column includes the position of the decimal point, which is beneficial to improving the accuracy of the judgment result.

[0075] In some embodiments, if the color of more than 50% of the pixel points in the first color column is white, the first preset length threshold condition can be set as: 4 < length < 37. Correspondingly, the second preset length threshold condition can be set as: 1 < length < 8. If the color of more than 50% of the pixel points in the first color column is black, the first preset length threshold condition can be set as: 1 < length < 8. Correspondingly, the second preset length threshold condition can be set as: 4 < length < 37. Since in actual situations, both the horizontal length of the decimal point itself and the horizontal length of the background near the decimal point have certain limitations, only when the horizontal length of the first target color column meets the first preset length threshold condition, the horizontal length of the second target color column meets the second preset length threshold condition, and the central coordinate is on the target line segment, it is determined that the position of the first target color column includes the position of the decimal point, which can further improve the accuracy of the judgment result.

[0076] In some embodiments, after the above step S15, it includes:

[0077] A1. Use the Optical Character Recognition (OCR) detection algorithm to recognize the above binary image.

[0078] A2. Obtain the final reading of the above instrument according to the recognition result and the position of the decimal point in the reading of the above instrument.

[0079] In this embodiment, the OCR detection algorithm can effectively recognize each digit in the binary image. Combining with the recognized position of the decimal point, the final reading of the instrument can be accurately obtained. For example, assume that the digits recognized in the binary image by the OCR detection algorithm are 12345, and the position of the decimal point is between the digits 4 and 5, then the final reading of the instrument is "1234.5". Since the decimal point in the instrument has problems such as small area and close distance to the surrounding environment, and it is difficult for the deep learning solution to extract such small local features, if the deep learning-based solution is directly used to recognize the target image, its accuracy in recognizing the decimal point is relatively low.

[0080] In some embodiments, the above preprocessing includes at least one of the following: median filtering, adaptive contrast enhancement, and image erosion.

[0081] (1), Median Filtering

[0082] The median filter is a commonly used non - linear filter. Refer to Figure 5 , and its basic principle is to select the median of the pixel values in a neighborhood of the pixel to be processed to replace the pixel value of the pixel to be processed. Its main function is that the gray value of the pixel is relatively close to the gray values of the surrounding pixels, thereby eliminating isolated noise points. That is, the median filter can effectively eliminate salt - and - pepper noise. Moreover, while eliminating noise, the median filter can also effectively protect the boundary information of the image and will not cause much blurring to the image (compared with the mean filter).

[0083] (2), Adaptive Contrast Enhancement

[0084] An image is divided into two parts: one is the low - frequency part, which can be obtained through low - pass filtering (smoothing and blurring) of the image; the other is the high - frequency part, which can be obtained by subtracting the low - frequency part from the original image. The goal of the algorithm is to enhance the high - frequency part representing details, that is, multiply the high - frequency part by a certain gain value and then recombine to obtain the enhanced image.

[0085] (3), Image Erosion Operation

[0086] The operator of erosion is "-", and its definition is as follows:

[0087]

[0088] This formula means that image A is eroded using the convolution template B. By performing convolution calculation between template B and image A, the minimum value of the pixel points in the area covered by B is obtained, and this minimum value is used to replace the pixel value of the reference point. As Figure 6 shown, the original image A on the left is eroded to the effect image A - B on the right.

[0089] In this embodiment, since both median filtering and image erosion can effectively eliminate noise, and adaptive contrast enhancement can increase the contrast of the image. Therefore, when the pre - processing includes at least one of median filtering, adaptive contrast enhancement, and image erosion, it is beneficial to improve the accuracy of the subsequent judgment result.

[0090] In some embodiments, if the above - mentioned pre - processing includes median filtering, adaptive contrast enhancement, and image erosion, then the above - mentioned pre - processing of the above - mentioned target image to obtain a binary image includes:

[0091] Sequentially perform median filtering, adaptive contrast enhancement, and image erosion on the above - mentioned target image to obtain a binary image.

[0092] In this embodiment, since median filtering can filter random noise in any area of the image, and image erosion operation shrinks the white highlight part in the image, and what it eliminates are generally some burrs around the target connected area. Therefore, after the first noise filtering is performed by median filtering, then the contrast of the image is enhanced by adaptive contrast enhancement, and finally the second noise filtering is performed by image erosion, which can improve the accuracy of noise filtering and enhance the contrast in the binary image, thereby being beneficial to improving the accuracy of subsequent recognition of the decimal point position.

[0093] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0094] Example 2:

[0095] Corresponding to the meter reading recognition method described in the above embodiments, Figure 7 The structural block diagram of the meter reading recognition device provided by the embodiment of the present application is shown. For the sake of convenience of description, only the parts related to the embodiment of the present application are shown.

[0096] Refer to Figure 7 The meter reading recognition device 7 can be applied to an electronic device. The meter reading recognition device 7 includes: a target image acquisition module 71, a target image preprocessing module 72, an image scanning module 73, a first length determination module 74, and a decimal point position judgment module 75. Among them:

[0097] The target image acquisition module 71 is used to acquire a target image, and the above target image includes the dial of the meter;

[0098] The target image preprocessing module 72 is used to preprocess the above target image to obtain a binary image;

[0099] The image scanning module 73 is used to perform horizontal scanning on the above binary image with a line segment of a preset height;

[0100] In some embodiments, the bottom ordinate of the line segment of the preset height is 5 (of course, it can also be other values, such as 4, as long as it is close to 0), and the top ordinate is 25 (of course, it can also be other values, as long as it is greater than 20). The unit of the coordinates here is the number of pixels, that is, the height value corresponding to 5 pixel numbers of the bottom ordinate.

[0101] The first length determination module 74 is configured to determine the horizontal length of the first target color column according to the scanning result, where the first target color column includes at least two adjacent first color columns, and the first color column is a pixel column in which the sum of the pixel values of each pixel point satisfies a first preset condition;

[0102] The decimal point position determination module 75 is configured to determine whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column.

[0103] In the embodiment of the present application, since the target image including the dial of the instrument is preprocessed into a binary image, subsequently, only the binary image with only black and white needs to be recognized, thereby reducing the complexity of subsequent recognition, and further facilitating improving the accuracy of determining the position of the decimal point from the binary image. At the same time, since a line segment with a preset height is used to perform horizontal scanning on the binary image, it is possible to ensure that the pixel values of all pixel points within the preset height range in the binary image are obtained, so that all first color columns that satisfy the first preset condition can be determined according to the obtained pixel values, and further the horizontal length of the first target color column including adjacent first color columns can be accurately determined. And since the same decimal point or the same digit displayed on the dial of the instrument is represented by the same color, that is, the sum of the pixel values of each pixel point in each pixel column where the same decimal point or the same digit is located should satisfy the first preset condition, therefore, setting the first target color column to only include adjacent first color columns is more in line with the actual situation. And since the decimal point displayed on the dial is small, that is, the horizontal length of the decimal point has certain limitations, therefore, it is more accurate to determine whether the first target color column includes the position where the decimal point is located according to the length of the first target color column subsequently. That is, the recognition accuracy of the position where the decimal point is located can be improved by combining color information and length information.

[0104] In some embodiments, the reading recognition device 7 of the instrument further includes:

[0105] The second length determination module is configured to determine the horizontal length of the second target color column according to the scanning result, where for each of the second target color columns, the second target color column includes at least two adjacent second color columns, there is a second color column adjacent to the first target color column among the second color columns, and the color of more than 50% of the pixel points in each of the second color columns is different from the color of more than 50% of the pixel points in the first color column;

[0106] The decimal point position determination module 75 is specifically configured to:

[0107] Based on the horizontal length of the first target color column and the horizontal length of the second target color column, determine whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument.

[0108] In some embodiments, the reading recognition device 7 of the instrument further includes:

[0109] A target connected region determination module, configured to determine a target connected region in the binary image, where the sum of the pixel values of a specified color in the target connected region satisfies a second preset condition, and the specified color is the same as the color of more than 50% of the pixel points in the first color column;

[0110] When the decimal point position determination module 75 determines whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column and the horizontal length of the second target color column, it specifically is used for:

[0111] Based on the horizontal length of the first target color column, the horizontal length of the second target color column, and the specified coordinates in the target connected region, determine whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument.

[0112] In some embodiments, the second preset condition is: the first preset pixel sum threshold < the sum of the pixel values of the specified color < the second preset pixel sum threshold. Since the decimal point is represented in the form of a dot on the dial, and the sum of the pixel values in the connected region of the dot must be within a certain range, therefore, setting the second preset condition as: the first preset pixel sum threshold < the sum of the pixel values of the specified color < the second preset pixel sum threshold can filter out the connected regions corresponding to too large numbers and also filter out the connected regions corresponding to too small noises.

[0113] In some embodiments, the specified coordinates are the central coordinates in the target connected region. When the decimal point position determination module 75 determines whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column, the horizontal length of the second target color column, and the specified coordinates in the target connected region, it specifically is used for:

[0114] If the length of the first target color column in the horizontal direction satisfies the first preset length threshold condition, the length of the second target color column in the horizontal direction satisfies the second preset length threshold condition, and the central coordinate in the target connected region is on the target line segment, it is determined that the position where the first target color column is located includes the position of the decimal point in the reading of the instrument; otherwise, it is determined that the position where the first target color column is located does not include the position of the decimal point in the reading of the instrument, where the target line segment is the line segment of the first target color column in the horizontal direction.

[0115] In some embodiments, if the color of more than 50% of the pixel points in the first color column is white, the first preset length threshold condition can be set as: 4 < length < 37. Correspondingly, the second preset length threshold condition can be set as: 1 < length < 8. If the color of more than 50% of the pixel points in the first color column is black, the first preset length threshold condition can be set as: 1 < length < 8. Correspondingly, the second preset length threshold condition can be set as: 4 < length < 37. Since in actual situations, both the length of the decimal point itself in the horizontal direction and the length of the background near the decimal point in the horizontal direction have certain limitations, only when the length of the first target color column in the horizontal direction satisfies the first preset length threshold condition, the length of the second target color column in the horizontal direction satisfies the second preset length threshold condition, and the central coordinate is on the target line segment, it is determined that the position where the first target color column is located includes the position of the decimal point, which can further improve the accuracy of the judgment result.

[0116] In some embodiments, the reading recognition device 7 of the instrument further includes:

[0117] An image recognition module, configured to recognize the binary image through an optical character recognition detection algorithm;

[0118] A reading determination module, configured to obtain the final reading of the instrument according to the recognition result and the position of the decimal point in the reading of the instrument.

[0119] In some embodiments, the above preprocessing includes at least one of the following: median filtering, adaptive contrast enhancement, and image erosion.

[0120] In some embodiments, if the above preprocessing includes median filtering, adaptive contrast enhancement, and image erosion, the target image preprocessing module 72 is specifically configured to:

[0121] Perform median filtering, adaptive contrast enhancement, and image erosion processing on the target image in sequence to obtain a binary image.

[0122] It should be noted that for the content such as information interaction and execution process between the above-mentioned devices / units, since they are based on the same concept as the method embodiments of the present application, for their specific functions and the technical effects brought, reference can be specifically made to the method embodiment part, and details will not be elaborated here.

[0123] Example 3:

[0124] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 8 shown, the electronic device 8 of this embodiment includes: at least one processor 80 ( Figure 8 only one processor is shown in the figure), a memory 81, and a computer program 82 stored in the memory 81 and executable on the at least one processor 80. When the processor 80 executes the computer program 82, the steps in any of the above method embodiments are implemented.

[0125] The electronic device 8 may be a device such as a robot, a desktop computer, a notebook, a palm computer, and a cloud server. The electronic device may include, but is not limited to, a processor 80 and a memory 81. Those skilled in the art can understand that Figure 8 this is only an example of the electronic device 8 and does not constitute a limitation on the electronic device 8. It may include more or fewer components than shown in the figure, or combine some components, or different components. For example, it may also include input / output devices, network access devices, etc.

[0126] The so-called processor 80 may be a central processing unit (CPU), and the processor 80 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0127] The memory 81 may be an internal storage unit of the electronic device 8 in some embodiments, such as a hard disk or memory of the electronic device 8. The memory 81 may also be an external storage device of the electronic device 8 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the electronic device 8. The memory 81 is used to store an operating system, application programs, a BootLoader, data, and other programs, such as program codes of the computer program. The memory 81 may also be used to temporarily store data that has been output or will be output.

[0128] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.

[0129] The embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor. When the processor executes the computer program, the steps in any of the foregoing method embodiments are implemented.

[0130] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in any of the foregoing method embodiments can be implemented.

[0131] The embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device is enabled to implement the steps in any of the foregoing method embodiments.

[0132] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above method embodiments of this application, a computer program can be used to instruct relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the photographing device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, USB flash drive, mobile hard disk, magnetic disk or optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be electrical carrier signals and telecommunication signals.

[0133] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0134] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0135] In the embodiments provided in this application, it should be understood that the disclosed device / network device and method can be implemented in other ways. For example, the device / network device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0136] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for reading and recognizing the readings of an instrument, characterized in that, Including: Obtain a target image, where the target image includes the dial of an instrument; Preprocess the target image to obtain a binary image; Horizontally scan the binary image with a line segment of a preset height; Determine the horizontal length of a first target color column according to the scanning result, where the first target color column includes at least two adjacent first color columns, and the first color column is a pixel column where the sum of the pixel values of each pixel point satisfies a first preset condition; Determine the horizontal length of a second target color column according to the scanning result. For each second target color column, the second target color column includes at least two adjacent second color columns. There is a second color column adjacent to the first target color column among the second color columns, and the color of more than 50% of the pixel points in each second color column is different from the color of more than 50% of the pixel points in the first color column; Judge whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column and the horizontal length of the second target color column.

2. The method for reading recognition of the instrument according to claim 1, characterized in that, Also including: Determine a target connected region in the binary image, where the sum of the pixel values of the specified color in the target connected region satisfies a second preset condition, and the specified color is the same as the color of more than 50% of the pixel points in the first color column; The step of judging whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column and the horizontal length of the second target color column includes: Judge whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column, the horizontal length of the second target color column, and the specified coordinates in the target connected region.

3. The method for recognizing the reading of the instrument according to claim 2, characterized in that, The specified coordinates are the central coordinates in the target connected region. The step of judging whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column, the horizontal length of the second target color column, and the specified coordinates in the target connected region includes: If the horizontal length of the first target color column meets a first preset length threshold condition, the horizontal length of the second target color column meets a second preset length threshold condition, and the central coordinates in the target connected region are on the target line segment, it is determined that the position where the first target color column is located includes the position of the decimal point in the reading of the instrument; otherwise, it is determined that the position where the first target color column is located does not include the position of the decimal point in the reading of the instrument. Here, the target line segment is the line segment of the first target color column in the horizontal direction.

4. The method for identifying the reading of the instrument according to claim 3, characterized in that, After determining that the position where the first target color column is located includes the position of the decimal point in the reading of the instrument, it includes: Identify the binary image through an optical character recognition detection algorithm; Based on the recognition result and the position of the decimal point in the reading of the instrument, obtain the final reading of the instrument.

5. The method for reading recognition of the instrument according to claim 1, characterized in that, The preprocessing includes at least one of the following: median filtering, adaptive contrast enhancement, and image erosion.

6. The method for reading recognition of the instrument according to claim 5, characterized in that, If the preprocessing includes median filtering, adaptive contrast enhancement, and image erosion, then the preprocessing of the target image to obtain a binary image includes: Sequentially perform median filtering, adaptive contrast enhancement, and image erosion on the target image to obtain a binary image.

7. A reading recognition device for an instrument, characterized in that, Includes: A target image acquisition module for acquiring a target image, where the target image includes the dial of the instrument; A target image preprocessing module for preprocessing the target image to obtain a binary image; An image scanning module for horizontally scanning the binary image with a line segment of a preset height; A first length determination module for determining the horizontal length of the first target color column according to the scanning result, where the first target color column includes at least two adjacent first color columns, and the first color column is a pixel column where the sum of the pixel values of each pixel point satisfies a first preset condition; A second length determination module for determining the horizontal length of the second target color column according to the scanning result, where for each of the second target color columns, the second target color column includes at least two adjacent second color columns, there is a second color column adjacent to the first target color column among the second color columns, and the color of more than 50% of the pixel points in each of the second color columns is different from the color of more than 50% of the pixel points in the first color column; A decimal point position determination module for determining whether the position where the first target color column is located includes the position of the decimal point in the reading of the instrument according to the horizontal length of the first target color column and the horizontal length of the second target color column.

8. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1 to 6.