Self-calibration water gauge reading method and device, electronic equipment and storage medium
By performing multi-view processing and optical character recognition on the water level gauge image, the correlation between the water level gauge scale lines and numbers is established, which solves the problems of low efficiency and low reliability of traditional water level monitoring and realizes automated self-calibration of water level detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ISOFTSTONE INFORMATION TECHNOLOGY (GROUP) CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional water level monitoring relies on manual readings, which is inefficient and easily affected by environmental factors. Image recognition methods have low reliability due to the imperfect characteristics of the water gauge scale, and cannot reliably and accurately establish a mapping relationship between the water gauge image and the actual water level.
By identifying multiple second images and employing contrast enhancement, stroke enhancement, and light sharpening processes, candidate sequences are extracted and reference pairing information is generated. This establishes the association between the water gauge scale lines and the numbers, enabling automated self-calibration.
It improves the accuracy and anti-interference ability of water level readings, reduces labor costs and operational errors, and enhances the automation level and efficiency of water level detection.
Smart Images

Figure CN121904342A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a self-calibrated water level gauge reading method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the acceleration of water conservancy digitalization and the advancement of smart water management, the accuracy, robustness, and engineering application capabilities of automatic water level monitoring have become crucial for ensuring the safety of water conservancy projects and realizing the scientific allocation of water resources.
[0003] Traditional water level monitoring relies on manual readings of water gauges, which is not only inefficient but also susceptible to interference from environmental factors such as severe weather and changes in lighting. Furthermore, the monitoring results are highly dependent on operator experience, making it difficult to meet the needs of large-scale and automated monitoring. Therefore, image recognition-based automated water level monitoring methods have emerged. However, these methods have significant technical limitations. In practical applications, water gauges often exhibit non-ideal scale characteristics, such as localized wear, unequal spacing of graduations, or splicing after breakage. This makes it impossible to stably and accurately establish a mapping relationship between the water gauge image and the actual water level, resulting in relatively low reliability for image recognition-based water level monitoring methods. Summary of the Invention
[0004] This invention provides a self-calibrated water gauge reading method to solve the problem of low accuracy and stability of water gauge readings due to inaccurate water gauge calibration information.
[0005] According to one aspect of the present invention, a self-calibrated water level gauge reading method is provided, the method comprising:
[0006] A plurality of second images are identified in association with a first image. The first image is an image acquired by image acquisition towards the target water gauge. The plurality of second images include a reference view obtained by identifying the region of interest in the first image that includes the water gauge scale line and water gauge number of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement and light sharpening.
[0007] Multiple candidate sequences are determined based on multiple second images. Each candidate sequence is used to indicate the candidate numeric character extracted from the optical character recognition results of multiple second images corresponding to different views, which corresponds to the same water gauge number position in the multiple second images corresponding to different views.
[0008] Reference pairing information is determined based on multiple candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge number position and the water gauge scale line.
[0009] The self-calibration water gauge configuration information is determined based on the reference pairing information and is used to identify the water level results detected by the target water gauge. The self-calibration water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line in the first image and the corresponding scale value of each water gauge scale line.
[0010] According to another aspect of the present invention, a self-calibrating water level gauge reading device is provided, the device comprising:
[0011] An image determination module is used to determine a plurality of second images associated with a first image. The first image is an image acquired by image acquisition towards a target water gauge. The plurality of second images include a reference view obtained by identifying a region of interest in the first image that includes the water gauge scale lines and water gauge numbers of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement, and light sharpening.
[0012] The candidate sequence determination module is used to determine multiple candidate sequences based on the multiple second images, each candidate sequence being used to indicate a candidate numeric character extracted from the optical character recognition results of the multiple second images corresponding to different views, which corresponds to the same water gauge number position in the multiple second images corresponding to different views;
[0013] The pairing information determination module is used to determine reference pairing information based on the multiple candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge numeric position and the water gauge scale line.
[0014] The water gauge information determination module is used to determine the self-calibrated water gauge configuration information based on the reference pairing information, and is used to identify the water level detection results of the target water gauge. The self-calibrated water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line of the target water gauge in the first image and the corresponding scale value of each water gauge scale line.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] At least one processor; and
[0017] A memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the self-calibrated water level reading method according to any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the self-calibrating water level reading method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the self-calibrating water level reading method according to any embodiment of the present invention.
[0021] The technical solution of this invention, by determining multiple second images associated with a first image, can clearly identify the region of interest (ROI) in the image, including the water gauge scale lines and numbers of the target water gauge. Furthermore, by employing at least one view processing method among contrast enhancement, stroke enhancement, and mild sharpening, the features of the water gauge scale lines and numbers are ensured to be clearer, reducing interference from factors such as image blurring, insufficient contrast, and water gauge aging. Based on the optical character recognition results of multiple second images corresponding to different views, candidate digit characters corresponding to the same water gauge number position are extracted, and multiple candidate sequences are generated. This ensures that each digit position has multi-view verification basis, avoiding misjudgment of digit characters due to single-view recognition bias, thereby improving the accuracy of the digit character corresponding to each digit position. Reference pairing information is determined based on multiple candidate sequences, through multiple... The mutual verification of candidate sequences improves the accuracy of the pairing relationship between the target numerical characters and scales at each water gauge position, reducing the risk of water level calibration errors due to mismatches between water gauge scale lines and corresponding numerical characters. It also enables multi-view recognition support for each water gauge position, fully utilizing the recognition advantages of different optimized views and avoiding character misjudgments caused by single-view recognition bias. By integrating candidate characters at the same position to form multiple candidate sequences, comprehensive verification basis can be provided for subsequent determination of target numerical characters, thus ensuring the accuracy of character selection. Based on reference pairing information, a correlation can be established between the pixel position of each water gauge scale line in the first image and the water level value indicated by the corresponding scale value, thereby achieving automated self-calibration of water gauge readings and improving the adaptability of water gauge readings under different imaging conditions. Based on the above technical solutions, the problems of low efficiency and large error in manual calibration and inaccurate water level readings caused by mismatch between numbers and scales when reading water level gauges using image recognition can be solved. Automated water level gauge self-calibration can be achieved, reducing labor costs and operational errors. The anti-interference ability and accuracy of water level gauge readings can be improved, and the automation level and detection efficiency of water level detection can be enhanced.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of a self-calibrated water level gauge reading method provided by an embodiment of the present invention;
[0025] Figure 2 This is a flowchart of another self-calibrated water level gauge reading method provided by an embodiment of the present invention;
[0026] Figure 3 This is a flowchart of another self-calibrated water level gauge reading method provided by an embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of a self-calibrating water level gauge reading device according to an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the self-calibrated water level gauge reading method of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] Figure 1 The flowchart illustrates a self-calibrating water level reading method provided in this embodiment of the invention. This embodiment is applicable to situations requiring automatic water level monitoring based on images or videos. The self-calibrating water level reading method can be executed by a self-calibrating water level reading device, which can be implemented in hardware and / or software. The self-calibrating water level reading device can be configured in any electronic device with network communication capabilities.
[0032] like Figure 1 As shown, the self-calibrated water level reading method provided in this embodiment may include the following process:
[0033] S110. Determine a plurality of second images associated with the first image. The first image is an image obtained by image acquisition towards the target water gauge. The plurality of second images include a reference view obtained by identifying the region of interest in the first image that includes the water gauge scale line and water gauge number of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement and light sharpening.
[0034] The first image can refer to the raw image directly obtained by image acquisition towards the target water gauge. The second image can refer to a related view formed by processing the first image. The region of interest can refer to a specific image region identified from the first image that contains the water gauge scale lines and water gauge numbers of the target water gauge. The reference view can refer to the base view obtained after extracting the region of interest from the first image.
[0035] Contrast enhancement refers to increasing the difference between bright and dark areas in a view to make the ruler's scale lines and numbers clearer and more distinguishable. Stroke enhancement refers to strengthening the outline of the ruler's numerals to improve their recognizability. Mild sharpening refers to moderately increasing the sharpness of the view's edges to highlight the ruler's scale lines and numeral boundaries.
[0036] First, a first image is acquired facing the target water gauge. Then, a region of interest detection algorithm is used to identify the region of interest in the first image, including the target water gauge scale lines and water gauge numbers, as a reference view. Subsequently, the reference view is processed using at least one of the following view processing methods: contrast enhancement, stroke enhancement, and light sharpening. Finally, multiple second images containing the reference view and the processed view are obtained.
[0037] By identifying the region of interest containing the target water gauge scale lines and water gauge numbers as a reference view, the image area for subsequent processing operations can be clearly defined, avoiding interference from irrelevant image areas. By combining at least one of the view processing methods such as contrast enhancement, stroke enhancement, and light sharpening, it can be ensured that the water gauge scale lines and water gauge numbers remain clear, effectively improving the feature blurring problem caused by poor image imaging or water gauge aging and wear.
[0038] S120. Based on multiple second images, determine multiple candidate sequences. Each candidate sequence is used to indicate the candidate digit character extracted from the optical character recognition results of multiple second images corresponding to different views, which corresponds to the same water gauge digit position in the multiple second images corresponding to different views.
[0039] The same water gauge number location can refer to the position of the same number mark on the target water gauge in different views of multiple second images. Candidate digit characters can refer to the digit characters to be confirmed obtained after optical character recognition of the same water gauge number location in different views.
[0040] Optical character recognition (OCR) is performed on different views corresponding to the second image. Then, candidate numeric characters corresponding to the same water gauge digit position in the different views corresponding to multiple second images are extracted from the recognition results of each view. Multiple candidate numeric characters can correspond to each water gauge digit position. Optionally, during the OCR process, a corresponding recognition confidence score is generated for each recognition result. Based on a preset candidate number threshold, all recognition results are sorted in descending order of recognition confidence score for the same water gauge digit position, and only candidate numeric characters with the highest recognition confidence score and a number equal to the preset candidate number threshold are retained. For example, the preset candidate number threshold can range from 3 to 5.
[0041] Based on the multiple candidate numeric characters corresponding to each water gauge number position, multiple candidate sequences can be obtained. Each candidate sequence is obtained by combining the candidate numeric characters corresponding to each water gauge number position in column arrangement order. Each candidate sequence can represent a complete numeric column in the target water gauge.
[0042] By extracting candidate digits for the same water gauge position from the optical character recognition results of multiple second images from different views and forming multiple candidate sequences, each water gauge position can have recognition criteria under multiple views. This can avoid misjudgment of digits due to imaging deviation in a single view and affect the accuracy of water gauge readings.
[0043] S130. Determine reference pairing information based on multiple candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge numeric position and the water gauge scale line.
[0044] According to preset rules or algorithms, by cross-validating multiple candidate sequences, the optimal candidate sequence can be determined from among them, thereby clarifying the target numeric character corresponding to each position on the target water gauge. The target numeric character can refer to the accurate numeric character determined from multiple candidate numeric characters at the same position on the water gauge. Then, based on the relative positional relationship between each water gauge position and the water gauge scale line, each target numeric character is associated and matched with its corresponding water gauge scale line, thus clarifying the binding relationship between the target numeric character at each water gauge position and the water gauge scale line, i.e., obtaining the reference pairing information. For example, the preset rules or algorithms can refer to a rule table established based on the physical constraints of the water gauge, a dynamic programming algorithm, or a support vector machine, etc.
[0045] S140. Determine the self-calibration water gauge configuration information based on the reference pairing information, which is used to identify the water level results detected by the target water gauge. The self-calibration water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line in the first image and the corresponding scale value of each water gauge scale line.
[0046] By acquiring the pixel positions of each scale line in the target water gauge within the first image, and based on the binding relationship between the target numeric characters corresponding to each water gauge number position indicated by the reference pairing information and the water gauge scale lines, the association between the pixel positions of each water gauge scale line in the first image and the actual scale values corresponding to each scale line can be determined; this is the self-calibration water gauge configuration information. The actual scale value corresponding to each scale line can be determined by the target numeric characters corresponding to each water gauge number position bound to each water gauge scale line.
[0047] By determining the self-calibrated water gauge configuration information based on the reference pairing information, the correlation between the pixel position of the target water gauge scale line and the corresponding scale value can be established. This enables automated and autonomous calibration of water gauge readings, avoiding the tedious operation and errors of manual calibration and improving the automation level of water level detection. By ensuring the accuracy of the correspondence between the scale value and the pixel position of the scale line, the accuracy and efficiency of water level identification results can be improved.
[0048] The technical solution of this invention, by determining multiple second images associated with a first image, can clearly identify the region of interest (ROI) in the image, including the water gauge scale lines and numbers of the target water gauge. Furthermore, by employing at least one view processing method among contrast enhancement, stroke enhancement, and mild sharpening, the features of the water gauge scale lines and numbers are ensured to be clearer, reducing interference from factors such as image blurring, insufficient contrast, and water gauge aging. Based on the optical character recognition results of multiple second images corresponding to different views, candidate digit characters corresponding to the same water gauge number position are extracted, and multiple candidate sequences are generated. This ensures that each digit position has multi-view verification basis, avoiding misjudgment of digit characters due to single-view recognition bias, thereby improving the accuracy of the digit character corresponding to each digit position. Reference pairing information is determined based on multiple candidate sequences, through multiple... The mutual verification of candidate sequences improves the accuracy of the pairing relationship between the target numerical characters and scales at each water gauge position, reducing the risk of water level calibration errors due to mismatches between water gauge scale lines and corresponding numerical characters. It also enables multi-view recognition support for each water gauge position, fully utilizing the recognition advantages of different optimized views and avoiding character misjudgments caused by single-view recognition bias. By integrating candidate characters at the same position to form multiple candidate sequences, comprehensive verification basis can be provided for subsequent determination of target numerical characters, thus ensuring the accuracy of character selection. Based on reference pairing information, a correlation can be established between the pixel position of each water gauge scale line in the first image and the water level value indicated by the corresponding scale value, thereby achieving automated self-calibration of water gauge readings and improving the adaptability of water gauge readings under different imaging conditions. Based on the above technical solutions, the problems of low efficiency and large error in manual calibration and inaccurate water level readings caused by mismatch between numbers and scales when reading water level gauges using image recognition can be solved. Automated water level gauge self-calibration can be achieved, reducing labor costs and operational errors. The anti-interference ability and accuracy of water level gauge readings can be improved, and the automation level and detection efficiency of water level detection can be enhanced.
[0049] Figure 2 This is a flowchart of another self-calibrated water level gauge reading method provided by an embodiment of the present invention. This embodiment further refines the process of determining multiple second images associated with the first image in the above embodiment.
[0050] like Figure 2 As shown, the self-calibrated water gauge reading method provided in this embodiment of the invention may include the following process:
[0051] S210. Determine multiple candidate regions of interest associated with the first image. The multiple candidate regions of interest are regions of interest extracted from the first image using multiple regions of interest extraction methods, including the water gauge scale lines and water gauge numbers of the target water gauge. The multiple regions of interest extraction methods include regions of interest extraction based on optical character recognition anchor point aggregation, regions of interest extraction based on depth detection, and regions of interest extraction based on geometric consistency verification.
[0052] Candidate regions of interest can refer to regions of interest extracted from the first image using different regions of interest extraction methods. Candidate regions of interest can completely cover the water gauge scale lines and water gauge numbers of the target water gauge.
[0053] The region of interest (ROI) extraction method based on optical character recognition (OCR) anchor point aggregation refers to performing OCR on a first image and aggregating the candidate bounding boxes of digits obtained from OCR to obtain candidate ROIs. The ROI extraction method based on OCR anchor point aggregation focuses on the digits in the watermark and their distribution pattern in columns. Specifically, by performing OCR on the first image, multiple candidate bounding boxes of digits that meet a preset first confidence threshold are obtained; clustering is performed according to the horizontal coordinate of the center position of each candidate bounding box to obtain multiple candidate digit columns; the minimum bounding rectangle of each candidate digit column is obtained, and the image area covered by the obtained minimum bounding rectangle is taken as the candidate ROI.
[0054] The depth-detection-based region of interest (ROI) extraction method refers to performing water gauge target detection on a first image using a depth detection algorithm, and extracting candidate ROIs based on the detected water gauge location. This method focuses on locating the complete water gauge subject. Specifically, a lightweight single-stage object detector is used to perform water gauge target detection on the first image, obtaining multiple water gauge target detection boxes that meet a preset second confidence threshold. These boxes are then expanded vertically by a preset ratio to ensure they cover the water gauge's edge markings. The image area covered by the expanded water gauge target detection boxes is then used as the candidate ROI. For example, the preset ratio can be 0.05-0.25.
[0055] The region of interest (ROI) extraction method based on geometric consistency verification refers to the method of extracting candidate ROIs by performing consistency verification based on the geometric distribution patterns of the water gauge scale lines and the numbers on the water tank. The focus of this method is on the structure of the water gauge and the distribution patterns of its scale lines. Specifically, edge detection and Hough transform are used to extract a set of high-density vertical line segments distributed along the length of the water gauge and a set of equally spaced horizontal short lines perpendicular to these segments from the first image. The set of high-density vertical line segments may include the water gauge's vertical border lines and main vertical scale lines, while the set of equally spaced horizontal short lines may include the water gauge scale lines. Based on these two sets, a spatial density distribution map of the first image is constructed. The region with the densest distribution of vertical straight lines in the spatial density distribution map, i.e., the vertical density ridge, is searched. Using the vertical density ridge as a reference and considering the distribution range of the equally spaced horizontal short lines, candidate ROIs are determined.
[0056] By employing multiple region of interest (ROI) extraction methods to extract multiple candidate ROIs from the first image, each ROI extraction method focuses on the water gauge numbers and their distribution patterns, the complete location of the water gauge, its structure, and the distribution patterns of its scale lines. This allows the candidate ROIs to incorporate support from multiple dimensions of the target water gauge features. This avoids the omission or error in ROI extraction due to insufficient adaptability of a single extraction method, and also avoids instability caused by complex backgrounds, reflections, occlusions, and interference from similar textures. This provides a comprehensive selection space for subsequent accurate ROI extraction.
[0057] S220. Determine multiple first results and second results associated with multiple candidate regions of interest. The multiple first results are the intersection-union ratios of the two candidate regions of interest in each group calculated by grouping each pair of different candidate regions of interest into a group. The second results are used to measure the matching degree between the candidate regions of interest and the preset feature rules of the target water level.
[0058] The first result refers to grouping multiple candidate regions of interest (ROIs) into pairs of distinct ROIs and calculating the intersection-union ratio (IUU) for each pair. This ratio measures the degree of overlap and matching between the different ROIs. A higher first result value indicates a more reliable candidate ROI.
[0059] The second result can refer to a quantitative indicator used to measure the degree of matching between a single candidate region of interest and the preset feature rules of the target water level. The greater the degree of matching, the larger the value of the second result, indicating that the reliability of the candidate region of interest is higher.
[0060] Preset feature rules can refer to pre-defined judgment rules that conform to the inherent characteristics of the distribution pattern and relative position of the water gauge scale lines and water gauge numbers. Optionally, preset feature rules may include the angle between the arrangement direction of the water gauge numbers in the candidate region of interest and the arrangement direction of the standard water gauge numbers being less than a preset angle threshold, and the difference between the scale line density in the candidate region of interest and the scale line density in the standard water gauge being less than a preset density difference threshold.
[0061] The first result is obtained by calculating the intersection-union ratio (IU) of multiple candidate regions of interest (ROIs) pairwise. Simultaneously, the second result is obtained by verifying the matching degree between each candidate ROI and the preset feature rules. This two-dimensional evaluation of candidate ROIs avoids the bias in ROI evaluation caused by a single-dimensional approach.
[0062] S230. Based on multiple first results and second results and multiple candidate regions of interest, determine a target region of interest from the first image, and determine a reference view based on the target region of interest to determine multiple second images associated with the first image.
[0063] A pre-defined result fusion method is used to fuse multiple first and second results to obtain multiple comprehensive result scores, each corresponding to a candidate region of interest (ROI). The candidate ROI with the highest comprehensive result score is selected as the target ROI. The image region covered by the target ROI in the first image is extracted as a reference view. Based on the reference view, multiple second images associated with the first image can be determined. Selecting the target ROI based on the first and second results ensures that the selected target ROI conforms to the core features of the water level gauge, improving the accuracy of both the target ROI and the reference view extraction.
[0064] If there are multiple candidate regions of interest with the highest and consistent overall score, these multiple candidate regions of interest with the highest and consistent overall score can be retained, and subsequent operations can be performed independently on each of the retained candidate regions of interest.
[0065] As an optional but not limited implementation, steps A1-A3 are included before determining the reference view based on the target region of interest:
[0066] Step A1: Perform multi-scale contrast enhancement on the target region of interest to suppress non-uniform illumination interference within the target region of interest.
[0067] Before determining the reference view, the target region of interest (ROI) image is preprocessed by performing multi-scale contrast enhancement on the ROI. This effectively suppresses non-uniform illumination interference within the region and improves the initial contrast of the water level gauge numerals, scales, and background, laying a clear foundation for subsequent image segmentation and feature extraction. For example, a Retinex-inspired local contrast enhancement method can be used to achieve multi-scale contrast enhancement of the ROI.
[0068] Step A2: Convert the image pixels of the target region of interest to HSV or Lab color space, and perform fast clustering to initially divide the pixels into background, paint layer, and number or scale layer categories; and update the cluster centers of each color category with an exponential moving average over time to adapt to the long-term changes in the watermark color, and generate a paint mask based on the clustering results of the paint layer category, and obtain the target image layer through mask peeling operation. The target image layer is an image layer characterized by numbers and scales and with enhanced contrast between it and the background.
[0069] Among them, the time-dimensional exponential moving average update can refer to the dynamic update of cluster centers based on time series, which weakens short-term fluctuations and preserves long-term trends through the exponential moving average algorithm.
[0070] Image pixels of the target region of interest are converted to HSV or Lab color space. Initially, pixels are divided into three categories using fast clustering: background, paint layer, and number / scale layer. The background category refers to the pixel category corresponding to the background area of the watermark after clustering; the paint layer category refers to the pixel category corresponding to the paint area on the watermark surface after clustering; and the number / scale layer category refers to the pixel category corresponding to the number or scale area of the watermark after clustering. Simultaneously, the cluster centers of each color category are updated using an exponential moving average over time to adapt to long-term color changes on the watermark, ensuring dynamic adaptability of the clustering classification. A paint mask is then generated based on the clustering results of the paint layer category. The target image layer is obtained through mask peeling. The resulting target image layer features numbers and scales as core features and exhibits significantly enhanced contrast with the background, effectively avoiding interference from irrelevant background and paint layer.
[0071] Step A3: Perform adaptive thresholding on the target image layer to obtain a binarized image of the target image layer, and remove small connected components in the binarized image of the target image layer to eliminate noise interference; and perform skeletonization or thinning operations on the processed image to highlight the stroke features of numbers or scales, and fill the hole areas in the target image layer to maintain the connectivity of numbers or scales.
[0072] Adaptive thresholding is performed on the target image layer to obtain a binarized image. Small connected components in the binarized image are removed to eliminate noise interference and improve image purity. Then, skeletonization or thinning operations are performed on the processed image to highlight the stroke features of numbers or scales. At the same time, hole areas in the image are filled to maintain the connectivity of numbers or scales and ensure the integrity and recognizability of core features.
[0073] By using multi-dimensional contrast enhancement, clustering segmentation, noise removal, and feature optimization, problems such as non-uniform lighting, long-term color changes of water level gauges, and background interference can be effectively solved, thereby improving the clarity, integrity, and recognizability of numbers and scale lines in the target image layer.
[0074] As an optional but not limited implementation, steps B1-B5 are included before determining the reference view based on the target region of interest:
[0075] Step B1: Perform attitude correction on the target water gauge within the target region of interest by performing coarse rotation estimation.
[0076] Coarse rotation estimation refers to the operation of making a preliminary judgment on the tilt attitude and rotation angle of the target water gauge in the region of interest, which is used to achieve preliminary correction of the water gauge's attitude. Attitude correction refers to the image processing operation of adjusting the tilt state of the target water gauge based on the coarse rotation estimation results, so that the water gauge is roughly in a reference attitude perpendicular to the horizon.
[0077] Optionally, by performing coarse rotation estimation on the target region of interest, attitude correction is performed on the target water gauge within the target region of interest, specifically including:
[0078] The edge contours of the binarized image of the target region of interest (ROI) are processed using the PCA algorithm or the rotating rectangle fitting algorithm to extract the target direction. The target direction is determined as the coarse rotation angle of the target water level gauge in the ROI. The ROI is then rotated according to the coarse rotation angle of the target water level gauge to align the target with the reference direction. The target direction is the feature direction representing the overall orientation of the target water level gauge, extracted by analyzing the geometric features of the edge or contour of the target water level gauge in the ROI. The reference direction is the standard reference direction in the image space. The coarse rotation angle of the target water level gauge is used to measure the degree of tilt of the target water level gauge.
[0079] Step B2: Extract the left and right edge straight line pairs of the target water gauge in the region of interest after attitude correction, and estimate the homography matrix of the output perspective transformation based on the horizontal consistency constraint of the scale lines.
[0080] The left and right edge line pair refers to the two straight lines corresponding to the longitudinal contours of the left and right sides of the target water level gauge after attitude correction. The horizontal consistency constraint of the scale lines refers to the pre-defined inherent constraint that the scale lines on the target water level gauge should maintain a horizontal distribution. Perspective transformation refers to an image processing method that converts tilted or distorted image regions into regular regions conforming to perspective rules through homography matrix mapping. The homography matrix refers to a matrix used to characterize the pixel coordinate mapping relationship in perspective transformation, enabling perspective correction of image regions.
[0081] Step B3: Perform perspective transformation on the pose-corrected region of interest based on the homography matrix of perspective transformation to obtain the pose-corrected target region of interest.
[0082] Step B4: Calculate the vertical residual of the numerical column, the horizontal residual of the scale line, and the edge parallelism in the perspective-corrected region of interest. Edge parallelism is used to measure the degree of parallelism between the longitudinal edges of the target water gauge on both sides in the perspective-corrected region of interest.
[0083] The vertical residual of the numerical column refers to the degree of deviation between the actual distribution of the numerical column on the target water level gauge and the ideal vertical state after perspective correction. The horizontal residual of the scale lines refers to the degree of deviation between the actual distribution of the scale lines on the target water level gauge and the ideal horizontal state after perspective correction. The vertical residual of the numerical column, the horizontal residual of the scale lines, and the edge parallelism in the target region of interest after perspective correction can be used to comprehensively evaluate the perspective correction effect.
[0084] Step B5: Using the vertical residual of the number column, the horizontal residual of the scale line, and the parallelism of the edge as the objective function, the homography matrix of the perspective transformation is corrected by a small-step iterative method. The region of interest of the perspective correction target is updated and the objective function value is recalculated in each iteration until the objective function value converges to the preset threshold or the upper limit of the number of iterations is reached, at which point the iteration stops.
[0085] The homography matrix is corrected by a small-step iterative method. After each iteration, the target region of interest after perspective correction is updated and the objective function value is recalculated. The objective function value can be used to quantify the perspective correction effect. The iteration continues until the objective function value converges to a preset threshold or the number of iterations reaches a preset upper limit, so as to complete the accurate correction of the water gauge posture and perspective.
[0086] By correcting the water gauge's posture and perspective distortion, the regularity and recognizability of the numerical characters and scale lines in the water gauge can be improved. This can avoid interference from factors such as perspective distortion and water gauge tilt in subsequent processing and enhance the adaptability to different postures and imaging angles of the water gauge.
[0087] As an optional but not limited implementation, the reference view is determined based on the target region of interest, including:
[0088] By employing edge detection, Hough line detection, and clustering detection methods to jointly detect the target region of interest, different types of scale lines in the target region of interest are identified. The different types of scale lines in the target region of interest are deduplicated according to the consistency of scale direction and the constraint of scale spacing. The different types of scale lines are divided according to the length of the scale lines. The consistency of scale direction means that the scale lines are kept in the horizontal direction. The constraint of scale spacing is used to indicate that the distance between adjacent scale lines must be within the preset distance range.
[0089] Density clustering is used to remove isolated line segments and noise from different types of tick marks in the target region of interest, generating a reference view containing an ordered sequence of tick marks.
[0090] Different types of scale lines refer to water gauge scale lines of various length specifications formed by dividing the scale lines according to their length. Specifically, the identified scale lines can be classified according to multiple preset scale line length thresholds. Furthermore, according to the water gauge scale classification and scale value labeling specifications, each length specification of water gauge scale line corresponds to a fixed type of water gauge scale value. For example, if the identified scale line is greater than the first preset scale line length threshold, the identified scale line is a long scale and can correspond to a multiple of ten scale value; if the identified scale line is not greater than the first preset scale line length threshold but is greater than the second preset scale line length threshold, the identified scale line is a medium scale and can correspond to a non-multiple of ten scale value; if the identified scale line is not greater than the second preset scale line length threshold but is greater than the third preset scale line length threshold, the identified scale line is a short scale and can correspond to a decimal scale value; wherein, the first preset scale value length threshold is greater than the second preset scale line length threshold, and the second preset scale line length threshold is greater than the third preset scale line length threshold.
[0091] Density clustering refers to clustering algorithms based on the density distribution of pixels or line segments within a region, filtering valid targets and eliminating isolated and noisy areas. Isolated line segments refer to non-valid line segments that exist alone in the region of interest of the target and are unrelated to other scale lines. Noise refers to useless image information in the region of interest of the target that interferes with scale line recognition. An ordered scale line sequence refers to a set of scale lines arranged in an orderly manner according to the distribution pattern of the water level gauge scale after filtering, deduplication, and noise reduction.
[0092] Based on the target region of interest (ROI), a reference view is determined. The ROI is jointly detected using edge detection, Hough line detection, and clustering detection. This approach accurately captures various scale line features from different dimensions, avoiding omissions or misidentifications of specific scale line types by a single detection method, thus improving the comprehensiveness and accuracy of scale line recognition. Different scale line types are categorized based on length. Subsequently, the identified scale lines are filtered and deduplicated according to scale direction consistency and scale spacing constraints, eliminating redundant scale lines with duplicates, directional deviations, or abnormal spacing. Specifically, the horizontal direction is used as the scale direction reference, and a preset spacing range is used as the spacing constraint between adjacent scale lines. Density clustering is then used to remove isolated line segments and noise from the scale lines, preventing noise and isolated line segments from disrupting the orderliness of the scale line sequence and improving the quality of the reference view. Finally, a reference view containing an ordered scale line sequence is generated, providing a reliable reference for the subsequent association of multiple second images with the first image. This avoids subsequent water level gauge self-calibration confusion and water level gauge reading errors caused by disordered scale lines in the reference view.
[0093] S240. Based on multiple second images, determine multiple candidate sequences. Each candidate sequence is used to indicate the candidate digit character extracted from the optical character recognition results of multiple second images corresponding to different views, which corresponds to the same water gauge digit position in the multiple second images corresponding to different views.
[0094] S250. Determine reference pairing information based on multiple candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge numeric position and the water gauge scale line.
[0095] S260. Determine the self-calibration water gauge configuration information based on the reference pairing information, which is used to identify the water level results detected by the target water gauge. The self-calibration water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line in the first image and the corresponding scale value of each water gauge scale line.
[0096] The technical solution of this invention extracts candidate regions of interest (ROIs) from a first image using multiple ROI extraction methods, including extraction methods based on optical character recognition anchor point aggregation, depth detection, and geometric consistency verification. This allows for the capture of the scale lines and numerical features of the target water gauge from different dimensions, avoiding the limitations of a single extraction method and improving the comprehensiveness, diversity, and stability of the candidate ROIs. A first result is obtained by calculating the intersection-union ratio (IUU) of each group based on multiple candidate ROIs, and a second result is combined with a measure of the matching degree between the candidate ROIs and the target water gauge's preset feature rules. This allows for the selection of candidate ROIs from both regional overlap and feature fit dimensions, avoiding misselection of target regions due to relying solely on a single dimension, significantly improving the accuracy of target ROI selection, and providing a reliable foundation for determining the subsequent reference view. The target ROI is determined based on the first result, the second result, and multiple candidate ROIs, and a reference view is generated to determine multiple second images associated with the first image. This ensures that the reference view accurately covers the core features of the target water gauge, avoiding matching errors in the second images due to reference view deviations, and improving the accuracy of the association between the second and first images.
[0097] Figure 3 This is a flowchart of another self-calibration water gauge reading method provided by an embodiment of the present invention. This embodiment further refines the process of determining multiple candidate sequences based on multiple second images, determining reference pairing information based on multiple candidate sequences, and determining self-calibration water gauge configuration information based on the reference pairing information in the above embodiment.
[0098] like Figure 3 As shown, the self-calibrated water gauge reading method provided in this embodiment of the invention may include the following process:
[0099] S310. Determine a plurality of second images associated with the first image. The first image is an image obtained by image acquisition towards the target water gauge. The plurality of second images include a reference view obtained by identifying the region of interest in the first image that includes the water gauge scale line and water gauge number of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement and light sharpening.
[0100] S320. Perform optical character recognition on multiple second images corresponding to different views in parallel to obtain the optical character recognition results for each view. The optical character recognition results include candidate digit characters, the recognition confidence of candidate digit characters, and the digit position of candidate digit characters in the view.
[0101] By performing optical character recognition in parallel on multiple second images corresponding to different views, the overall efficiency of multi-view character recognition can be greatly improved, the recognition time can be shortened, and the lengthy process caused by serial recognition can be avoided. The recognition results are output synchronously as candidate digit characters, recognition confidence and digit position, which can provide complete data support for subsequent processing. At the same time, multi-view parallel recognition can simultaneously acquire recognition data under different optimized views, which can avoid the limitations of single-view recognition.
[0102] S330. Match and align the optical character recognition results of each view according to the image position coordinates to determine the positions of multiple numbers in the optical character recognition results of each view.
[0103] By performing corresponding matching and alignment processing on the optical character recognition results corresponding to different views, the recognition information corresponding to the same water gauge number position in each view can form a precise correspondence. This can avoid positional deviations caused by imaging differences in different views, and achieve uniform and regular positional recognition results of multiple views, thereby ensuring that the recognition information of each view corresponds precisely to the position of the water gauge number. At the same time, by matching and aligning, the positions of multiple numbers in the recognition results of each view are clarified, providing a clear and unified positional basis for the subsequent extraction of candidate characters at the same water gauge number position, avoiding character extraction errors caused by positional confusion, significantly improving the accuracy of subsequent character extraction, and ensuring the correlation and consistency of multi-view recognition information.
[0104] S340. For the same water gauge number position in different views corresponding to multiple second images, extract at least one candidate digit character corresponding to the same water gauge number position from the optical character recognition results of each view, so as to obtain multiple second images and determine multiple candidate sequences.
[0105] For each digit position of the water gauge, at least one candidate digit character corresponding to that position is accurately extracted from the optical character recognition results corresponding to each view. Then, the candidate digit characters extracted from different views for the same water gauge digit position are integrated so that each water gauge digit position corresponds to a set of candidate characters. The multiple sets of candidate characters corresponding to multiple water gauge digit positions are arranged in order according to the water gauge digit position to obtain multiple candidate sequences.
[0106] For the same water gauge digit location, corresponding candidate digit characters are extracted from the recognition results of different views, so that each water gauge digit location has recognition support from multiple views. This fully utilizes the recognition advantages of different optimized views and can avoid character misjudgment caused by the recognition bias of a single view. By integrating candidate characters at the same location to form multiple candidate sequences, a comprehensive verification basis can be provided for subsequent determination of target digit characters, thereby ensuring the accuracy of character selection.
[0107] As an optional but not limited implementation, after determining multiple candidate sequences based on multiple second images, the following is also included:
[0108] For each candidate sequence among multiple candidate sequences, the candidate numeric characters corresponding to the same water gauge number position in each candidate sequence are filtered according to the preset labeling rules of the target water gauge. The preset labeling rules are used to indicate that the center coordinates of the tens digits and the center coordinates of the corresponding long scale lines are within a preset distance threshold, all numbers are vertically distributed along the longitudinal direction of the water gauge and the longitudinal spacing between the numbers meets the standard spacing requirements of water gauge labeling, and the number sequence is a monotonically increasing or decreasing sequence that conforms to the measurement logic of the water level scale. The preset labeling rules are used to remove candidate numeric characters in the candidate sequence that do not meet the preset labeling rules.
[0109] For each candidate sequence among multiple candidate sequences, according to the preset labeling rules of the target water gauge, candidate numeric characters corresponding to the same water gauge number position in each candidate sequence are filtered. The preset labeling rules eliminate candidate numeric characters in the candidate sequences that do not meet the requirements. The preset labeling rules include three requirements: First, the center coordinates of the tens digit and the center coordinates of the corresponding long scale line must be within a preset distance threshold, which conforms to the water gauge structure specification of precise correspondence between the tens scale and the long scale line, effectively avoiding recognition errors caused by misalignment of numbers and scale lines, thereby ensuring... The system employs several key principles: First, it ensures accurate matching between the scale markings and the numbers. Second, all numbers are vertically arranged along the water gauge's longitudinal axis, with the vertical spacing between numbers conforming to the standard spacing requirements for water gauge markings. This aligns with the characteristic of water gauge numbers being arranged vertically with equal spacing, allowing for the elimination of invalid candidate characters with disordered or abnormal spacing, thus ensuring that the number character arrangement conforms to the visual characteristics of the water gauge. Third, the number sequence must exhibit a monotonous distribution of continuous increases or decreases, matching the measurement logic of water level scale markings (increases from top to bottom or vice versa), thus conforming to the water level scale marking logic. This allows for the exclusion of disordered or abrupt invalid candidate number characters. The pre-defined marking rules align with the inherent marking characteristics of water gauges, ensuring the rationality and adaptability of the filtering logic and improving adaptability to different specifications of water gauges.
[0110] By filtering candidate numerical characters corresponding to the same position of the target water gauge according to the preset labeling rules of the target water gauge, it is possible to filter out erroneous characters, misaligned characters, and disordered characters caused by factors such as multi-view recognition deviation, image noise, and environmental interference, which significantly improves the effectiveness and accuracy of the candidate sequence.
[0111] S350. Construct a reference factor graph based on multiple candidate sequences. The variables of the reference factor graph include candidate numeric characters corresponding to each water gauge numeric position, the binding relationship between each water gauge scale line and the water gauge numeric position, and the mapping model parameters between numeric characters and water gauge scale lines. The factors of the reference factor graph include an optical character recognition confidence factor for quantifying the reliability of numeric characters, a geometric position factor for quantifying the matching based on the distance between numeric characters and water gauge scale lines, a scale level consistency factor for constraining the matching relationship between numeric characters and water gauge scale levels, and a monotonicity factor for maintaining the monotonic consistency between numeric characters and scale sequences.
[0112] A reference factor graph refers to a structured graph model constructed using a factor graph as the model framework, water gauge reading information as variables, and the constraint relationships between variables as factors, to achieve structured integration and relational constraints of water gauge reading information. Specifically, the variables in the reference factor graph include candidate numeric characters corresponding to each water gauge number position, the binding relationship between each water gauge scale line and the water gauge number position, and the mapping model parameters between numeric characters and water gauge scale lines. These correspond to the three dimensions that need to be clarified in the water gauge reading process: the numbers, the scales, and the relationship between the numbers and the scales, comprehensively covering the core relevant information in the water gauge reading process. The mapping model parameters between numeric characters and water gauge scale lines can refer to parameters characterizing the mapping relationship between numeric characters and water gauge scale lines. For example, the mapping model parameters between numeric characters and water gauge scale lines can refer to the offset threshold between the center position of the numeric character and the center position of the water gauge scale line, etc. To meet the accuracy requirements of water gauge readings, the reference factor diagram includes four factors: an optical character recognition confidence factor to constrain the reliability of candidate digit character recognition results, providing a basis for selecting reliable digit characters; a geometric position factor to quantify the positional matching degree between the digits and scale lines by measuring the distance between them, judging whether the spatial relationship is reasonable; a scale level consistency factor to constrain the matching relationship between digit characters and scale levels, ensuring that the numerical value is consistent with the level attribute of the corresponding scale; and a monotonicity factor to ensure the monotonic order of the digit characters and scale sequence, conforming to the inherent rules of water gauge scales and numbers. By associating and integrating variables and factors, the reference factor diagram is constructed.
[0113] By constructing the aforementioned reference factor diagram, the reliability, accuracy, and robustness of water gauge readings can be improved. The multi-dimensional constraint mechanism formed by the four factors can accurately avoid recognition errors. Among them, the optical character recognition confidence factor can filter out highly reliable candidate digit characters, reducing the adverse impact of confidence recognition results on overall recognition accuracy; the geometric position factor, through quantitative analysis of the distance between digit characters and scale lines, eliminates digit-scale combinations with unreasonable spatial relationships, improving the accuracy of their binding relationship; the scale level consistency factor and monotonicity factor, respectively, from the perspectives of scale level matching and sequence ordering, conform to the inherent characteristics of water gauge scales and digit characters, effectively avoiding recognition errors that do not conform to the water gauge's rules. In addition, the reference factor diagram can achieve the organic integration and synergistic constraints of key information for water gauge recognition, enabling various information elements to work together. This can effectively address common recognition problems such as character recognition errors and misalignment of scale and digit binding, thereby improving the robustness and environmental adaptability of water gauge recognition and providing a reliable benchmark for subsequent accurate readings of water gauges.
[0114] S360. Use the belief propagation algorithm or the serialization approximation algorithm to solve the reference factor graph and output the reference pairing information.
[0115] The belief propagation algorithm is a probabilistic inference algorithm based on factor graphical models. It solves for the optimal values of variables by passing belief information between factors and variables. The serialization approximation algorithm is an approximate solution algorithm that gradually approximates the optimal solution of a factor graphical model through serialized iterative optimization. Both the belief propagation algorithm and the serialization approximation algorithm are suitable for quickly processing multivariate and multi-constraint factor graphical models.
[0116] The reference factor graph is solved using either a confidence propagation algorithm or a serialization approximation algorithm. During the solution process, the algorithm gradually calculates the optimal values of each variable by passing confidence information or performing serialization iterative optimization, combined with the correlation between various constraint factors and variables in the reference factor graph. This determines the optimal binding relationship between the target numeric characters, the scale lines, and the numeric positions corresponding to each water gauge number position. After the solution is completed, the determined optimal binding relationships between the target numeric characters, the scale lines, and the numeric positions corresponding to each water gauge number position are integrated to obtain the binding relationship between the target numeric characters and the scale lines corresponding to each water gauge number position, i.e., the reference pairing information. This provides a reliable basis for subsequent self-calibration of water gauge configuration information.
[0117] Optionally, the confidence level of the reference pairing information is obtained by weighting the optical character recognition confidence factor, geometric position factor, scale level consistency factor, and monotonicity factor corresponding to the reference pairing information, which is used to quantify the reliability of the reference pairing information.
[0118] If a unique target region of interest (ROI) cannot be determined from multiple candidate ROIs in the first image, multiple candidate ROIs can be retained, and subsequent processing can be performed independently and in parallel on multiple candidate ROIs until reference pairing information and the confidence level of the reference pairing information are obtained for each candidate ROI. The candidate with the highest confidence level of the reference pairing information is then used for subsequent operations. The failure to determine a unique target ROI from multiple candidate ROIs in the first image may be due to the same score in the combined result obtained from the first result and the second result, or it may be because the first results for multiple candidate ROIs are all below a preset threshold, meaning the confidence levels of multiple candidate ROIs are too low.
[0119] S370. Map the target numeric characters corresponding to each water gauge numeric position indicated by the reference pairing information to the water gauge scale lines to form a set of reference anchor points for the pixel positions of the water gauge scale lines in the first image and the corresponding scale values of the water gauge scale lines.
[0120] A reference anchor set can refer to a collection of multiple reference anchors, each corresponding to a set of pixel positions and corresponding scale values associated with a set of water level gauge lines. First, the binding relationship between the target numeric characters corresponding to each water level gauge number position and the water level gauge line is extracted from the reference pairing information. Each target numeric character is then converted into the actual scale value of the corresponding water level gauge line, while simultaneously determining the specific pixel position of each water level gauge line in the first image. Subsequently, the pixel positions of the corresponding water level gauge lines and their corresponding scale values in each extracted binding relationship are associated and paired to form multiple reference anchors. Finally, all the associated reference anchors are integrated to obtain the reference anchor set.
[0121] By mapping the numerical and scale binding relationships in the reference pairing information to a set of reference anchor points corresponding to pixel positions and scale values, the association mapping between the pixel positions of the scale lines and the actual scale values is realized, transforming the reference pairing information into a set of benchmark data that can be used for subsequent water level gauge readings. Each reference anchor point accurately corresponds to the pixel position and actual scale value of the scale line, ensuring the correlation and accuracy of the data and avoiding fitting deviations caused by data misalignment. In addition, the reference anchor point set integrates the mapping data of all identifiable and valid scale lines, which can comprehensively cover the key benchmark points of the water level gauge scale, providing sufficient data support for subsequent accurate fitting of the pixel-scale mapping relationship.
[0122] S380. Fit the data samples in the reference anchor point set, automatically identify and divide the fitting segment boundaries, and generate self-calibration water gauge configuration information to indicate the linear mapping relationship between pixel coordinates and actual scale values.
[0123] Data samples can refer to the pixel position and scale value association data corresponding to each reference anchor point in the reference anchor point set. Fitted segment boundaries can refer to the scale segment boundaries that are automatically identified and divided based on the distribution characteristics of the water gauge scale, and that can adapt to a linear mapping relationship. For example, RANSAC can be used to automatically identify and divide fitted segment boundaries. A linear mapping relationship can refer to the linear correspondence between pixel coordinates and actual scale values; the actual scale value can be calculated from the pixel position through this linear mapping relationship. Self-calibrated water gauge configuration information can refer to the configuration information used to indicate the association between the pixel position of the target water gauge scale line and its corresponding scale value, enabling the water gauge to self-calibrate.
[0124] First, a fitting analysis is performed on all data samples in the reference anchor point set to automatically identify the mapping patterns presented by the data samples. At the same time, combined with the inherent distribution characteristics of the water gauge scale, the boundaries of the fitting segments are automatically identified and divided to ensure that the data samples in each segment are adapted to the linear mapping relationship. Based on the divided fitting segments and the fitting results of the data samples in each segment, a linear mapping relationship between the pixel coordinates and the actual scale values in each segment is constructed. Finally, the linear mapping relationships of all segments are integrated to generate complete self-calibrated water gauge configuration information.
[0125] Optionally, when automatically identifying and dividing the bounding boundaries of the fitted paragraphs by fitting the data samples in the reference anchor point set, Tukey loss is used to suppress outliers and remove abnormal reference anchor points with excessive residuals. After completing the fitting to obtain the linear mapping relationship of all paragraphs, the linear mapping relationship of all paragraphs is integrated, and monotonicity constraints and minimum curvature constraints are applied during the integration process. The monotonicity constraint means that the monotonicity indicated by the linear mapping relationship of each paragraph should be consistent, and the minimum curvature constraint means that the slope change amplitude of the linear mapping relationship between two adjacent paragraphs is not greater than the preset minimum curvature threshold.
[0126] By fitting reference anchor point data samples and automatically dividing paragraph boundaries, the distribution characteristics of the water level gauge scale can be accurately adapted, avoiding mapping deviations caused by overall fitting and improving the accuracy of the pixel-scale mapping relationship. The generated self-calibrated water level gauge configuration information clarifies the linear mapping relationship between pixel coordinates and actual scale values, realizing automated water level gauge self-calibration without relying on manual calibration operations, significantly reducing labor costs, avoiding human error in manual calibration, and adapting to water level gauges with different scale distributions, improving the stability and practicality of water level gauge self-calibration and readings. The self-calibrated water level gauge configuration information provides the core mapping basis for water level gauge readings, allowing for rapid deduction of the actual scale value from the pixel position corresponding to the water level, thereby improving the efficiency and accuracy of water level recognition.
[0127] Optionally, the water level of the target water gauge in the third image is determined based on the self-calibrated water gauge configuration information. The third image and the first image are obtained by taking images of the target water gauge using the same shooting equipment.
[0128] Image analysis is performed on the third image to obtain the corresponding pixel position of the water level line on the target water gauge. Based on the linear mapping relationship of the corresponding segment indicated by the self-calibrated water gauge configuration information, the actual scale reading corresponding to the water level is calculated, i.e., the water level result of the target water gauge in the third image. The third image and the first image are captured using the same imaging device facing the target water gauge to ensure a unified shooting reference and avoid interference factors introduced by differences in imaging equipment or shooting orientation, thereby further improving the stability and reliability of the target water gauge water level result.
[0129] Optionally, based on the self-calibrated water gauge configuration information, the water level result of the target water gauge in the fourth image is determined as the first water level result, and the water level result of the target water gauge in the fifth image is determined as the second water level result. The fourth and fifth images are obtained by taking images of the target water gauge using the same shooting device, and the time interval between the shooting of the fourth and fifth images is less than a preset time interval threshold. A Kalman filter algorithm or particle filter algorithm with physical amplitude limiting constraints is used to smooth the first and second water level results to remove abnormal noise points that do not conform to physical laws. The physical amplitude limiting constraint means that the water level change rate and acceleration reflected between the first and second water level results should be within the preset water level change rate threshold range and water level change acceleration threshold range, respectively. The preset water level change rate threshold range and water level change acceleration threshold range are preset according to the objective physical upper limit values of the water level change rate and acceleration.
[0130] Optionally, in response to a short-term failure of optical character recognition or target detection, resulting in a short-term gap in reading data, a preset state estimation model is used to predict and complete the reading data for the short-term gap based on historical reading data. In response to the recovery of optical character recognition or target detection, the reading data for the short-term gap is re-identified or detected, and the original predicted reading data is replaced to ensure the continuity of reading data.
[0131] Optionally, based on the self-calibrated water gauge configuration information, a virtual water gauge that conforms to the self-calibrated water gauge configuration information is fitted.
[0132] A sixth image is acquired. This sixth image is captured using the same camera as the first image used to generate the self-calibration water gauge configuration information, but taken later than the first image. Image processing determines the pixel positions of the target water gauge scale lines in the sixth image and their corresponding scale values. Based on the association between the pixel positions of the target water gauge scale lines and their corresponding scale values indicated by the self-calibration water gauge configuration information, the distance between the pixel positions of the target water gauge scale lines indicated in the self-calibration water gauge configuration information and the pixel positions of the target water gauge scale lines in the sixth image is calculated for the same scale value. If the calculated distance is greater than a preset distance threshold, it indicates that the self-calibration water gauge configuration information has a risk of drifting and failure, and the self-calibration water gauge configuration information needs to be regenerated. This risk of drifting and failure may be due to environmental changes, camera attitude drift, or other reasons.
[0133] The technical solution of this invention performs optical character recognition on different views of multiple second images in parallel to obtain recognition results including candidate digit characters, recognition confidence, and digit position. The optical character recognition results of each view are then matched and aligned according to image position coordinates to determine the digit position. This allows for accurate association of water level gauge information across multiple views, avoiding digit position matching deviations caused by view misalignment, thereby improving the accuracy of multi-view information fusion. Furthermore, by extracting candidate digit characters from the multi-view recognition results for the same water level gauge digit position to construct multiple candidate sequences, the character recognition information from multiple views can be integrated, avoiding the impact of single-view recognition errors on subsequent processes, thus improving the diversity and reliability of candidate sequences. By constructing a reference factor graph based on multiple candidate sequences, the candidate numeric characters corresponding to each water gauge number position, the binding relationship between each water gauge scale line and the water gauge number position, and the mapping model parameters between numeric characters and water gauge scale lines are set as variables. Confidence factors, geometric position factors, scale level consistency factors, and monotonicity factors are set as constraint factors. This allows for the constraint and verification of water gauge information from multiple dimensions, including character reliability, geometric matching degree, matching relationship between numeric characters and scale level types, and monotonic consistency between numbers and scale sequences. This avoids pairing bias caused by a single constraint dimension and improves the rigor of the reference factor graph's constraint on water gauge information. By using a confidence propagation algorithm or a serialization approximation algorithm to solve the reference factor graph and output reference pairing information, efficient iterative optimization can be achieved to obtain the optimal reference pairing information. This avoids the subjectivity and inefficiency of manual pairing and improves the accuracy of water gauge number and scale pairing. By mapping the reference pairing information to a set of reference anchor points for the pixel positions and scale values of the water level gauge, the reference pairing information can be transformed into a set of benchmark data that can be used for subsequent water level gauge readings. This avoids fitting errors caused by missing or misaligned anchor point information and significantly improves the effectiveness of the fitted data. The reference anchor point set samples are fitted, identified, and segmented to generate self-calibration configuration information. This self-calibration configuration information indicates the linear mapping relationship between pixel coordinates and actual scale values, providing a core mapping basis for water level gauge readings. The actual scale value can be quickly calculated from the pixel position corresponding to the water level, thereby improving the efficiency and accuracy of water level recognition.
[0134] Figure 4 This is a schematic diagram of a self-calibrating water level gauge reading device provided in an embodiment of the present invention. Figure 4 As shown, the self-calibrating water level gauge reading device provided in this embodiment of the invention may include:
[0135] The image determination module 410 is used to determine a plurality of second images associated with a first image. The first image is an image obtained by image acquisition towards the target water gauge. The plurality of second images include a reference view obtained by identifying the region of interest in the first image that includes the water gauge scale line and water gauge number of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement and light sharpening.
[0136] The candidate sequence determination module 420 is used to determine multiple candidate sequences based on the multiple second images, each candidate sequence being used to indicate a candidate numeric character extracted from the optical character recognition results of the multiple second images corresponding to different views, which corresponds to the same water gauge number position in the multiple second images corresponding to different views;
[0137] The pairing information determination module 430 is used to determine reference pairing information based on the plurality of candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge numeric position and the water gauge scale line.
[0138] The water gauge information determination module 440 is used to determine self-calibrated water gauge configuration information based on the reference pairing information, and is used to identify the water level detection results of the target water gauge. The self-calibrated water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line of the target water gauge in the first image and the corresponding scale value of each water gauge scale line.
[0139] Based on the above embodiments, optionally, determining the plurality of second images associated with the first image includes:
[0140] Multiple candidate regions of interest (ROIs) associated with the first image are determined. These multiple ROIs are regions of interest extracted from the first image using multiple ROI extraction methods, including the water gauge scale lines and water gauge numbers of the target water gauge. The multiple ROI extraction methods include ROI extraction based on optical character recognition anchor point aggregation, ROI extraction based on depth detection, and ROI extraction based on geometric consistency verification.
[0141] Multiple first results and second results are determined to be associated with multiple candidate regions of interest. The multiple first results are calculated by grouping each pair of two different candidate regions of interest into a group. The second results are used to measure the matching degree between the candidate regions of interest and the preset feature rules of the target water level.
[0142] Based on the plurality of first results and second results and the plurality of candidate regions of interest, a target region of interest is determined from the first image, and a reference view is determined based on the target region of interest to determine a plurality of second images associated with the first image.
[0143] Optionally, based on the above embodiments, before determining the reference view according to the target region of interest, the method further includes:
[0144] Perform multi-scale contrast enhancement on the target region of interest to suppress non-uniform illumination interference within the target region of interest;
[0145] The image pixels of the target region of interest are converted to the HSV color space or Lab color space. The pixels are then quickly clustered and initially divided into background, paint layer, and number or scale layer categories. The cluster centers of each color category are updated using an exponential moving average over time to adapt to the long-term changes in the watermark color. A paint mask is generated based on the clustering results of the paint layer category. The target image layer is obtained through a mask peeling operation. The target image layer is an image layer characterized by numbers and scales and with enhanced contrast between the target image layer and the background.
[0146] An adaptive threshold segmentation is performed on the target image layer to obtain a binarized image of the target image layer, and small connected components in the binarized image of the target image layer are removed to eliminate noise interference. Furthermore, skeletonization or thinning operations are performed on the processed image to highlight the stroke features of numbers or scales, and hole regions in the target image layer are filled to maintain the connectivity of numbers or scales.
[0147] Optionally, based on the above embodiments, before determining the reference view according to the target region of interest, the method further includes:
[0148] By performing coarse rotation estimation on the target region of interest, the attitude of the target water gauge in the target region of interest is corrected.
[0149] Extract the left and right edge straight line pairs of the target water gauge in the region of interest after attitude correction, and estimate the homography matrix of the output perspective transformation based on the horizontal consistency constraint of the scale lines.
[0150] Based on the homography matrix of the perspective transformation, a perspective transformation is performed on the pose-corrected region of interest to obtain the pose-corrected target region of interest;
[0151] Calculate the vertical residual of the number column, the horizontal residual of the scale line, and the edge parallelism in the target region of interest after perspective correction. The edge parallelism is used to measure the parallelism of the longitudinal edges of the target water gauge on both sides in the target region of interest after perspective correction.
[0152] Using the vertical residual of the numerical column, the horizontal residual of the scale line, and the parallelism of the edges as the objective functions, the homography matrix of the perspective transformation is corrected by a small-step iterative method. In each iteration, the perspective correction of the target region of interest is updated and the objective function value is recalculated until the objective function value converges to a preset threshold or the upper limit of the number of iterations is reached, at which point the iteration stops.
[0153] Based on the above embodiments, optionally, determining the reference view according to the target region of interest includes:
[0154] By employing edge detection, Hough line detection, and clustering detection to jointly detect the target region of interest, different types of scale lines in the target region of interest are identified. The different types of scale lines in the target region of interest are deduplicated according to the consistency of scale direction and the constraint of scale spacing. The different types of scale lines are divided according to the length of the scale lines. The consistency of scale direction means that the scale lines are kept in a horizontal direction. The constraint of scale spacing is used to indicate that the distance between adjacent scale lines must be within a preset distance range.
[0155] Density clustering is used to remove isolated line segments and noise from different types of tick marks in the target region of interest, generating a reference view containing an ordered sequence of tick marks.
[0156] Based on the above embodiments, optionally, multiple candidate sequences are determined based on the multiple second images, including:
[0157] Optical character recognition is performed in parallel on the multiple second images corresponding to different views to obtain the optical character recognition results for each view. The optical character recognition results include candidate digit characters, recognition confidence of candidate digit characters, and digit positions of candidate digit characters in the view.
[0158] The optical character recognition results of each view are matched and aligned according to the image position coordinates to determine the positions of multiple numbers in the optical character recognition results of each view;
[0159] For the same water gauge number position in different views corresponding to the multiple second images, at least one candidate digit character corresponding to the same water gauge number position is extracted from the optical character recognition results of each view to obtain multiple candidate sequences for the multiple second images.
[0160] Optionally, based on the above embodiments, after determining multiple candidate sequences based on the multiple second images, the method further includes:
[0161] For each candidate sequence among multiple candidate sequences, candidate numeric characters corresponding to the same water gauge number position in each candidate sequence are filtered according to the preset labeling rules of the target water gauge. The preset labeling rules are used to indicate that the center coordinates of the tens digits and the center coordinates of the corresponding long scale lines are within a preset distance threshold, all numbers are vertically distributed along the longitudinal direction of the water gauge and the longitudinal spacing between the numbers meets the standard spacing requirements of water gauge labeling, and the number sequence is a monotonically increasing or decreasing sequence that conforms to the measurement logic of the water level scale. The preset labeling rules are used to remove candidate numeric characters in the candidate sequence that do not meet the preset labeling rules.
[0162] Based on the above embodiments, optionally, determining reference pairing information according to the plurality of candidate sequences includes:
[0163] A reference factor graph is constructed based on the multiple candidate sequences. The variables of the reference factor graph include the candidate numeric characters corresponding to each water gauge numeric position, the binding relationship between each water gauge scale line and the water gauge numeric position, and the mapping model parameters between numeric characters and water gauge scale lines. The factors of the reference factor graph include an optical character recognition confidence factor for quantifying the reliability of numeric characters, a geometric position factor for quantifying the matching based on the spacing between numeric characters and water gauge scale lines, a scale level consistency factor for constraining the matching relationship between numeric characters and water gauge scale levels, and a monotonicity factor for maintaining the monotonic consistency between numeric characters and scale sequences.
[0164] The reference factor graph is solved using a belief propagation algorithm or a serialization approximation algorithm, and the reference pairing information is output.
[0165] Based on the above embodiments, optionally, the self-calibration gauge configuration information is determined according to the reference pairing information, including:
[0166] The target numeric characters corresponding to each water gauge numeric position indicated by the reference pairing information are mapped to the water gauge scale lines as a set of reference anchor points for the pixel positions of the water gauge scale lines in the first image and the corresponding scale values of the water gauge scale lines.
[0167] The system automatically identifies and delineates the boundaries of fitted segments by fitting data samples from the reference anchor point set, generating self-calibrated water level configuration information to indicate the linear mapping relationship between pixel coordinates and actual scale values.
[0168] The technical solution of this invention, by determining multiple second images associated with a first image, can clearly identify the region of interest (ROI) in the image, including the water gauge scale lines and numbers of the target water gauge. Furthermore, by employing at least one view processing method among contrast enhancement, stroke enhancement, and mild sharpening, the features of the water gauge scale lines and numbers are ensured to be clearer, reducing interference from factors such as image blurring, insufficient contrast, and water gauge aging. Based on the optical character recognition results of multiple second images corresponding to different views, candidate digit characters corresponding to the same water gauge number position are extracted, and multiple candidate sequences are generated. This ensures that each digit position has multi-view verification basis, avoiding misjudgment of digit characters due to single-view recognition bias, thereby improving the accuracy of the digit character corresponding to each digit position. Reference pairing information is determined based on multiple candidate sequences, through multiple... The mutual verification of candidate sequences improves the accuracy of the pairing relationship between the target numerical characters and scales at each water gauge position, reducing the risk of water level calibration errors due to mismatches between water gauge scale lines and corresponding numerical characters. It also enables multi-view recognition support for each water gauge position, fully utilizing the recognition advantages of different optimized views and avoiding character misjudgments caused by single-view recognition bias. By integrating candidate characters at the same position to form multiple candidate sequences, comprehensive verification basis can be provided for subsequent determination of target numerical characters, thus ensuring the accuracy of character selection. Based on reference pairing information, a correlation can be established between the pixel position of each water gauge scale line in the first image and the water level value indicated by the corresponding scale value, thereby achieving automated self-calibration of water gauge readings and improving the adaptability of water gauge readings under different imaging conditions. Based on the above technical solutions, the problems of low efficiency and large error in manual calibration and inaccurate water level readings caused by mismatch between numbers and scales when reading water level gauges using image recognition can be solved. Automated water level gauge self-calibration can be achieved, reducing labor costs and operational errors. The anti-interference ability and accuracy of water level gauge readings can be improved, and the automation level and detection efficiency of water level detection can be enhanced.
[0169] The self-calibrating water gauge reading device provided in this embodiment of the invention can execute the self-calibrating water gauge reading method provided in any of the above embodiments of the invention, and has the corresponding functions and beneficial effects of executing the self-calibrating water gauge reading method. For detailed process, please refer to the relevant operations of the self-calibrating water gauge reading method in the foregoing embodiments.
[0170] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of the present invention.
[0171] Figure 5A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0172] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0173] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0174] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the self-calibrating water level reading method.
[0175] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 19, or installed from storage unit 18, or installed from ROM 12. When the computer program is executed by processor 11, it performs the functions defined in the methods of the embodiments of the present invention.
[0176] In some embodiments, the self-calibrating water level reading method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the self-calibrating water level reading method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the self-calibrating water level reading method by any other suitable means (e.g., by means of firmware).
[0177] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0178] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0179] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0180] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0181] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0182] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0183] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.
[0184] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A self-calibrated water gauge reading method, characterized in that, The method includes: A plurality of second images are determined to be associated with a first image. The first image is an image acquired by image acquisition towards the target water gauge. The plurality of second images include a reference view obtained by identifying the region of interest in the first image that includes the water gauge scale lines and water gauge numbers of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement, and light sharpening. Based on the plurality of second images, a plurality of candidate sequences are determined, each of the candidate sequences being used to indicate a candidate numeric character extracted from the optical character recognition results of the plurality of second images corresponding to different views, for the same water gauge number position in the plurality of second images corresponding to different views; Reference pairing information is determined based on the multiple candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge numeric position and the water gauge scale line. The self-calibrated water gauge configuration information is determined based on the reference pairing information and is used to identify the water level results detected by the target water gauge. The self-calibrated water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line of the target water gauge in the first image and the corresponding scale value of each water gauge scale line.
2. The method according to claim 1, characterized in that, The determination of the multiple second images associated with the first image includes: Multiple candidate regions of interest (ROIs) associated with the first image are determined. These multiple ROIs are regions of interest extracted from the first image using multiple ROI extraction methods, including the water gauge scale lines and water gauge numbers of the target water gauge. The multiple ROI extraction methods include ROI extraction based on optical character recognition anchor point aggregation, ROI extraction based on depth detection, and ROI extraction based on geometric consistency verification. Multiple first results and second results are determined to be associated with multiple candidate regions of interest. The multiple first results are the intersection-union ratios of the two candidate regions of interest in each group calculated by grouping each pair of different candidate regions of interest in multiple candidate regions of interest. The second results are used to measure the matching degree between the candidate regions of interest and the preset feature rules of the target water level. Based on the plurality of first results and second results and the plurality of candidate regions of interest, a target region of interest is determined from the first image, and a reference view is determined based on the target region of interest to determine a plurality of second images associated with the first image.
3. The method according to claim 2, characterized in that, Before determining the reference view based on the target region of interest, the method further includes: Perform multi-scale contrast enhancement on the target region of interest to suppress non-uniform illumination interference within the target region of interest; The image pixels of the target region of interest are converted to the HSV color space or Lab color space. The pixels are then quickly clustered and initially divided into background, paint layer, and number or scale layer categories. The cluster centers of each color category are updated using an exponential moving average over time to adapt to the long-term changes in the watermark color. A paint mask is generated based on the clustering results of the paint layer category. The target image layer is obtained through a mask peeling operation. The target image layer is an image layer characterized by numbers and scales and with enhanced contrast between the target image layer and the background. An adaptive threshold segmentation is performed on the target image layer to obtain a binarized image of the target image layer, and small connected components in the binarized image of the target image layer are removed to eliminate noise interference. Furthermore, skeletonization or thinning operations are performed on the processed image to highlight the stroke features of numbers or scales, and hole regions in the target image layer are filled to maintain the connectivity of numbers or scales.
4. The method according to claim 2, characterized in that, Before determining the reference view based on the target region of interest, the method further includes: By performing coarse rotation estimation on the target region of interest, the attitude of the target water gauge in the target region of interest is corrected. Extract the left and right edge straight line pairs of the target water gauge in the region of interest after attitude correction, and estimate the homography matrix of the output perspective transformation based on the horizontal consistency constraint of the scale lines. Based on the homography matrix of the perspective transformation, a perspective transformation is performed on the pose-corrected region of interest to obtain the pose-corrected target region of interest; Calculate the vertical residual of the number column, the horizontal residual of the scale line, and the edge parallelism in the target region of interest after perspective correction. The edge parallelism is used to measure the parallelism of the longitudinal edges of the target water gauge on both sides in the target region of interest after perspective correction. Using the vertical residual of the numerical column, the horizontal residual of the scale line, and the parallelism of the edges as the objective functions, the homography matrix of the perspective transformation is corrected by a small-step iterative method. In each iteration, the perspective correction of the target region of interest is updated and the objective function value is recalculated until the objective function value converges to a preset threshold or the upper limit of the number of iterations is reached, at which point the iteration stops.
5. The method according to any one of claims 2-4, characterized in that, Determining the reference view based on the target region of interest includes: By employing edge detection, Hough line detection, and clustering detection to jointly detect the target region of interest, different types of scale lines in the target region of interest are identified. The different types of scale lines in the target region of interest are deduplicated according to the consistency of scale direction and the constraint of scale spacing. The different types of scale lines are divided according to the length of the scale lines. The consistency of scale direction means that the scale lines are kept in a horizontal direction. The constraint of scale spacing is used to indicate that the distance between adjacent scale lines must be within a preset distance range. Density clustering is used to remove isolated line segments and noise from different types of tick marks in the target region of interest, generating a reference view containing an ordered sequence of tick marks.
6. The method according to claim 1, characterized in that, Based on the multiple second images, multiple candidate sequences are determined, including: Optical character recognition is performed in parallel on the multiple second images corresponding to different views to obtain the optical character recognition results for each view. The optical character recognition results include candidate digit characters, recognition confidence of candidate digit characters, and digit positions of candidate digit characters in the view. The optical character recognition results of each view are matched and aligned according to the image position coordinates to determine the positions of multiple numbers in the optical character recognition results of each view; For the same water gauge number position in different views corresponding to the multiple second images, at least one candidate digit character corresponding to the same water gauge number position is extracted from the optical character recognition results of each view to obtain multiple candidate sequences for the multiple second images.
7. The method according to claim 6, characterized in that, After determining multiple candidate sequences based on the multiple second images, the process further includes: For each candidate sequence among multiple candidate sequences, candidate numeric characters corresponding to the same water gauge number position in each candidate sequence are filtered according to the preset labeling rules of the target water gauge. The preset labeling rules are used to indicate that the center coordinates of the tens digits and the center coordinates of the corresponding long scale lines are within a preset distance threshold, all numbers are vertically distributed along the longitudinal direction of the water gauge and the longitudinal spacing between the numbers meets the standard spacing requirements of water gauge labeling, and the number sequence is a monotonically increasing or decreasing sequence that conforms to the measurement logic of the water level scale. The preset labeling rules are used to remove candidate numeric characters in the candidate sequence that do not meet the preset labeling rules.
8. The method according to claim 1, characterized in that, Determining reference pairing information based on the plurality of candidate sequences includes: A reference factor graph is constructed based on the multiple candidate sequences. The variables of the reference factor graph include the candidate numeric characters corresponding to each water gauge numeric position, the binding relationship between each water gauge scale line and the water gauge numeric position, and the mapping model parameters between numeric characters and water gauge scale lines. The factors of the reference factor graph include an optical character recognition confidence factor for quantifying the reliability of numeric characters, a geometric position factor for quantifying the matching based on the spacing between numeric characters and water gauge scale lines, a scale level consistency factor for constraining the matching relationship between numeric characters and water gauge scale levels, and a monotonicity factor for maintaining the monotonic consistency between numeric characters and scale sequences. The reference factor graph is solved using a belief propagation algorithm or a serialization approximation algorithm, and the reference pairing information is output.
9. The method according to claim 1, characterized in that, The self-calibration gauge configuration information is determined based on the reference pairing information, including: The target numeric characters corresponding to each water gauge numeric position indicated by the reference pairing information are mapped to the water gauge scale lines as a set of reference anchor points for the pixel positions of the water gauge scale lines in the first image and the corresponding scale values of the water gauge scale lines. The system automatically identifies and delineates the boundaries of fitted segments by fitting data samples from the reference anchor point set, generating self-calibrated water level configuration information to indicate the linear mapping relationship between pixel coordinates and actual scale values.
10. A self-calibrating water level gauge reading device, characterized in that, The device includes: An image determination module is used to determine a plurality of second images associated with a first image. The first image is an image acquired by image acquisition towards a target water gauge. The plurality of second images include a reference view obtained by identifying a region of interest in the first image that includes the water gauge scale lines and water gauge numbers of the target water gauge. The plurality of second images also include at least one view after the reference view has been processed by at least one of the following view processing methods: contrast enhancement, stroke enhancement, and light sharpening. The candidate sequence determination module is used to determine multiple candidate sequences based on the multiple second images, each candidate sequence being used to indicate a candidate numeric character extracted from the optical character recognition results of the multiple second images corresponding to different views, which corresponds to the same water gauge number position in the multiple second images corresponding to different views; The pairing information determination module is used to determine reference pairing information based on the multiple candidate sequences. The reference pairing information is used to indicate the binding relationship between the target numeric character corresponding to each water gauge numeric position and the water gauge scale line. The water gauge information determination module is used to determine the self-calibrated water gauge configuration information based on the reference pairing information, and is used to identify the water level detection results of the target water gauge. The self-calibrated water gauge configuration information is used to indicate the correlation between the pixel position of each water gauge scale line of the target water gauge in the first image and the corresponding scale value of each water gauge scale line.
11. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, which enables the at least one processor to perform the self-calibrated gauge reading method according to any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the self-calibrating water level reading method according to any one of claims 1-9.