Edge computing device-oriented low-cost full-dial image acquisition and identification method

By acquiring images through a built-in camera module in the water meter and processing them with JPEG compression, combined with traditional visual algorithms for image recognition, the problems of data transmission latency and high hardware cost in full-dial image recognition on edge computing devices are solved, achieving efficient and low-cost full-dial image recognition.

CN121236742APending Publication Date: 2025-12-30JIANGSU UNIV OF SCI & TECH

Patent Information

Application Number
CN202511386056.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-26
Publication Date
2025-12-30

AI Technical Summary

Technical Problem

Existing automatic meter reading technologies suffer from high data transmission latency during peak hours or in inclement weather, require high image quality, and have high hardware costs, making it difficult to efficiently identify full-dial images on edge computing devices.

Method used

Images are captured by a built-in camera module in the water meter, and then processed by a data processing module for image stitching and compression. The image compression algorithm is used for image compression, and the image data is then converted by the JPEG decoder to be recognized on an edge computing device. Combined with traditional vision algorithms, character wheel and pointer recognition is performed, reducing the computing power requirements.

Benefits of technology

It improves the overall image quality of the dial, reduces data transmission latency and hardware costs, enhances recognition accuracy and efficiency, is highly adaptable, and has the ability to process blurry images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121236742A_ABST
    Figure CN121236742A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing and intelligent instruments, in particular to an edge computing equipment-oriented low-cost full-dial image acquisition and recognition method, which comprises the following steps of: acquiring a dial image through a camera module arranged in a water meter, and performing preliminary puzzle and image compression processing through a data processing module; sending the compressed dial image to an edge computing device; the edge computing device performs water meter puzzle processing on the compressed dial plate image; carrying out region segmentation on the dial plate image after the jigsaw processing to obtain a character wheel frame and a pointer; character wheel recognition and pointer recognition are carried out on the character wheel frame and the pointer respectively; the recognition result of the character wheel and the pointer forms a final water meter reading; and the water meter reading and the compressed dial plate image are output to the cloud server. According to the invention, the quality of the full-dial image and the data processing efficiency are improved, the delay of data transmission is reduced, and the cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and smart meter technology, and in particular to a low-cost method for full-dial image acquisition and recognition for edge computing devices. Background Technology

[0002] With the continuous advancement of artificial intelligence, computer vision technology is being applied more and more widely in the field of smart meters, enabling automatic meter reading to gradually replace manual meter reading. On the one hand, automatic meter reading requires combining computer vision with deep learning to improve the efficiency and accuracy of meter readings. This technology typically relies on training with a large number of samples, and the quality of the training sample images directly affects the accuracy of the readings obtained by deep learning. On the other hand, current automatic meter reading methods mainly rely on a distributed "cloud-edge" architecture. During peak evening hours or inclement weather, this increases data transmission latency, thereby reducing data processing efficiency.

[0003] Chinese invention patent CN114067230A, published on February 18, 2022, application number 202111394194.4, discloses a method and system for reading pointer-type instruments based on deep neural networks. First, it acquires images of the pointer-type instrument and standardizes their size. Then, it constructs an N-sided polygon by detecting the center point of each small pointer dial and rotates it to a horizontal position using the longest side as a reference to achieve image straightening. Reading labels are added to build a training sample set. Next, a reading model based on a YOLO deep neural network is constructed and trained using the sample set. Finally, the image to be recognized, after undergoing the same straightening process, is input into the trained model to directly obtain the reading labels for each dial, and the final reading is calculated by weighted summation. This method significantly improves the recognition accuracy of pointer-type instruments at any rotation angle, but it requires high image quality and relies on accurate center point detection, resulting in high hardware implementation costs.

[0004] Chinese invention patent CN110991449B, authorized on April 28, 2023, application number 201911188416.X, discloses a method for recognizing full and half characters based on character wheel characters. The method first constructs a full character wheel template curve by splicing the horizontal features of the characters. Then, it acquires a window image and extracts the feature curve. The optimal position is calculated through sliding matching, and finally, the reading is determined based on the hit position interval. This method has high computational efficiency, but its adaptability to errors in the character wheel frame manufacturing process and character printing process (such as edge defects and ink diffusion) is limited. Summary of the Invention

[0005] The main research object of this invention is a full-dial water meter that integrates an embedded mechanical wheel-type cumulative information display unit and several pointer-type small dial real-time indication units. In order to improve the quality of the full-dial image and the efficiency of data processing, reduce the latency of data transmission, and reduce costs, this invention provides a low-cost method for full-dial image acquisition and recognition for edge computing devices.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] The present invention provides a low-cost method for full-dial image acquisition and recognition for edge computing devices, comprising the following steps:

[0008] Step 1: The water meter's built-in camera module captures images of the meter face, and the data processing module performs preliminary image stitching and compression processing.

[0009] Step 2: Send the compressed dial image to the edge computing device;

[0010] Step 3: The edge computing device performs water meter mosaic processing on the compressed dial image;

[0011] Step 4: Perform region segmentation on the dial image after the jigsaw puzzle is processed to obtain the dial frame and hands;

[0012] Step 5: Perform character wheel recognition and pointer recognition on the character wheel frame and pointer respectively;

[0013] Step Six: The recognition results of the digit wheel and pointer form the final water meter reading;

[0014] Step 7: Output the water meter reading and the compressed dial image to the cloud server.

[0015] As a further preferred solution, in step one, the data storage module of the data processing module stores half of the image data captured in a single shot into the first buffer area and the other half into the second buffer area; the image stitching module of the data processing module takes half of each of the two complete dial images and merges and saves them as a preliminary stitched image.

[0016] The JPEG algorithm is selected to compress the captured dial image. Specifically, the image compression module in the data processing module uses the JPEG compression algorithm to merge the YCrCb color space of the initial stitched image, and then compresses the image data through DCT transformation, quantization and entropy coding.

[0017] The DCT transform used in the JPEG compression algorithm converts image blocks from the spatial domain to the frequency domain, separating low-frequency and high-frequency information; quantization is performed on the DCT coefficients to discard details in the high-frequency part; finally, Huffman coding is used to compress the quantized data.

[0018] This solution effectively reduces glare and produces a high-quality initial mosaic image of the entire dial. The microcontroller's partitioned cache reduces power consumption and improves transmission efficiency.

[0019] As a further preferred option, step two involves the following two execution scenarios for image compression:

[0020] (1) The compression is adjusted on the microcontroller built into the water meter reader. The image output module of the data processing module adjusts and compresses the initial mosaic image on the microcontroller and outputs it to the edge computing device as a target image.

[0021] (2) Save as a preliminary jigsaw puzzle image, and output it directly to the edge computing device by the image output module. Adjust and compress the jigsaw puzzle color in the server centralized area of ​​the edge device as a target image.

[0022] This scheme allows compressed dial images to be transmitted to edge devices, where recognition is performed at the edge layer, reducing bandwidth and improving real-time performance and stability.

[0023] As a further preferred option, in step three, based on the primary target image, the YCrCb data is converted into RGB data using the inverse conversion of the JPEG decoder to obtain the secondary target image;

[0024] The image optimization process for the secondary target image is performed using image algorithms, and the steps are as follows:

[0025] Step 1: Preprocess the secondary target image using the perfect reflection algorithm in the white balance algorithm of the OpenCV library;

[0026] Step 2: Perform horizontal left and right image segmentation on the image processed in Step 1 to obtain segmented images;

[0027] Step 3: For the segmented image described in Step 2, if its structural similarity index A is greater than or equal to the structural similarity index threshold A0, then merge the left and right images and perform YCrCb optimization processing.

[0028] Step 4: Perform histogram equalization on the image optimized in Step 3, and output the target image in triplicate;

[0029] Step 5: If the structural similarity index A of the segmented image described in Step 2 is less than the structural similarity index threshold A0, then the brightness and contrast of the segmented image are adaptively adjusted in blocks, and the left and right images are merged.

[0030] The algorithm for adaptively adjusting the brightness and contrast of the segmented image by block-based method includes the following steps:

[0031] (1) If the brightness value LB of the left image is greater than or equal to the brightness value RB of the right image, the brightness and contrast of the right image are adjusted based on the brightness LB and contrast value LC of the left image.

[0032] (2) If the brightness value LB of the left image is less than the brightness value RB of the right image, the brightness and contrast of the left image are adjusted based on the brightness RB and contrast value RC of the right image.

[0033] Step 6: If the gradient value B of the boundary line of the middle region of the merged image in Step 5 is less than or equal to the boundary line gradient threshold B0, then perform YCrCb optimization processing; otherwise, horizontally segment and merge the image, and repeat the operation of Step 5.

[0034] Step 7: Perform histogram equalization on the image optimized in Step 6 to output the target image in triplicate.

[0035] This approach yields higher-quality full-dial water meter mosaic images, i.e., three-dimensional target images, laying the foundation for improving image recognition accuracy in the future. Furthermore, the image algorithm used in this approach is a traditional vision algorithm, which reduces computing power costs.

[0036] As a further preferred option, in step four, full dial image recognition is performed on the three target images from step seven. Full dial image recognition is mainly divided into two parts: the first part is the recognition of the digits on the dial wheel, and the second part is the recognition of the pointers. Before performing the above two parts of recognition, the full dial image is first rotated and corrected.

[0037] The rotated and corrected dial image is segmented into regions, focusing on the digit wheel frame region and the pointer region; after the region segmentation is completed, the digit wheel frame region and the pointer region are identified accordingly.

[0038] This scheme accurately segments the entire dial image, obtaining the digit wheel frame area and the pointer area, reducing interference from non-interested areas, and laying the foundation for digit wheel recognition and pointer recognition.

[0039] As a further preferred solution, for the first part of the character wheel frame area, the above-described segmented character wheel area is first captured and saved. The character wheel area screenshot is recognized by the numerical recognition module. The filtering module filters the position data and area data of each recognized value to filter out interference values, thereby selecting more accurate character wheel values. For half-character cases, the principle of prioritizing the higher position is adopted throughout the entire recognition process to ensure the consistency of the principle of the whole process.

[0040] When recognizing the numerical values ​​of the character wheel, the tag IDs are assigned as follows: Full-character values ​​(0-9) use the same tag name; half-character values ​​(01, 12, 23, 34, 56, 45, 67, 78, 89, 90) are tagged with 10, 11, 12, 13, 14, 15, 16, 17, 18, and 19 respectively. The "higher priority" principle is used to assign values ​​to half-characters. If no half-character is found through the tag values, each value is arranged according to its X-axis coordinate and output as a string as the final recognition value of the character wheel, named NUM. If a half-character is recognized, each value is also arranged according to its X-axis coordinate and output as a string as the first recognition value of the character wheel, named NUM1.

[0041] Because of manufacturing errors in the character wheel frame and printing errors in the characters (such as edge defects and ink spread), the target frame position of the half-character in the character wheel screenshot is then covered with white fill from top to bottom according to the set area ratio threshold. This reduces the possibility of misidentifying small features as half-characters to a certain extent. At the same time, the white fill can minimize the impact on the original image. The covered character wheel image is then sent to the numerical recognition module for a second recognition. The half-characters identified in the first recognition will only produce three results after being covered and then recognized in the second recognition: the half-character remains unchanged, becomes a full character, or no value is recognized. The specific change process and value selection will be explained in detail in the selection module in the subsequent steps.

[0042] Next, each identified value is arranged according to its X-axis coordinate and output as a string, named NUM2. Then, the existing NUM1 and NUM2 are processed by a selection module to round and modify the values, forming a new NUM. The carry-over operation on the water meter is implemented at this point.

[0043] The selection module distinguishes between full characters and half characters by using the tag IDs from the first and second recognitions. First, to ensure that the number of digits in NUM1 and NUM2 remains consistent (i.e., the second recognition fails to recognize a value, resulting in missing digits in NUM2), it is necessary to compare and query the coordinate positions of the target boxes of each character in NUM1 and NUM2 in the character wheel diagram. The missing characters in NUM2 are filled by the characters at the corresponding positions in NUM1. This operation lays the foundation for the subsequent carry procedure and ensures the integrity of the data.

[0044] The selection module involves the concept of a range of values ​​for a half-character, meaning that both the upper and lower positions of the half-character can be used as range values. The selection module primarily handles the following situations that exist and affect the actual value, sequentially performing selection and carry operations;

[0045] Because digit recognition models can produce some misidentifications in complex detection environments, misidentification diagnosis is necessary. For a value that is only half a character in the first recognition, the second recognition may result in both a full character and a half character. However, it is unavoidable that the recognized full or half character values ​​may be outside the range, thus requiring separate analysis.

[0046] The first step is to identify full characters that are neither 0 nor 9, i.e., full characters from 1 to 8. The second identification of a full character also falls into two categories: those at the bottom position and those outside the range. If the identified full character is at the bottom position of a half-character, meaning it falls within the half-character's value range, no further operations are needed; the normal "top-priority" principle applies. If the identified full character is outside the range, the character at the corresponding position of the half-character in NUM2 needs to be replaced by adding one to the ASCII code value of the corresponding character in NUM1. In other words, the value represented by the character is incremented by one to ensure that the result of the second full character identification only belongs to the bottom position of the half-character identified in the first identification.

[0047] Secondly, the second recognition is of half-characters. These second-recognized half-characters also fall into two categories: those with the same label and those with different labels. If the two recognized half-characters have the same label, no additional operations are needed; the selection follows the normal "higher priority" principle. However, if the recognized half-character has a different label, the character at the corresponding position in NUM2 needs to be replaced by the corresponding character in NUM1.

[0048] Next, in the first case, search for the transitional semi-character 90 with label 19 in the first identified NUM1 and observe whether the semi-character 90 exists. If the semi-character 90 does not exist, select according to the normal "priority" carry principle; if the semi-character 90 exists in NUM1 and the previous character is not the semi-character 90, because the transitional semi-character 90 is a key semi-character for carry, and here it is assumed that the identified semi-character 90 exists in isolation in the whole sorting, and the situation before and after the sorting is not continuous.

[0049] At this point, two situations conflict with the carry principle and require modification. First, if the 90 half-character is the same in both the first and second recognitions (meaning the half-character remains unchanged), then the character preceding it in the first recognition is also a half-character, but the character below it in the second recognition is a full-character. In other words, the second recognition results in a full-character + 90 half-character combination, which is defined as the "full-half" case. In this case, the value of the 90 half-character still follows the "higher-priority" principle, but the ASCII value of the full-character preceding it in NUM2 is decreased by one and then incremented, meaning the character above it is selected.

[0050] Secondly, there's the case where the character 90 (half-character) is recognized as 90 (half-character) the first time, but as the full character 0 the second time, becoming a full character. However, the previous position of the character 90 (half-character) was a half-character in both the first and second recognitions. In other words, the second recognition is a combination of the previous position of the character 90 (half-character) being a half-character and then the character 90 (half-character) changing to a full character; this is defined as the "half-full" case. In this case, the ASCII value of the corresponding position in NUM2 containing the previous position of the character 90 (half-character) is incremented by one and then downshifted, selecting the next lower position.

[0051] In the second scenario, the system searches for the 90-character transitional half-character with label 19 in the first identified NUM1. It assumes that the identified 90-character transitional half-characters are consecutive throughout the sorting process, both before and after the sort. Then, by comparing NUM1 and NUN2, it determines whether any of the consecutive 90-character transitional half-characters have changed to a full-character 0 during the second identification. If even one 90-character transitional half-character changes to a full-character 0, then all consecutive 90-character transitional half-characters are selected at the lower position, i.e., all are assigned a value of 0. If none have changed, no additional operation is performed, and selection proceeds according to the normal "higher-priority" principle.

[0052] Specifically, the result of the character wheel recognition is ultimately output as an integer string arranged in numerical order NUM, which prepares for the formation of the final water meter reading.

[0053] This scheme, combining the "higher priority" principle, effectively solves the problem of half-character carry-over and significantly improves the recognition accuracy of character wheel digits. As a further preferred scheme, before performing the second part of pointer recognition, for the first pointer, on the right side of the character wheel frame, find the pointer with the shortest distance to the center of the character outline, define it as the first pointer, and simultaneously, according to the set... n x n The pointer image is cropped to the desired size, saved, and output. The pointer recognition method is then used to identify the reading. If the first pointer cannot be identified, subsequent pointers will not be identified.

[0054] After finding the first pointer, proceed clockwise to determine if the angle between the next pointer and the previous pointer relative to the center of the entire water meter dial is within the specified angle threshold range. If it is, the pointer is valid. Capture the pointer image according to the specified size, save and output it, and use the pointer recognition method to identify the reading, while outputting the pointer reading. If it is not within the specified angle threshold range, the pointer is invalid, and stop judging subsequent pointers, and so on.

[0055] Before adding valid pointer readings to the string, further valid pointer reading judgment is required; a pointer reading of "-1" is defined as an invalid pointer reading, which is an abnormal situation; for normal pointer readings, the corresponding pointer reading is added to the pointer reading sorting, but if any abnormal situation of pointer reading "-1" occurs, the corresponding pointer reading is set to "0" and subsequent readings are not added to the reading sorting.

[0056] This method allows for the rapid determination of the first pointer's position. Combined with the small pointer sorting method, it identifies the remaining pointers, laying the foundation for subsequent pointer identification.

[0057] As a further preferred option, the pointer image described above is used as the original image. The contrast and brightness of the original image are adjusted, and then it is converted into a grayscale image. The grayscale image is subjected to Gaussian blur processing, and Hough circle detection is used to obtain the center of the dial and the center of the small circle.

[0058] If a circular dial is detected, and the distance between the center of the largest circle and the center of the image is within the set distance threshold C, then the center of the circle is the center of the dial; otherwise, the center of the image is the center of the dial.

[0059] Because the pointer objects tested have a special shape, further yellow chip recognition can be performed on large pointers with special shapes. Its function is to determine the pointer type; specific categories will be explained later. This yellow chip is a circle with a small radius; the method is the same as detecting the center of the dial, only the radius range of the small circle needs to be adjusted.

[0060] If a small circle is detected and its radius is within the set radius threshold range, the center of the small circle is calculated to prepare for subsequent recognition of the large pointer; otherwise, the center of the small circle is set to (0,0) by default.

[0061] The pointer image captured above is used as the original image, then converted to a grayscale image, and then processed by an image index function to determine whether the image information entropy of the grayscale image is less than the set image information entropy threshold ET.

[0062] If the image information entropy is less than the set image information entropy threshold ET, then determine whether the average gray value of the image is less than or equal to the set average gray value threshold G1.

[0063] If the average gray value of the image is less than or equal to the set low average gray value threshold G1, the image is output as "lighting is too weak" and the pointer reading is "-1"; otherwise, it is determined whether the average gray value of the image is greater than or equal to the set high average gray value threshold G2.

[0064] If the average grayscale value of the image is greater than or equal to the set average grayscale high threshold G2, the image will be output as "too strong light" and the pointer reading will be "-1"; otherwise, the image will be output as "too low information entropy" and the pointer reading will be "-1".

[0065] If the image information entropy is greater than or equal to the set image information entropy threshold ET, then it is determined whether the image edge density is within the set edge density (ED0, ED1) range. If the grayscale image edge density is less than the set edge density threshold ED1 and less than the set edge density threshold ED2, and the image noise is less than the set image noise threshold N, then the image is defined as a "very blurry image", filtered, and the pointer reading is "-1".

[0066] If the edge density of a grayscale image is less than ED1, and the edge density is greater than or equal to ED2, and the image noise is greater than or equal to N, then the image is defined as a "relatively blurred image." This achieves pointer image filtering. Simultaneously, pointer images meeting these conditions are used as the original images for image recognition via a multi-channel collaborative processing module. The specific processing procedure is as follows:

[0067] Step 1: The "Brightness Canny Channel" processing function is called for the first time to perform image recognition on the relatively blurred image. The contrast brightness is adjusted using the contrast brightness function, with the contrast adjustment coefficient (contrast) remaining constant. The brightness adjustment is performed cyclically for I0 iterations, with the average brightness value of the original image being AB. Once the brightness reaches the target value, TB continues to increase by the brightness value L0, with an increment of I1. The formula for calculating the brightness to the target value TB is derived from experiments on the corresponding dataset, and the specific expression is as follows:

[0068] TB=(263.89-0.075*AB+258.72-0.032*AB)

[0069] After the original image is adjusted for contrast and brightness for the first time, it is converted into a grayscale image. Gaussian blurring is applied, and the Canny operator is used to detect the pointer outline. Then, dilation and erosion are used to perform morphological operations on the detected pointer outline.

[0070] The number of contours of the pointer contour is calculated using the contour detection function in the OpenCV library. After traversing all contours, the contour with the largest area is defined as the pointer contour.

[0071] If the pointer contour area S is within the range of [Z1, Z2), define the pointer as a normal pointer and name it ZP. Then erode the pointer contour once, filter the pointer contour again, call the pointer contour filtering function, and judge whether the pointer contour meets the requirements based on the corresponding contour indicators. The contour indicators include: PCA aspect ratio or the aspect ratio of the rotated rectangle is greater than the aspect ratio threshold CKB, roughness is less than the roughness threshold CCD, roundness is greater than the roundness threshold YYD, and rectangle similarity is greater than the rectangularity threshold JXD.

[0072] If the pointer outline area is greater than or equal to Z2, define the pointer as a large pointer, name it DP, and determine whether the image detects a yellow chip, i.e., the small circle detection mentioned above. If so, fill the detected small circle, and the subsequent method is the same as the normal pointer operation.

[0073] If the pointer profile is smaller than Z1, define the pointer as a tiny pointer, name it XP, and directly call the pointer profile filtering function. Subsequent methods are the same as normal pointer operations.

[0074] If the outline indicators of the large pointer DP, normal pointer ZP, or extremely small pointer XP do not meet the requirements, then it is determined again whether their roundness is greater than YYD and whether their rectangle similarity is greater than JXD. Otherwise, after the brightness is adjusted to the target value TB, the brightness is increased by I1 to become the new TB, and the loop is repeated again, and so on. If it is, it means that the pointer is very close to a circle or rectangle, then the pointer reading is output and the reading is "-1".

[0075] If the outline indicators of the large pointer DP, normal pointer ZP, or extremely small pointer XP all meet the requirements, then call the pointer reading function to find the coordinates of the pointer tip point, and then connect the pointer tip to the center of the dial, using the line as the pointer line, and calculate the angle between the pointer line and the value line.

[0076] After obtaining the corresponding included angle, according to the rule that the values ​​on the disk scale are evenly distributed in 360° (i.e., 10 values ​​from 0 to 9, with each value spaced 36° apart), the included angle is divided by 36°. The result of the division is then rounded down. The formula is as follows: Specifically, if the reading is very close to the next integer and the error is within the set error threshold ε, then the rounding up method is used, as shown in the formula: ε can be selected according to different situations; when the included angle is 360°, the calculated value is 10, but the value mapped to 10 on the dial is 0. Therefore, when the calculated reading is 10, the pointer reading is defined as 0. The specific pointer reading calculation formula is as follows:

[0077]

[0078] x c ,y c : Represents the x and y coordinates of the dial center in the image coordinate system (unit: pixels); x t ,y t: Represents the horizontal and vertical coordinates of the pointer tip in the image coordinate system (unit: pixels); θ: The clockwise angle between the pointer and the vertical direction (directly above) in the image coordinate system (unit: degrees), with a value range of [0°, 360°); N: Represents the total number of graduations on the dial, a positive integer. For example, if the dial is divided into 10 equal parts, then N = 10; r: Represents the unrounded real number reading after mapping the angle θ to the graduation value, with a value in the interval [0, N); ε: The error threshold used for tolerance judgment, used to handle inaccurate readings caused by floating-point errors, generally with a value such as ε = 0.09; R: The final determined integer graduation reading, with a range of R ∈ {0, 1, 2, ..., N-1}. When the pointer angle is exactly 360°, the corresponding reading R is set to 0 to achieve dial angle closure.

[0079] After the included angle is calculated by reading, the corresponding pointer reading is output;

[0080] Step 2: If the pointer reading is not successfully recognized when the original image calls the "Brightness Canny Channel" processing function until the loop ends, it means that the first Canny channel processing failed, and the "Red Channel" function is called for processing.

[0081] If the image edge density described above is not within the set edge density (ED0, ED1) range, the method is the same as for "first Canny channel processing failure", calling the "red channel" function for processing. The "red channel" has two cases: the first is the "bright red channel", and the second is the "dark red channel".

[0082] If the average gray value of the image is greater than the set gray value threshold G0, the "bright red channel" function is called to process it, and the original RGB image is converted into a YcrCb image, separating the three channels Y, Cr and Cb, and processing the Cr channel image separately.

[0083] For the Cr channel, a low threshold LH1 and a high threshold LH2 for bright red are set, and the number of iterations is I0. The separated Cr channel image is then processed by calling a red recognition function to extract the red region based on the set high and low thresholds for bright red.

[0084] At the same time, determine whether a yellow chip is detected in the image. If so, fill in the detected small circle; otherwise, perform an etching operation on the red area.

[0085] The contour detection function in the OpenCV library is used to calculate the number of contours in the red area. All contours are traversed. After the initial screening of contour traversal, contour dilation is performed on the contours that meet the conditions. The number of red pixels in the red area is calculated. Contours within the set red pixel number threshold (HP1, HP2) are found and defined as pointer contours.

[0086] After performing a closing operation on the defined pointer profile, the pointer profile is filtered again. The method for filtering the pointer profile here is the same as the "second pointer profile filtering" method described in step 1, and the subsequent algorithm operations are consistent with the subsequent algorithm operations of the "second pointer profile filtering" described in step 1. The only change is that if the corresponding condition is not met, the bright red low threshold LH1 is decremented by I2, becoming a new LH1, and the loop is repeated, and so on.

[0087] When the pointer reading outputs "-1", the "Bright Red Channel" function is called again for processing. The input image is the original pointer image with only contrast adjusted. The remaining algorithm steps are the same as the method of processing the original image using the "Bright Red Channel" function.

[0088] If the processing result still shows a pointer reading of "-1", then the "Bright Red Channel" function is called again. The input image is the image whose contrast has been adjusted in the original image, and whose brightness has been adjusted using the dynamic center brightness adjustment function. The remaining algorithm steps are the same as the method of processing the original image using the "Bright Red Channel" function.

[0089] If the pointer reading is -1 in all three calls to the "bright red channel" function, then the "non-red channel" function is called to process the original pointer image.

[0090] If the average gray value of the image is less than or equal to the set gray value threshold G0, the "dark red channel" function is called to process it, and the original RGB image is converted into a YcrCb image, separating the three channels Y, Cr and Cb, and processing the Cr channel image separately.

[0091] For the Cr channel, a low threshold (AH1) and a high threshold (AH2) for dark red are set, and the number of iterations is I0. The separated Cr channel image is then processed by a red recognition function to extract the red region based on the set dark red high and low thresholds.

[0092] At the same time, determine whether a yellow chip is detected in the image. If so, fill in the detected small circle; otherwise, perform an etching operation on the red area.

[0093] The contour detection function in the OpenCV library is used to calculate the number of contours in the color region. After traversing all contours and finding the pointer contours that meet the conditions, the subsequent algorithm steps are the same as those after the initial screening of contours in the "bright red channel" function. The only change is that if the corresponding conditions are not met, the dark red low threshold AH1 is incremented by I3 to become the new AH1, and the loop is repeated, and so on.

[0094] Step 3: If the pointer reading is "-1" in all three calls to the "Dark Red Channel" function, then call the "Non-Red Channel" function to process the original pointer image;

[0095] The original RGB image is converted to a grayscale image, and the grayscale image is inverted using the bitwise NOT operation function in the OpenCV library.

[0096] For the inverted pointer image, set a low threshold FHP1 and a high threshold FHP2 for non-red areas, and loop for I0 times. The inverted pointer image then calls a non-red recognition function to extract non-red regions based on the set low threshold FHP1 and high threshold FHP2.

[0097] Erosion is performed on the non-red areas. Then, the contour detection function in the OpenCV library is used to calculate the number of contours in the non-red areas. All contours are traversed to find contours within the set non-red pixel count threshold (FHP1, FHP2) and they are defined as pointer contours.

[0098] After performing a closing operation on the defined pointer contour, the pointer contour is eroded and refined again, and then the pointer contour is filtered. The method for filtering the pointer contour here is the same as the "second pointer contour filtering" method in the "Brightness Canny Channel" function described in step 1, and the subsequent algorithm operations are consistent with the subsequent algorithm operations of the "second pointer contour filtering" in the "Brightness Canny Channel" function described in step 1. The only change is that if the corresponding condition is not met, the non-red low threshold FHP1 is decremented by I4, becoming a new FHP1, and the loop is repeated, and so on.

[0099] When the pointer reading outputs "-1", the "non-red channel" function is called again for processing. The input image is the original pointer image with only contrast adjusted. The remaining algorithm steps are the same as the method of processing the original image using the "non-red channel" function.

[0100] If the processing result still shows a pointer reading of "-1", then the "non-red channel" function is called again. The input image is the image whose contrast has been adjusted in the original image, and whose brightness has been adjusted using the dynamic center brightness adjustment function. The remaining algorithm steps are the same as the method of processing the original image using the "non-red channel" function.

[0101] Step 4: If the pointer reading is "-1" after three calls to the "Non-Red Channel" function, then call the "Brightness Canny Channel" function again to process the original pointer image. This is the "Second Call to Canny Channel Processing". For details, please refer to Step 1 "First Call to Canny Channel Processing" method.

[0102] After the original pointer image undergoes the above multi-channel processing, the final pointer reading is output and named "pointreading". In particular, some dial types have special features, such as x10 or x0.1 models, which require further processing of the decimal string. The pointer recognition result is ultimately output as a decimal string arranged as "pointreading", preparing for the formation of the final water meter reading.

[0103] This scheme reduces computational requirements and costs because the pointer recognition algorithm uses traditional vision algorithms, eliminating the need for a training set and allowing direct reading. It also has adaptability and scalability for handling blurry images.

[0104] At this point, the final water meter reading is the combination of the string NUM and pointreading.

[0105] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0106] 1. In terms of image acquisition, the designed shooting device adopts vertical dial shooting and multiple exposure processing to effectively reduce the reflection phenomenon of dial image. The dial image stitching method is used to improve the quality of dial image. At the same time, the microcontroller partitions and buffers data to effectively reduce the power consumption of microcontroller and transmit data in real time to improve transmission efficiency.

[0107] 2. In terms of full dial image recognition, since the image rotation error has been reduced to a certain extent when the image is captured, the algorithm rotation correction makes the image position more accurate, which is conducive to segmenting the dial image into the digit wheel frame and the small pointer dial. At the same time, the small pointer sorting method lays the foundation for improving the detection efficiency and reducing the reading error of the subsequent pointer recognition.

[0108] 3. Compared with common character wheel frame recognition, the character wheel number recognition method proposed in this invention can effectively improve the accuracy of number recognition. Since the half-character "90" was found to be a special case during the experiment, the "higher priority" principle proposed on the basis of the character wheel number recognition method effectively solved the carry problem and further improved the reading accuracy.

[0109] 4. Due to the limited computing resources of edge computing devices, traditional visual algorithms are used for image processing to recognize pointer dials. The proposed pointer recognition method directly calculates the reading through target detection, eliminating the need for a training dataset and reducing training costs. Furthermore, in addition to recognizing normal pointer images, the proposed method can also handle relatively blurry pointer images. Moreover, the algorithm exhibits good adaptability and scalability, and can be applied to pointer devices presented in the form of a ring dial.

[0110] 5. This water meter recognition algorithm is implemented based on the OBB model of YOLOv11. Experimental results show that the algorithm has high recognition accuracy and running speed in most test scenarios. Although the overall recognition accuracy has not yet reached 100%, it is significantly better than some existing methods in practical applications. For complex situations such as blurred digits and overlapping pointers, there are still some recognition errors. Further optimization of the model can improve robustness and accuracy.

[0111] 6. The "cloud-edge-device" distributed architecture of this invention significantly reduces the data uplink bandwidth requirement and improves system processing efficiency and real-time performance by completing image recognition tasks at the edge layer. Simultaneously, edge nodes possess abnormal image caching and failure retry mechanisms, enhancing system stability and fault tolerance. Centralized management on the cloud platform enables unified storage, monitoring, and control of data from multiple water meters, while also exhibiting good scalability and adaptability. Attached Figure Description

[0112] Figure 1 This is a flowchart illustrating the overall process of this invention.

[0113] Figure 2 This is a structural diagram of the water meter imaging device of the present invention;

[0114] Figure 3 This is a structural diagram of the water meter camera device of the present invention (with the special meter cover removed);

[0115] Figure 4 (a) is a flowchart of the image compression process. Figure 4 (b) is the flowchart for the uncompressed image execution process;

[0116] Figure 5 This is a flowchart of the dial image acquisition process of the present invention;

[0117] Figure 6 This is a flowchart of the water meter mosaic algorithm of the present invention;

[0118] Figure 7 This is a flowchart of the water meter identification algorithm of the present invention;

[0119] Figure 8 This is a diagram illustrating a method for simulating the fabrication of a half-digit clock face according to an embodiment of the present invention;

[0120] Figure 9 A simulated dial design with full and half characters for an embodiment of the present invention;

[0121] Figure 10 This is a schematic diagram of the character wheel recognition result according to an embodiment of the present invention;

[0122] Figure 11 This is a flowchart of the character wheel recognition algorithm of the present invention;

[0123] Figure 12 This is a flowchart of the module carry process for the present invention;

[0124] Figure 13 This is a flowchart of the pointer recognition algorithm of the present invention;

[0125] Figure 14 (a) is a flowchart for detecting the center of the dial. Figure 14 (b) is the flowchart of the large pointer yellow chip;

[0126] Figure 15 This is a flowchart of the Canny channel algorithm of the present invention;

[0127] Figure 16 This is a flowchart illustrating the recognition result of the pointer reading on a single pointer dial in this invention.

[0128] Figure 17 This is a flowchart of the red channel algorithm of the present invention;

[0129] Figure 18 This is a flowchart of the community water meter image recognition and data processing system based on the cloud-edge-device architecture of the present invention. Detailed Implementation

[0130] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0131] This invention designs a vertically mounted imaging device capable of multiple exposures at the instrument panel to improve the quality of the dial image. It employs a distributed "cloud-edge-device" architecture, installing edge computing devices within a defined area to collect and process data in a timely manner, reducing data transmission latency and improving response speed. Furthermore, the high similarity of dial specifications within a given area reduces the number of training samples. Because edge computing devices have limited computing power, traditional machine vision algorithms are introduced for recognizing small pointer dials in the dial image, thereby reducing the cost of computing resources.

[0132] refer to Figure 1 As shown, this invention discloses a low-cost method for full-dial image acquisition and recognition for edge computing devices. This embodiment uses a full-dial water meter as an example to illustrate the invention in detail.

[0133] like Figure 2 , 3As shown, the imaging device of this invention mainly consists of a water meter body 1, a rubber shell 2, a specially designed meter cover 3, a power module 4, a light source module 5, a camera module 6, and a data processing module 7. The specially designed meter cover 3 is mounted on top of the rubber shell 2, the camera module 6 is mounted in the center of the specially designed meter cover 3, the light source module 5 and the data processing module 7 are mounted below the specially designed meter cover 3, and the power module 4 is mounted behind the specially designed meter cover 3. The data processing module 7 includes a data storage module, an image stitching module, an image compression module, and an image output module.

[0134] The light source module 5 includes two LEDs, which are installed on the left and right sides. They are positioned low and close to the dial area to reduce glare. The dual light sources are used for multiple shots, and the exposure time T is adjustable. The LED light source is also used to help determine whether the dial is currently in working condition.

[0135] The camera module 6 is installed directly above the watch head area, that is, a single low-cost camera is installed in the center of the special dial 3, with a fixed shooting angle, driven by the same power supply and powered in multiple times; the camera will take multiple exposures and capture multiple images of the dial from the same position and within the same time range.

[0136] The data storage module stores half of the image data captured in a single capture in the first buffer and the other half in the second buffer, reducing the storage usage of the microcontroller and other components by half; the image stitching module takes half of each of the two complete dial images and merges them to save a preliminary stitched image.

[0137] Because the JPEG compression algorithm has a higher compression ratio than lossless compression formats such as PNG, significantly reduces storage space compared to original image formats such as BMP, and has low implementation complexity and low computational resource consumption, it is suitable for application on resource-constrained embedded platforms such as microcontrollers. Therefore, this invention selects the JPEG algorithm to compress the captured dial image. That is, the image compression module uses the JPEG compression algorithm to merge the YCrCb color space of the preliminary stitched image, and effectively compresses the image data through DCT transformation, quantization and entropy coding.

[0138] Furthermore, the YCrCb color space merging used in the JPEG compression algorithm involves converting the image from RGB to YCrCb color space and performing chroma subsampling, which reduces the precision of chroma information. Specifically, the RGB to YCrCb conversion formula is as follows:

[0139] Y = 0.299R + 0.587G + 0.114B

[0140] Cr = (RY)0.713 + 128

[0141] Cb = (BY)0.564 + 128

[0142] R represents red, G represents green, B represents blue, and Y represents the brightness of the light source. The chromaticity information is stored in Cr and Cb, where Cr represents the red component information and Cb represents the blue component information.

[0143] Furthermore, the DCT transform used in the JPEG compression algorithm converts image blocks from the spatial domain to the frequency domain, separating low-frequency and high-frequency information; quantization is performed on the DCT coefficients, discarding details in the high-frequency components; finally, Huffman coding is used to compress the quantized data. Image compression is implemented in two ways:

[0144] (1) Adjust the compression on the microcontroller; (on the water meter reader)

[0145] (2) Adjust the colors of the compressed mosaic in the centralized server area. (On edge devices)

[0146] The image output module has two execution modes. The first mode involves the image output module adjusting and compressing the full-dial mosaic on the microcontroller and outputting it to the edge computing device as a primary target image. The specific process is as follows: Figure 4 As shown in (a); the second execution method is that the image output module outputs the uncompressed full dial mosaic from the microcontroller to the original data storage center, and then transmits it to the edge computing device as a primary target image. The specific process is as follows: Figure 4 As shown in (b). In this embodiment, the two execution methods described above can be selected according to different situations. Subsequent embodiments will follow. Figure 4 (a) was performed on it.

[0147] In this embodiment, the process of acquiring the full dial image refers to... Figure 5 The details are as follows:

[0148] At the set time point, the left LED light source is turned on for the first shot, and the camera captures an image of the dial. The exposure time is T. In this embodiment, the exposure time T is generally set to 12ms, but it can be adjusted according to different water meter installation environments. After the shot is taken, the left light source is turned off. The right side of the captured dial image is clear, while the left side is reflective. The microcontroller buffers the left and right parts of the dial image data separately.

[0149] The right LED light source is turned on a second time, and the camera captures an image of the dial. The exposure time is T. In this embodiment, the exposure time T is generally set to 12ms, but it can be adjusted according to different water meter installation environments. After the image is captured, the right light source is turned off. The left side of the captured dial image is clear, while the right side is reflective. The microcontroller buffers the left and right parts of the dial image data in separate partitions.

[0150] Using an image stitching module, the right side of the dial image obtained from the first capture is combined with the left side of the dial image obtained from the second capture to form a preliminary water meter mosaic image.

[0151] The initial water meter mosaic image is compressed using an image compression module (JPEG image compression), and then the compressed meter image is sent to the edge computing device.

[0152] Based on the primary target image, the YCrCb data is converted to RGB data using the inverse transformation of the JPEG decoder to obtain the secondary target image. The inverse transformation formula is as follows:

[0153] R = Y + 1.403(Cr - 128)

[0154] G=Y-0.714(Cr-128)-0.344(Cb-128)

[0155] B = Y + 1.773(Cb - 128)

[0156] The image algorithm used in this embodiment is based on the OpenCV library and is written in C++ on the Visual Studio 2017 compilation platform.

[0157] refer to Figure 6 After obtaining the secondary target image, image optimization processing is performed, and the steps are as follows:

[0158] Step 1: Use the perfect reflection algorithm in the white balance algorithm of the OpenCV library to preprocess the secondary target image.

[0159] Step 2: Perform horizontal left and right image segmentation on the image processed in Step 1 to obtain the segmented image.

[0160] Step 3: For the segmented image from Step 2, if its structural similarity index A is greater than or equal to the structural similarity index threshold A0, then merge the left and right images and perform YCrCb optimization processing. In this embodiment, A0 is set to 0.9, but can be set to a value depending on different situations.

[0161] Step 4: Perform histogram equalization on the image optimized in Step 3 to output three target images.

[0162] Step 5: If the structural similarity index A of the segmented image in Step 2 is less than the structural similarity index threshold A0, then the brightness and contrast of the segmented image are adaptively adjusted in blocks, and the left and right images are merged.

[0163] The steps of the block-based adaptive adjustment algorithm for the brightness and contrast of the segmented image are as follows:

[0164] (1) If the brightness value LB of the left image is greater than or equal to the brightness value RB of the right image, the brightness and contrast of the right image are adjusted based on the brightness LB and contrast value LC of the left image. The preset range of brightness difference between the left and right images is BD, and the preset range of contrast difference between the left and right images is CD. In this embodiment, BD is ±5 and CD is ±10, and the values ​​can be selected according to different situations.

[0165] (2) If the brightness value LB of the left image is less than the brightness value RB of the right image, the brightness and contrast of the left image are adjusted based on the brightness RB and contrast value RC of the right image. The preset range of brightness difference between the right and left images is BD, and the range of contrast difference between the right and left images is CD.

[0166] Step 6: If the gradient value B of the boundary line of the middle region in the merged image in Step 5 is less than or equal to the boundary line gradient threshold B0, then perform YCrCb optimization processing. Otherwise, horizontally segment and merge the image, and repeat the operation of Step 5. In this embodiment, Sobel_threshold is set to 20, but can be set to a value according to different situations.

[0167] Step 7: Perform histogram equalization on the image optimized in Step 6 to output the target image in triplicate.

[0168] Step 8: Perform full dial image recognition on the three target images from Step 7. Full dial image recognition mainly consists of two parts: the first part is the recognition of the digits on the dial wheel, and the second part is the recognition of the hands. Before performing the above two parts of recognition, the full dial image is first rotated and corrected.

[0169] Step 9: Perform region segmentation on the dial image that has been rotated and corrected in Step 8, focusing primarily on the digit wheel frame and the pointer area. After region segmentation, perform corresponding recognition on the digit wheel and pointer respectively.

[0170] The water meter recognition algorithm in this embodiment is implemented based on the YOLOv11 OBB model, which includes wheel recognition and pointer recognition. (Refer to...) Figure 7 .

[0171] For the first part of the character wheel frame region, a method for character wheel digit recognition is proposed. First, the segmented character wheel region is captured and saved. This captured image is then used by a digit recognition module. A filtering module filters out interference values ​​from the position and area data of each recognized digit, thereby selecting more accurate character wheel digits. It is also worth noting that... (The sentence is incomplete and requires further context to be fully translated.) Figure 8 The values ​​on the water meter dial are not always presented in full text; in most cases, they are presented in half-text form. For half-text cases, the principle of prioritizing the higher-order value is applied throughout the entire recognition process, ensuring consistency in the overall process.

[0172] When recognizing character wheel values, the tag IDs are assigned as follows: Full-character values ​​0-9 use the same tag name; half-character values ​​01, 12, 23, 34, 56, 45, 67, 78, 89, and 90 are tagged with 10, 11, 12, 13, 14, 15, 16, 17, 18, and 19 respectively. Simultaneously, the "higher priority" principle is used to assign values ​​to half-characters; for example, if the half-character 01 is recognized, its value is 0. (Refer to...) Figure 9 If no half-character is found through the numerical values ​​of the labels, each value is arranged according to its X-axis coordinate and output as a string as the final recognition value of the character wheel, which is NUM. If a half-character is detected, each value is also arranged according to its X-axis coordinate and output as a string as the first recognition value of the character wheel, named NUM1.

[0173] Because of manufacturing errors in the character wheel frame and printing errors in the characters (such as edge defects and ink spread), the target frame position of the half-character in the character wheel screenshot is then covered with white fill from top to bottom according to a set area ratio threshold. This reduces the possibility of misidentifying small features as half-characters to a certain extent, while also minimizing the impact on the original image. The covered character wheel image is then sent to the numerical recognition module for a second recognition. The half-characters identified in the first recognition will only result in three outcomes after being covered: the half-character remains unchanged, it becomes a full character, or no value is recognized. The specific changes and value selection will be explained in detail in the selection module in subsequent steps. In this embodiment, the area ratio threshold is 0.18, but it can be adjusted according to different situations.

[0174] Next, each identified value is arranged according to its X-axis coordinate and output as a string, named NUM2. Then, the existing NUM1 and NUM2 values ​​are selected and modified using a selection module; the carry-over operation on the water meter is implemented here.

[0175] The selection module distinguishes between full characters and half characters by using the tag IDs from the first and second recognitions. First, to ensure that the number of digits in NUM1 and NUM2 remains consistent (i.e., the second recognition fails to recognize a value, resulting in missing digits in NUM2), it is necessary to compare and query the coordinate positions of the target boxes of each character in NUM1 and NUM2 in the character wheel diagram. The missing characters in NUM2 are filled by the characters at the corresponding positions in NUM1. This operation lays the foundation for the subsequent carry procedure and ensures the integrity of the data.

[0176] The selection module involves the concept of a half-word value range, meaning that both the upper and lower digits of the half-word can be used as range values. For example, if there is a half-word with a 0-1 transition phase, the range values ​​are 0 and 1, with the upper digit being 0 and the lower digit being 1. The selection module mainly performs selection and carry operations sequentially for the following multiple cases that exist and affect the actual value:

[0177] Because digit recognition models can produce some false recognitions in complex detection environments, false recognition diagnosis is necessary. For a value that is only half a character in the first recognition, the second recognition may result in both a full character and a half character. However, it is unavoidable that the recognized full or half character values ​​may be outside the range, thus requiring separate analysis.

[0178] The first step is to identify full characters that are neither 0 nor 9, i.e., full characters from 1 to 8. The second identification of a full character also falls into two categories: those at the bottom position and those outside the range. If the identified full character is at the bottom position of a half-character, it falls within the range of half-character values, and no further operations are needed; the normal "top-priority" principle applies. If the identified full character is outside the range, the character at the corresponding position of the half-character in NUM2 needs to be replaced by adding one to the ASCII code value of the corresponding character in NUM1. In other words, the value represented by the character is incremented by one to ensure that the result of the second full character identification only belongs to the bottom position of the half-character identified in the first identification.

[0179] Secondly, there's the second instance of recognizing a half-character. This second recognition also falls into two categories: half-characters with the same label and half-characters with different labels. As defined by the label definitions above, for example, half-character 01 corresponds to label ID 10. Following the "higher-order priority" principle, the uppermost digit 0 is used as the recognition result, which corresponds to the last digit "0" of the label ID 10. Naturally, if the second recognition is half-character 12, the corresponding label ID can be inferred to be 11. When the two recognized half-characters are from the same label, no additional operations are needed; the selection follows the normal "higher-order priority" principle. When the recognized half-character is from a different label, the character at the corresponding position in NUM2 needs to be replaced by the corresponding character in NUM1.

[0180] Next, in the first case, search for the transitional semi-character 90 with label 19 in the first identified NUM1 and observe whether the semi-character 90 exists. If the semi-character 90 does not exist, select according to the normal "priority" carry principle. If the semi-character 90 exists in NUM1 and the previous character is not the semi-character 90, because the transitional semi-character 90 is a key semi-character for carry, and here it is assumed that the identified semi-character 90 exists in isolation in the whole sorting, and the situation before and after the sorting is not continuous.

[0181] There are two situations that conflict with the carry principle and require modification. First, if the character 90 (half-character) is recognized as 90 in both the first and second recognitions (meaning the half-character remains unchanged), then the character above it might be a half-character in the first recognition but a full-character in the second. In this case, the character above 90 is a full-character + 90 (half-character), which is defined as a "full-half" case. In this case, the value of 90 (half-character) still follows the "higher-priority" principle, but the ASCII value of the full-character above it in NUM2 is reduced by one and then promoted, meaning its higher-priority position is selected. For example, if the character above 90 (half-character) is half-character 12 in the first recognition and full-character 2 in the second, then the full-character 2 needs to be changed to 1, moving it from the lower position to the upper position.

[0182] Secondly, there's the case where the character 90 (half-character) is recognized as 90 (half-character) the first time, but as the full character 0 the second time, becoming a full character. However, the previous position in the sequence above 90 (half-character) was a half-character in both the first and second recognitions. In other words, the second recognition is a combination of the previous position being a half-character and 90 (half-character) changing to a full character; this is defined as the "half-full" case. In this case, the ASCII value of the corresponding position in NUM2 containing the previous position of 90 (half-character) is incremented by one and then downgraded, selecting the lower position. For example, if the previous position of 90 (half-character) is recognized as half-character 12 the first time and again, and the value of half-character 12 follows the "higher position priority" principle, the result would be 1, but this doesn't meet the requirements. Therefore, 1 needs to be changed to 2, downgrading it from the higher position to the lower position.

[0183] In general, under normal circumstances, following the "higher priority" principle, if both characters are half-characters, the upper position is used as the recognition result; if both characters are full characters, the lower position is used as the recognition result. This can be summarized as two principles: "half-half take half" and "full-full take full". If, under the condition of containing 90 half-characters that are not consecutive, the second recognition results in a "full-half" or "half-full" situation, this deviates from the above two principles of "half-half take half" and "full-full take full", so it needs to be modified. The principle of modification is to change "full" to "half" in the "full-half" case and "half" to "full" in the "half-full" case.

[0184] In the second scenario, the system searches for the 90-character transitional half-character with label 19 in the first identified NUM1. It assumes that the identified 90-character transitional half-characters are consecutive throughout the sorting process, both before and after the sort. Then, by comparing NUM1 and NUN2, it determines whether any of the consecutive 90-character transitional half-characters have changed to a full-character 0 during the second identification. If even one 90-character transitional half-character changes to a full-character 0, then all consecutive 90-character transitional half-characters are selected at the lower position, i.e., all are assigned a value of 0. If none have changed, no additional operation is performed, and selection proceeds according to the normal "higher-priority" principle.

[0185] Specific examples Figure 10 As shown, the units digit arrangement is a half-character case of 90, corresponding to the label 19; the tens digit arrangement is a half-character case of 23, corresponding to the label 12; the remaining digit arrangements are all full characters. There should be four possible combinations for the units and tens digits: "20", "29", "30", and "39". Using the character wheel recognition algorithm, only the combinations "29" or "30" should appear.

[0186] Specifically, the result of the character wheel recognition is ultimately output as an integer string arranged in numerical order NUM, which prepares for the formation of the final water meter reading.

[0187] The above character wheel recognition process is referenced. Figure 11 And select the module for process reference. Figure 12 .

[0188] Before proceeding with the second part of pointer recognition, determining the first pointer is crucial. Since the first pointer is typically located close to the character wheel frame, and the remaining pointers are arranged clockwise, a pointer sorting method is proposed. For the first pointer, on the right side of the character wheel frame, the pointer with the shortest distance to the center of the character outline is identified and defined as the first pointer. Simultaneously, an image of the pointer (including the pointer scale) is cropped to a predetermined n×n size, saved, and output. The pointer recognition method is then used for reading identification. If the first pointer cannot be determined, subsequent pointer recognition is discontinued.

[0189] In this embodiment, the size of the captured pointer image (n×n) is set to 72x72, which can be adjusted depending on the situation. If the captured image does not meet the 72x72 size, the remaining portion will be filled with white.

[0190] After finding the first pointer, proceed clockwise to determine if the angle between the next pointer and the previous pointer (this step involves the first pointer) relative to the center of the entire water meter dial is within the specified angle threshold range. If it is, the pointer is valid. Capture the pointer (including the pointer scale dial) image at the specified size, save and output it, and use the pointer recognition method to identify the reading, simultaneously outputting the pointer reading. If it is not within the specified angle threshold range, the pointer is invalid, and the subsequent pointer judgment stops, and so on.

[0191] Before adding valid pointer readings to the string, further valid pointer reading checks are performed. A pointer reading of "-1" is defined as invalid. If the first pointer reading is "-1", then the first pointer reading is set to "0" and subsequent readings are not added to the reading sort. If the first pointer reading is normal (any one of the 10 numbers from 0 to 9), such as "2", then pointer reading "2" is added to the pointer reading sort as the first number. Continuing to observe subsequent pointer readings, if the second pointer reading is normal and is "6", then it is also added to the reading sort, forming the pointer reading "26". If the second pointer reading is "-1", subsequent pointer readings are not added to the reading sort, and so on.

[0192] Furthermore, regarding the pointer recognition method mentioned above, please refer to... Figure 13 The specific implementation steps are as follows:

[0193] The pointer image captured earlier is used as the original image. The contrast and brightness of the original image are adjusted, and then it is converted into a grayscale image. The grayscale image is then subjected to Gaussian blur processing. Hough circle detection is used to detect the circular dial and obtain the center of the dial. This center of the dial is crucial for the recognition of pointer readings.

[0194] If a circular dial is detected, and the distance between the center of the largest circle and the center of the image is within the set distance threshold C, then the center of that circle is the center of the dial; otherwise, the center of the image is the center of the dial. For detailed procedures, please refer to [link / reference]. Figure 14 (a). In this embodiment, C takes 17 pixel values, which can be selected according to different situations.

[0195] Because the pointer objects tested have a special shape, further yellow chip recognition can be performed on large pointers with this special shape. Its function is to determine the pointer type; specific categories will be explained later. This yellow chip is a circle with a small radius; the method is the same as detecting the center of the dial, only the radius range of the small circle needs to be adjusted. For detailed procedures, please refer to [link / reference]. Figure 14 (b). In this embodiment, the radius range is (8.5, 12), and the unit is pixels. The value can be selected according to different situations.

[0196] If a small circle is detected and its radius is within the set radius threshold range, the center of the small circle is calculated to prepare for subsequent recognition of the large pointer; otherwise, the center of the small circle is set to (0,0) by default.

[0197] The pointer image captured earlier is used as the original image, then converted to a grayscale image, and then processed by an image index function to determine whether the image information entropy of the grayscale image is less than the set image information entropy threshold ET; in this embodiment, ET is set to 5.2, but the value can be changed according to different situations.

[0198] If the image information entropy is less than the set image information entropy threshold ET, then it is determined whether the average gray value of the image is less than or equal to the set average gray value low threshold G1; in this embodiment, G1 is 55, and the value can be taken according to different situations.

[0199] If the average gray value of the image is less than or equal to the set low threshold G1 for average gray value, the output image will show the reason "lighting is too weak" and the pointer reading will be "-1".

[0200] If the average gray value of the image is greater than the set low average gray value threshold G1, then it is determined whether the average gray value of the image is greater than or equal to the set high average gray value threshold G2. In this embodiment, G2 is set to 245, and the value can be selected according to different situations.

[0201] If the average gray value of the image is greater than or equal to the set average gray value threshold G2, the image will be output with the reason "too strong light" and the pointer reading will be "-1".

[0202] If the average grayscale value of the image is less than the set average grayscale threshold G2, the output image will show the reason "information entropy is too low" and the pointer reading will be "-1".

[0203] If the image information entropy is greater than or equal to the set image information entropy threshold ET, then it is determined whether the edge density of the image is within the set edge density range (ED0, ED1). The edge density is calculated by using the Canny operator to detect edges and then calculating the proportion of edge pixels in the entire image. In this embodiment, ED0 is set to 0 and ED1 to 0.15, but these values ​​can be chosen according to different situations.

[0204] If the edge density of the grayscale image is less than the set edge density threshold ED1, and the edge density of the grayscale image is less than the set edge density threshold ED2, and the image noise is less than the set image noise threshold N, then the image is defined as a "very blurry image" and filtered out, with the pointer reading being "-1". In this embodiment, ED2 is 0.03 and N is 0.3, and these values ​​can be chosen according to different situations.

[0205] If the grayscale image edge density is less than ED1, and the grayscale image edge density is greater than or equal to ED2, and the image noise is greater than or equal to N, then the image is defined as a "relatively blurred image." This implements pointer image filtering, and the pointer images that meet the conditions are used as the original images for image recognition through a multi-channel collaborative processing module. The specific processing procedure is as follows:

[0206] Step 1: The "Brightness Canny Channel" processing function is called for the first time to perform image recognition on the relatively blurred image, refer to... Figure 15 The specific implementation steps are as follows:

[0207] The original image calls the "Brightness Canny Channel" processing function, adjusting the contrast and brightness using the contrast-brightness function. The contrast adjustment coefficient `contrast` remains constant. Brightness adjustment uses a cyclic adjustment method with a loop count of I0. The original image's average brightness value is AB. Once the brightness reaches the target value, TB continues to increase the brightness value by L0, incrementing by I1. Here, `contrast` is set to 1.5, `I0` to 3, `N` to 0.3, `L0` to 15, and `I1` to 5, but these values ​​can be adjusted according to different situations.

[0208] The formula for adjusting the brightness to the target value TB was derived from experiments on the corresponding dataset, and the specific expression is as follows:

[0209] TB=(263.89-0.075*AB+258.72-0.032*AB)

[0210] After the original image is adjusted for contrast and brightness for the first time, it is converted into a grayscale image. Gaussian blurring is applied, and the Canny operator is used to detect the pointer outline. Then, dilation and erosion are used to perform morphological operations on the detected pointer outline.

[0211] The number of pointer contours is calculated using the contour detection function in the OpenCV library. All contours are traversed, the centroid of each contour is calculated, and it is determined whether the distance between its centroid and the center of the dial is less than or equal to the set distance threshold C. In this embodiment, C is taken as 15 pixel values, but the value can be taken according to different situations.

[0212] If the distance between the centroid of the outline and the center of the dial is greater than the set distance threshold C, the brightness will be adjusted to the target value TB and then the brightness will be increased by I1, becoming the new TB, and the cycle will be repeated again, and so on.

[0213] If the distance between the centroid of the contour and the center of the dial is less than or equal to the set distance threshold, the point-to-polygon test function in OpenCV is used to detect whether the center of the dial is inside the contour. If it is inside the contour, the contour is stored and the next contour is traversed; otherwise, the next contour is traversed until the loop ends.

[0214] After the initial screening of contours is completed, the contours that meet the criteria are eroded and refined, and a second pointer contour screening is performed. The maximum contour area MS is initially set to 0.

[0215] Iterate through and calculate the area S of each contour. Determine if the contour area S is greater than the set pixel low threshold CP1. If so, calculate the centroid of the contour and determine if the distance between the contour centroid and the center of the dial is less than or equal to the set distance threshold C. Otherwise, iterate through the area of ​​the next contour.

[0216] If the distance between the centroid of the contour and the center of the dial is less than or equal to the set distance threshold C, determine whether the area of ​​the current contour is greater than the maximum contour area MS. If so, set the area of ​​the current contour to the maximum contour area. Otherwise, iterate through the area of ​​the next contour.

[0217] After the contour area traversal is completed, the contour with the largest area is defined as the pointer contour. It is then determined whether the pointer contour area is within the set area threshold range (CP1, CP2). If the pointer contour area is not within the set area threshold range, the brightness is adjusted to the target value TB, and the brightness increment I1 becomes the new TB, and the loop is repeated, and so on. In this embodiment, CP1 takes 200 pixel values, and CP2 takes 1600 pixel values; these values ​​can be chosen according to different situations.

[0218] If the pointer outline area is within the range [Z1, Z2), the pointer is defined as a normal pointer named ZP. Then, the pointer outline is eroded once, and the pointer outline is filtered again. The pointer outline filtering function is called, and the pointer outline is judged to meet the requirements based on the corresponding outline indicators. The outline indicators include: PCA aspect ratio or the aspect ratio of the rotated rectangle is greater than the aspect ratio threshold CKB, roughness is less than the roughness threshold CCD, roundness is greater than the roundness threshold YYD, and rectangle similarity is greater than the roundness threshold JXD. In this embodiment, Z1 is 400 pixel values, Z2 is 650 pixel values, CKB is 1.1, CCD is 2.5, YYD is 0.8, and JXD is 0.8. These values ​​can be selected according to different situations.

[0219] If the area of ​​the pointer outline is greater than or equal to Z2, define the pointer as a large pointer, name it DP, and determine whether the yellow chip is detected in the image, i.e., the small circle detection mentioned above. If so, fill the detected small circle, and the subsequent method is the same as the normal pointer operation.

[0220] If the pointer profile is smaller than Z1, define the pointer as a tiny pointer, name it XP, and directly call the pointer profile filtering function. Subsequent methods are the same as normal pointer operations.

[0221] If the outline indicators of the large pointer DP, the normal pointer ZP, or the very small pointer XP do not meet the requirements, then it is determined again whether the roundness is greater than YYD and the rectangle similarity is greater than JXD. If not, the brightness is adjusted to the target value TB and the brightness is increased by I1 to become the new TB. The loop is repeated again, and so on. If it is, it means that the pointer is very close to a circle or rectangle. Then the pointer reading is output and the reading is "-1".

[0222] If the contour indicators of the large pointer DP, the normal pointer ZP, or the very small pointer XP all meet the requirements, then call the pointer reading function to find the coordinates of the pointer tip point, and then connect the pointer tip to the center of the dial, using the line as the pointer line, and calculate the angle between the pointer line and the value line.

[0223] After obtaining the corresponding included angle, based on the rule that the values ​​on the circular scale are evenly distributed in 360° (i.e., 10 values ​​from 0 to 9, with each value spaced 36° apart), divide the included angle by 36°, and round the result down. The formula is as follows: If the result of the division is 2.3, Take 2 as the pointer reading. Specifically, if the reading is very close to the next integer and the error is within the set error threshold ε, then the rounding up method is used, as shown in the formula: ε can be selected according to different situations. Here, the error threshold ε is set to 0.09. For example, if the division result is 8.92, The reading is taken as 9; when the included angle is 360°, the calculated reading is 10, but the value mapped to 10 on the dial is 0. Therefore, when the calculated reading is 10, the pointer reading is defined as 0. The specific formula for calculating the pointer reading is as follows:

[0224]

[0225] x c ,y c : Represents the x and y coordinates of the dial center in the image coordinate system (unit: pixels); x t ,y t : Represents the horizontal and vertical coordinates of the pointer tip in the image coordinate system (unit: pixels); θ: The clockwise angle between the pointer and the vertical direction (directly above) in the image coordinate system (unit: degrees), with a value range of [0°, 360°); N: Represents the total number of graduations on the dial, a positive integer. For example, if the dial is divided into 10 equal parts, then N = 10; r: Represents the unrounded real number reading after mapping the angle θ to the graduation value, with a value in the interval [0, N); ε: The error threshold used for tolerance judgment, used to handle inaccurate readings caused by floating-point errors, generally with a value such as ε = 0.09; R: The final determined integer graduation reading, with a range of R ∈ {0, 1, 2, ..., N-1}. When the pointer angle is exactly 360°, the corresponding reading R is set to 0 to achieve dial angle closure.

[0226] After the included angle is calculated from the readings, the corresponding pointer reading is output for reference. Figure 16 This describes the process for identifying pointer readings in a specific embodiment of a single pointer dial.

[0227] Step 2: If the pointer reading is not recognized successfully when the original image calls the "Brightness Canny Channel" processing function until the end of the loop, it means that the first Canny channel processing failed, and the "Red Channel" function is called for processing.

[0228] If the edge density of the image mentioned above is not within the set edge density (ED0, ED1), the method is the same as for "First Canny channel processing failed", calling the "Red Channel" function for processing. The "Red Channel" has two cases: the first case is the "Bright Red Channel", and the second case is the "Dark Red Channel".

[0229] refer to Figure 17 If the average gray value of the image is greater than the set gray value threshold G0, the "bright red channel" function is called to process it, converting the original RGB image into a YcrCb image, separating the three channels Y, Cr, and Cb, and processing the Cr channel image separately.

[0230] For the Cr channel, set a low threshold LH1 and a high threshold LH2 for bright red, and set the loop count to I0. The separated Cr channel image is then processed by calling a red recognition function to extract the red region based on the set high and low thresholds for bright red. In this embodiment, LH1 is set to 150, LH2 to 255, and timetry to 3, but these values ​​can be adjusted according to different situations.

[0231] At the same time, determine whether a yellow chip is detected in the image. If so, fill in the detected small circle; otherwise, perform an etching operation on the red area.

[0232] The contour detection function in the OpenCV library is used to calculate the number of contours in the red area. All contours are traversed, the centroid of each contour is calculated, and it is determined whether the distance between the centroid and the center of the dial is less than or equal to the set distance threshold C. In this embodiment, C is taken as 15 pixel values, but the value can be taken according to different situations.

[0233] If the distance between the centroid of the contour and the center of the dial is less than or equal to the set distance threshold C, the point-to-polygon test function in OpenCV is used to detect whether the center of the dial is inside the contour. If it is inside the contour, the contour is enlarged according to the set ratio, and then the contour is stored. At the same time, the next contour is traversed. Otherwise, the next contour is traversed until the loop ends. In this embodiment, the enlargement ratio of the contour is 1.12, but it can be set to a value according to different situations.

[0234] After the initial screening of contours is completed, contour dilation is performed on contours that meet the conditions, the number of red pixels in the red area is calculated, and it is determined whether the contour is within the set red pixel count threshold (HP1, HP2). In this embodiment, HP1 is 300 pixel values ​​and HP2 is 1600 pixel values, which can be selected according to different situations.

[0235] If the number of red pixels in the red area is not within the set red pixel count threshold (HP1, HP2), then the low threshold LH1 for bright red is decreased by I2, becoming a new LH1, and the loop is repeated, and so on. In this embodiment, I2 is set to 2.5, but the value can be adjusted according to different situations.

[0236] If the number of red pixels in the red area is within the set threshold (HP1, HP2), then dilation and erosion morphological operations are performed on the red area. Then, the centroid of the contour is calculated, and it is determined whether the distance between the centroid and the center of the dial is less than or equal to the set distance threshold C.

[0237] If the distance between the centroid and the center of the dial is greater than the set distance threshold, the bright red low threshold LH1 is reduced by I2, becoming a new LH1, and the cycle repeats again, and so on.

[0238] If the distance between the centroid and the center of the dial is less than or equal to the set distance threshold, the red area is filled with green, the number of green pixels is calculated, and it is determined whether the number of green pixels is within the set green pixel number threshold (LP1, LP2). In this embodiment, LP1 is 300 pixel values ​​and LP2 is 1600 pixel values, which can be selected according to different situations.

[0239] If the number of green pixels is not within the set threshold (LP1, LP2) for the number of green pixels, the low threshold for bright red LH1 is reduced by I2 to become a new LH1, and the cycle is repeated again, and so on.

[0240] If the number of green pixels is within the set green pixel number threshold (LP1,LP2), then calculate the centroid of the outline, calculate the distance between the centroid and the center of the dial, select the green area with the shortest distance, and define it as the pointer outline.

[0241] After performing a closing operation on the defined pointer profile, the pointer profile is filtered again. The method for filtering the pointer profile here is the same as the "second pointer profile filtering" method in the "Brightness Canny Channel" function mentioned earlier, and the subsequent algorithm operations are consistent with the subsequent algorithm operations of the "second pointer profile filtering" in the "Brightness Canny Channel" function. The only change is that if the corresponding condition is not met, the bright red low threshold LH1 is decremented by I2, becoming a new LH1, and the loop is repeated, and so on.

[0242] When the pointer reading outputs "-1", the "Bright Red Channel" function is called again for processing. The input image is the original pointer image with only contrast adjusted. The remaining algorithm steps are the same as the method of processing the original image using the "Bright Red Channel" function.

[0243] If the processing result still shows a pointer reading of "-1", then the "Bright Red Channel" function is called again. The input image is the image whose contrast has been adjusted in the original image, and whose brightness has been adjusted using the dynamic center brightness adjustment function. The remaining algorithm steps are the same as the method of processing the original image using the "Bright Red Channel" function.

[0244] If the pointer reading is -1 in all three calls to the "bright red channel" function, then the "dark red channel" function is called to process the original pointer image.

[0245] If the average gray value of the image is less than or equal to the set gray value threshold G0, the "dark red channel" function is called to process it, converting the original RGB image into a YcrCb image, separating the Y, Cr, and Cb channels, and processing the Cr channel image separately.

[0246] For the Cr channel, a low threshold AH1 and a high threshold AH2 for dark red are set, and the number of iterations is I0. The separated Cr channel image is then processed by calling the red recognition function to extract the red region based on the set dark red high and low thresholds. In this embodiment, AH1 is set to 140, AH2 to 255, and I0 to 3, but these values ​​can be adjusted according to different situations.

[0247] At the same time, determine whether a yellow chip is detected in the image. If so, fill in the detected small circle; otherwise, perform an etching operation on the red area.

[0248] The contour detection function in the OpenCV library is used to calculate the number of contours in the color region. All contours are traversed, the centroid of each contour is calculated, and it is determined whether the distance between its centroid and the center of the dial is less than or equal to the set distance threshold C. In this embodiment, C is set to 15, but the value can be changed according to different situations.

[0249] If the distance between the centroid of the contour and the center of the dial is less than or equal to the set distance threshold C, the point-to-polygon test function in OpenCV is used to detect whether the center of the dial is inside the contour. If it is inside the contour, the contour is stored and the next contour is traversed; otherwise, the next contour is traversed until the loop ends.

[0250] The subsequent algorithm steps are consistent with the algorithm steps after the initial screening of the contour traversal in the "bright red channel" function. The only change is that if the corresponding condition is not met, the low threshold AH1 for dark red is incremented by I3, becoming a new AH1, and the loop is repeated, and so on. In this embodiment, I3 is set to 2.5, but the value can be adjusted according to different situations.

[0251] Step 3: If the pointer reading is "-1" in all three calls to the "Dark Red Channel" function, then call the "Non-Red Channel" function to process the original pointer image.

[0252] The original RGB image is converted to a grayscale image, and the bitwise inversion function in the OpenCV library is used to invert the colors of the grayscale image.

[0253] For the inverted pointer image, set the low threshold FHP1 and high threshold FHP2 for non-red areas, and loop for I0 times. For the inverted pointer image, call the non-red recognition function to extract non-red areas based on the set low threshold FHP1 and high threshold FHP2. In this embodiment, FHP1 is set to 160, FHP2 to 255, and I0 to 2, but these values ​​can be adjusted according to different situations.

[0254] Erosion is performed on the non-red areas. Then, the contour detection function in the OpenCV library is used to calculate the number of contours in the non-red areas. All contours are traversed, the centroid of each contour is calculated, and it is determined whether the distance between its centroid and the center of the dial is less than or equal to the set distance threshold C. In this embodiment, C is 15, but it can be set according to different situations.

[0255] If the distance between the centroid of the contour and the center of the dial is less than or equal to the set distance threshold C, the point-to-polygon test function in OpenCV is used to detect whether the center of the dial is inside the contour. If it is inside the contour, the contour is stored and the next contour is traversed; otherwise, the next contour is traversed until the loop ends.

[0256] After the initial screening of contour traversal is completed, contour dilation is performed on contours that meet the conditions. The number of non-red pixels in the non-red area is calculated to determine whether the contour is within the set threshold range of the number of non-red pixels (FHP1, FHP2). In this embodiment, FHP1 is taken as 200 pixel values ​​and FHP2 is taken as 1600 pixel values, which can be selected according to different situations.

[0257] If the number of non-red pixels in the non-red area is not within the set threshold range, the non-red low threshold FHP1 is decreased by I4, becoming the new FHP1, and the loop is repeated, and so on. In this embodiment, I4 is 5, but the value can be chosen according to different situations.

[0258] If the number of non-red pixels in the non-red area is within the set threshold for the number of non-red pixels, then dilation and erosion morphological operations are performed on the non-red area. Then, the centroid of the contour is calculated, and it is determined whether the distance between the centroid and the center of the dial is less than or equal to the set distance threshold.

[0259] If the distance between the centroid and the center of the dial is greater than the set distance threshold, the non-red low threshold FHP1 is reduced by I4, becoming a new FHP1, and the cycle is repeated again, and so on.

[0260] If the distance between the centroid and the center of the dial is less than or equal to the set distance threshold C, then the non-red area is filled with green, the number of green pixels is calculated, and it is determined whether the number of green pixels is within the set green pixel number threshold (LP1, LP2). In this embodiment, LP1 is 200 pixel values ​​and LP2 is 1600 pixel values, which can be selected according to different situations.

[0261] If the number of green pixels is not within the set threshold (LP1, LP2) for the number of green pixels, the non-red low threshold FHP1 is decreased by I4, becoming a new FHP1, and the loop is repeated, and so on.

[0262] If the number of green pixels is within the set green pixel number threshold (LP1,LP2), then calculate the centroid of the outline, calculate the distance between the centroid and the center of the dial, select the green area with the shortest distance, and define it as the pointer outline.

[0263] After performing a closing operation on the defined pointer contour, the pointer contour is eroded and refined again, and then the pointer contour is filtered. The method for filtering the pointer contour here is the same as the "second pointer contour filtering" method in the "Brightness Canny Channel" function above, and the subsequent algorithm operations are consistent with the subsequent algorithm operations of the "second pointer contour filtering" in the "Brightness Canny Channel" function above. The part that needs to be changed is that if the corresponding condition is not met, the non-red low threshold FHP1 is decremented by I4, becoming a new FHP1, and the loop is repeated, and so on.

[0264] When the pointer reading outputs "-1", the "non-red channel" function is called again for processing. The input image is the original pointer image with only contrast adjusted. The remaining algorithm steps are the same as the method of processing the original image using the "non-red channel" function.

[0265] If the processing result still shows a pointer reading of "-1", then the "non-red channel" function is called again. The input image is the image whose contrast has been adjusted in the original image, and whose brightness has been adjusted using the dynamic center brightness adjustment function. The remaining algorithm steps are the same as the method of processing the original image using the "non-red channel" function.

[0266] Step 4: If the pointer reading is "-1" after three calls to the "Non-Red Channel" function, then call the "Brightness Canny Channel" function again to process the original pointer image. This is the "Second Call to Canny Channel Processing". For details, please refer to the "First Call to Canny Channel Processing" method above.

[0267] After the original pointer image undergoes the above multi-channel processing, the final pointer reading is output and named "pointreading". In particular, some dial types have special features, such as x10 or x0.1 models, which require further processing of the decimal string. The pointer recognition result is ultimately output as a decimal string arranged as "pointreading", preparing for the formation of the final water meter reading.

[0268] At this point, the final water meter reading is a combination of the strings NUM and pointreading.

[0269] In summary, to achieve the requirements of efficient, real-time, and low-power automatic identification, this invention proposes a community water meter image recognition and data processing system based on a cloud-edge-device architecture. This system aims to solve the problems of high recognition latency, high network pressure, and low recognition efficiency in traditional manual meter reading and centralized image recognition methods. It is particularly suitable for automatic water use monitoring and management in distributed environments with multiple meters, such as residential communities and property parks.

[0270] The system of this invention is based on a three-layer structure design, including: an end-side device (image acquisition layer) for being installed on a water meter to capture images of the meter face; an edge computing device (edge ​​processing layer) deployed inside the community, which has image recognition and reading extraction functions; and a cloud service platform (cloud management layer) for uniformly receiving recognition data, performing historical storage, visualization display, and remote control.

[0271] refer to Figure 18 Its core processing flow is as follows:

[0272] Image acquisition involves each water meter terminal automatically capturing images of the current water meter panel at set time intervals using the aforementioned camera module, and then encapsulating the image data (including timestamps, device numbers, and other metadata).

[0273] Edge processing involves uploading image data wirelessly (such as Wi-Fi, LoRa, or NB-IoT) to edge computing devices deployed within a cell, such as Raspberry Pi or Jetson Nano. These edge devices run locally deployed image recognition algorithms to process the water meter images, performing operations such as dial image stitching, character wheel recognition, and pointer recognition, and outputting the recognition results in real time.

[0274] Data upload involves edge nodes uploading the identified water meter readings and raw images to the cloud platform in a structured data format.

[0275] Cloud management involves the unified storage, classification, display, and anomaly analysis of uploaded data in the cloud, and provides a configuration interface for remotely controlling the collection frequency, identification algorithm parameters, task distribution, and updates of edge nodes.

[0276] In summary, this invention effectively reduces reflections and improves image quality through vertical dial imaging and multiple exposures, and utilizes a microcontroller-based partitioned buffer to reduce power consumption and improve transmission efficiency. In full dial recognition, the algorithm's rotation correction combined with a small pointer sorting method improves segmentation and positioning accuracy, laying the foundation for subsequent recognition. Its innovative wheel digit recognition method (especially the "higher priority" principle) effectively solves the half-digit carry problem, significantly improving reading accuracy. For pointer recognition, a traditional vision algorithm without training is used to directly calculate the reading, reducing computing power requirements and costs, and possessing adaptability and scalability for handling blurred images (suitable for ring pointer instruments). The entire system is based on a "cloud-edge-device" distributed architecture, completing recognition at the edge layer to reduce bandwidth and improve real-time performance and stability, while the cloud layer enables centralized management and scalability.

[0277] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for low-cost full-dial image acquisition and recognition for edge computing devices, the method comprising: capturing an image of a dial; identifying a dial type of the dial; and determining a dial layout of the dial based on the dial type. The method comprises the following steps: Step 1: Collecting the meter dial image through the built-in camera module of the water meter, and performing preliminary image stitching and image compression processing through the data processing module; Step 2: Sending the compressed meter dial image to the edge computing device; Step 3: The edge computing device performs water meter image stitching processing on the compressed meter dial image; Step 4: Region segmentation is performed on the stitched meter dial image to obtain the dial frame and the pointer; Step 5: Dial recognition and pointer recognition are performed on the dial frame and the pointer respectively; Step 6: The recognition results of the dial and the pointer form the final water meter reading; Step 7: The water meter reading and the compressed meter dial image are output to the cloud server.

2. The method of claim 1, wherein: In step 1, the data storage module of the data processing module stores half of the image data obtained by a single shooting in the first cache area and the other half in the second cache area; the image stitching module of the data processing module takes one half of each of the two complete dial images, and combines and saves them as a preliminary stitched image; The JPEG algorithm is selected to compress the captured dial image, that is, the image compression module in the data processing module is used to perform YCrCb color space merging on the preliminary stitched image by using the JPEG compression algorithm, and the image data is compressed through DCT transformation, quantization and entropy encoding; The DCT transformation used in the JPEG compression algorithm converts the image block from the spatial domain to the frequency domain, separates the low-frequency and high-frequency information, quantizes the DCT coefficients, and discards the details of the high-frequency part; finally, the quantized data is compressed through Huffman encoding.

3. The method of claim 1, wherein: In step 2, the image compression is divided into the following two execution situations: (1) Adjusting the compression on the single-chip microcomputer built in the water meter head reader, and outputting the preliminary stitched image to the edge computing device as a target image after adjusting and compressing it on the single-chip microcomputer through the image output module of the data processing module; (2) Saving the preliminary stitched image and directly outputting it to the edge computing device as a target image after adjusting and compressing the stitching color in the server cluster area of the edge device.

4. The method of claim 1, wherein: In step 3, based on the target image, the inverse conversion of the JPEG decoder is used to convert the YCrCb data to RGB data to obtain a secondary target image; An image optimization algorithm is used to process the secondary target image, and the steps are as follows: Step 1: Using the perfect reflection algorithm in the white balance algorithm in the OpenCV library to preprocess the secondary target image; Step 2: Splitting the image horizontally and vertically after step 1 to obtain a split image; Step 3: If the structural similarity index A of the split image in step 2 is greater than or equal to the structural similarity index threshold A0, then merge the left and right images and perform YCrCb optimization processing; Step 4: Performing histogram equalization on the optimized image in step 3 to output a tertiary target image; Step 5: If the structural similarity index A of the split image in step 2 is less than the structural similarity index threshold A0, then adjust the brightness and contrast of the split image in a block adaptive manner and merge the left and right images; The algorithm steps for adjusting the brightness and contrast of the split image in a block adaptive manner are as follows: (1) If the left image brightness value LB is greater than or equal to the right image brightness value RB, the left image brightness LB and the contrast value LC are taken as the reference to adjust the brightness and contrast of the right image; (2) If the left image brightness value LB is less than the right image brightness value RB, the right image brightness RB and the contrast value RC are taken as the reference to adjust the brightness and contrast of the left image; Step 6: If the boundary gradient value B of the merged image in step 5 is less than or equal to the boundary gradient threshold B0, YCrCb optimization processing is performed; otherwise, the horizontal segmentation of the merged image is repeated to perform the operation of step 5. Step 7: The image optimized in step 6 is subjected to histogram equalization, and a third target image is output.

5. The method of claim 4, wherein: The step four, the full dial image recognition is performed on the third target image of step 7, and the full dial image recognition mainly includes two parts of recognition, the first part of recognition is the numeral recognition of the numeral wheel frame, and the second part of recognition is the pointer recognition; before the above two parts of recognition are carried out, the full dial image is first subjected to rotation correction; The dial image subjected to rotation correction is subjected to region segmentation, and the numeral wheel frame region and the pointer region are focused; after the region segmentation is completed, the numeral wheel frame region and the pointer region are subjected to corresponding recognition.

6. The method of claim 5, wherein: For the first part of the numeral wheel frame region, the segmented numeral wheel region is first saved by taking a screenshot, the screenshot of the numeral wheel region is subjected to recognition by a numerical value recognition module, and the position data and area data of each recognized numerical value are subjected to interference value filtering by a filtering module, so that more accurate numeral wheel numerical values are screened out, and the upper priority principle is adopted throughout the entire recognition process for the half-numeral condition, so that the principle consistency of the entire process is ensured. For the case that the first-recognized numeral wheel numerical value does not include the half-numeral condition, each numerical value is arranged according to the X-axis coordinate, and is output in the form of a string as the final recognition value of the numeral wheel, and is named as NUM. For the case that the first-recognized numeral wheel numerical value includes the half-numeral condition, each numerical value is arranged according to the X-axis coordinate, and is output in the form of a string as the first-recognized recognition value of the numeral wheel, and is named as NUM1; the half-numeral target frame position is proportionally covered, the numeral wheel numerical value is recognized by a numerical value recognition module, and then each recognized numerical value is arranged according to the X-axis coordinate and is output in the form of a string, and is named as NUM2; the existing NUM1 and NUM2 are compared by a selection module, and the selection and change of numerical values are performed to form a new NUM, and the so-called carry operation on the water meter is realized at this position; finally, the result of the numeral wheel recognition is output in the form of an integer string NUM, which prepares for the final water meter reading.

7. The method of claim 5, wherein: Before the second part of the pointer recognition, for the first pointer, the pointer with the shortest distance to the center of the numeral wheel outline is found on the right side of the numeral wheel frame, and is defined as the first pointer, and the pointer image is cut off according to the set n*n size, saved and output, and the reading recognition is performed by using the pointer recognition method; if the first pointer cannot be determined, the subsequent pointer determination is not performed. After finding the first pointer, the angle between the next pointer and the previous pointer relative to the center of the whole water gauge dial is determined in a clockwise direction. If the angle is within a specified angle threshold, the pointer is valid, and the pointer image is captured according to the specified size, saved and output. The pointer recognition method is used to recognize the reading, and the pointer reading is output. If the angle is not within the specified angle threshold, the pointer is invalid, and the subsequent pointer determination is stopped. The same is true for the subsequent pointers. Before adding the valid pointer readings as a string, further valid pointer reading determination is performed. The pointer reading "NULL" is defined as an invalid pointer reading, which is an abnormal condition. For the normal condition of the pointer reading, the corresponding pointer reading is added to the pointer reading sequence. If the abnormal condition of the pointer reading "NULL" occurs, the corresponding pointer reading is set to "0", and the subsequent reading is not added to the reading sequence.

8. The method of claim 7, wherein: The captured pointer image is used as the original image, the contrast and brightness of the original image are adjusted, and then the original image is converted into a grayscale image. The grayscale image is subjected to Gaussian blur processing, and the center of the dial and the center of the small circle are obtained by using Hough circle detection. If a circular dial is detected, and the distance between the center of the largest circle and the center of the image is within a specified distance threshold C, the center of the circle is the center of the dial. Otherwise, the center of the image is the center of the dial. If a small circle is detected, and the radius of the small circle is within a specified radius threshold, the center of the small circle is calculated to prepare for subsequent large pointer recognition. Otherwise, the center of the small circle is defaulted to (0, 0).

9. The method of claim 8, wherein: The captured pointer image is used as the original image, which is then converted into a grayscale image. The image information entropy of the grayscale image is then determined by using an image index function. If the image information entropy is less than the specified image information entropy threshold ET, it is determined whether the average grayscale value of the image is less than or equal to the specified average grayscale low threshold G1. If the average grayscale value of the image is less than or equal to the specified average grayscale low threshold G1, the image reason "light is too weak" and the pointer reading "-1" are output. Otherwise, it is determined whether the average grayscale value of the image is greater than or equal to the specified average grayscale high threshold G2. If the average grayscale value of the image is greater than or equal to the specified average grayscale high threshold G2, the image reason "light is too strong" and the pointer reading "-1" are output. Otherwise, the image reason "information entropy is too low" and the pointer reading "-1" are output. If the image information entropy is greater than or equal to the specified image information entropy threshold ET, it is determined whether the edge density of the image is within the specified edge density (ED0, ED1) range. The edge density is calculated by using the Canny operator to detect the edge, and then calculating the proportion of the edge pixels in the entire image. If the edge density of the grayscale image is less than the specified edge density threshold ED1, and the edge density of the grayscale image is less than the specified edge density threshold ED2, and the image noise is less than the specified image noise threshold N, the image is defined as a "very blurred image", which is filtered, and the pointer reading is "-1". If the edge density of the gray image is less than ED1, and the edge density of the gray image is greater than or equal to ED2, and the image noise is greater than or equal to N, the image is defined as a "relatively blurred image", thereby achieving pointer image filtering.

10. The method of claim 9, wherein: The pointer image satisfying the condition is taken as an original image, and image recognition is performed through a multi-channel cooperative processing module; Step 1: the relatively blurred image first calls a brightness Canny channel processing function, and judges whether it passes or not, and if it passes, a pointer reading pointreading is outputted; Step 2: if step 1 fails, the original image, the image after adjusting the contrast of the original image, and the image after adjusting the contrast and brightness of the original image are sequentially called to process the pointer image through a "red channel", and it is judged whether it passes or not, and if it passes, the pointer reading pointreading is outputted; The "red channel" is divided into two cases, the first case is a "bright red channel", and the second case is a "dark red channel"; the original image is converted into a gray image, the average gray value of the image is calculated, if the average gray value of the image is greater than a set gray value threshold G0, the "bright red channel" function is called to process; otherwise, the "bright red channel" function is called to process; Step 3: if step 2 fails, the original image, the image after adjusting the contrast of the original image, and the image after adjusting the contrast and brightness of the original image are sequentially called to process the pointer image through a "non-red channel", and it is judged whether it passes or not, and if it passes, the pointer reading pointreading is outputted; Step 4: if step 3 fails, the original image secondly calls the "brightness Canny channel" processing function, and it is judged whether it passes or not, and if it passes, the pointer reading pointreading is outputted; otherwise, the pointer reading pointreading is set as "NULL" to output the result.

Citation Information

Patent Citations

  • A method for recognizing full and half characters based on character wheel characters

    CN110991449B

  • Pointer type instrument reading method and system based on deep neural network

    CN114067230A

Cited By

  • Intelligent water meter system based on AI visual identification

    CN121921497A

  • An intelligent water meter system based on AI visual recognition

    CN121921497B