Digital water meter character wheel reading identification method
Patent Information
- Application Number
- CN202411360339.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-21
AI Technical Summary
[0004]本发明要提供一种数字水表字轮读数识别方法,解决现有技术中直接预判字符所在区域而导致可能存在判断错误的问题
[0034]本申请中,通过步骤S51在出厂之前训练出来了训练后长方形边缘数据,为后续步骤S52寻找目标字轮区域提供了判断基础,由于在水表运输和安装过程中,难免实时图片与训练图片差异的情况,因此利用了实时检测的照片分析得到的目标长方形边缘与训练照片得到的训练后长方形边缘数据相互配合,从而使得目标字轮区域得到的数据更加精确,提高了寻找水表照片上字符的精准性。
Smart Images

Figure CN119339388A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of water meter reading recognition, and in particular to a digital water meter character wheel reading recognition method. Background Art
[0002] The Chinese patent discloses a deep learning-based character wheel water meter digital recognition and processing method with application number CN202311385464.4. The deep learning-based character wheel water meter digital recognition and processing method receives a water meter image sent by a client; pre-processes the water meter image to obtain a standardized water meter input image; uses a frame point recognition model to process the water meter input image to obtain a frame point recognition result; according to the frame point consistency principle and the principle that a water meter image has only one reading area, the frame point recognition result is processed to extract the horizontal positive reading area input image of the digital characters; the reading recognition model is used to process the reading area input image to identify the digital character frame and the auxiliary character frame; according to the non-maximum suppression method, the auxiliary character frame category and the carry rule, the recognized digital character frame and the auxiliary character frame are processed to obtain the final reading recognition result; and the reading recognition result is returned to the client.
[0003] Although the above-mentioned character wheel type water meter digital recognition and processing method based on deep learning can recognize the numbers on the water meter, the character wheel type water meter digital recognition and processing method based on deep learning still has the disadvantage that it directly predicts the area where the characters are located, which may result in misjudgment, resulting in subsequent impact on the recognition efficiency of the characters. Summary of the invention
[0004] The present invention provides a method for recognizing character wheel readings of a digital water meter, which solves the problem in the prior art of directly predicting the area where the characters are located, which may lead to misjudgment.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] The invention discloses a method for identifying a digital water meter wheel reading, comprising the following steps:
[0007] S1. Obtain a photo of the water meter wheel through a camera, which also contains information parameters, including: light intensity, longitude and latitude, and shooting time;
[0008] S2, calculating the weather conditions at the time of shooting according to the longitude and latitude and the shooting time, and performing digital image processing on the photo in combination with the light intensity in step S1, correcting underexposure and overexposure, and automatically adjusting the saturation;
[0009] S3, converting the water meter wheel photo into a grayscale image;
[0010] S4, automatically calculating the histogram distribution, performing histogram equalization, optimizing and enhancing the water meter wheel photo, and obtaining the optimized picture;
[0011] S5, submitting the optimized image to the character wheel reasoning module for text reasoning and recognition, including the following steps:
[0012] S51, training to obtain trained rectangular edge data of the area where the character wheel is located in the optimized image, the trained rectangular edge data including: a first group of four right-angle point coordinates and a first rectangular area M0, the first group of four right-angle point coordinates are: (x01, y01), (x02, y02), (x03, y03) and (x04, y04);
[0013] S52, using the trained rectangular edge data and the Prewitt operator in real time to extract the area where the square-shaped character wheel is located in the optimized image to obtain a target character wheel area;
[0014] S53, according to the obtained target character wheel area, adjusting the area of the largest reasoning result so that all characters are placed in the front position, and obtaining a front character wheel area image;
[0015] S54, training the front character wheel area picture after the above processing with a second CNN convolutional neural network model to calculate the character wheel number.
[0016] Preferably, step S51 includes the following steps: S511, collecting several optimized images obtained by processing; S512, manually framing the area where the square-shaped character wheel is located in each optimized image; S513, putting the optimized image with the manually framed square-shaped character wheel area into the first CNN convolutional neural network model, and training the first CNN convolutional neural network model so that the first CNN convolutional neural network model, the convolution kernel and the convolution pool can recognize the trained rectangular edge data where the character wheel is located in all optimized images.
[0017] Preferably, step S52 includes the following steps:
[0018] S521, input the optimized image obtained by step S4, and use the Prewitt operator to detect edge data in the optimized image;
[0019] S522, using the feature that two pairs of sides of a rectangular edge are equal and parallel, find all rectangular edges from the edge data;
[0020] S523, calculating the edge areas M1 of all rectangles;
[0021] S524, sort all the rectangular edges according to the size of M1, and after sorting, all the rectangular edges are numbered from 1 to N. The smaller the number, the larger the M1 of the corresponding rectangular edge, and i is initialized to 0;
[0022] S525, life i=i+1;
[0023] S526, determining whether i is greater than N, if i is greater than N, proceeding to step S530 and outputting a result that the camera may be installed incorrectly; if i is not greater than N, proceeding to step S537;
[0024] S527, designate the edge of the rectangle with index equal to i as the edge of the target rectangle, the coordinates of the second set of four right-angle points of the edge of the target rectangle are (x11, y11), (x12, y12), (x13, y13) and (x14, y14), and the area of the second rectangle of the edge of the target rectangle is M2;
[0025] S528, determine whether at least three of the conditions 1, 2, 3 and 4 are met, condition 1 is whether (x11, y11) is within the range (x01±△p1, y01±△q1), condition 2 is whether (x12, y12) is within the range (x02±△p2, y02±△q2), condition 3 is whether (x13, y13) is within the range (x03±△p3, y03±△q3), condition 4 is whether (x14, y14) is within the range (x04±△p4, y04±△q4); if at least three conditions are met, proceed to step S528; if at least three conditions are not met, return to step S525;
[0026] S529, compare the second rectangular area M2 of the target rectangular edge with the first rectangular area M0 of the trained rectangular edge. If M2 is greater than or equal to M0, the area surrounded by the target rectangular edge is used as the target character wheel area, and the four right-angle point coordinates of the target character wheel area are the second group of four right-angle point coordinates; if M2 is less than M0, the area surrounded by the trained rectangular edge data is used as the target character wheel area, and the four right-angle point coordinates of the target character wheel area are the first group of four right-angle point coordinates, and the result of obtaining the target character wheel area is output;
[0027] S530, end.
[0028] Preferably, step S53 includes the following steps:
[0029] S531, according to the coordinates of the four rectangular points of the target character wheel area, the perspective transformation matrix of the original image is transformed into the target image, the original image is rotated to the horizontal, and the character wheel area image is taken out by taking a screenshot according to the four rectangular coordinates after the perspective transformation;
[0030] S532, calculate the length and width of the wheel area image, the length is in the X direction, the width is in the Y direction, if the length is smaller than the width, rotate 90 degrees clockwise;
[0031] S533, performing a third CNN convolutional neural network model digital direction recognition on the extracted character wheel area image to identify whether the number is inverted. If it is inverted, horizontal rotation is performed; if it is not inverted, no operation is performed;
[0032] S534, performing digital recognition using the fourth CNN convolutional neural network model on the character wheel area image processed in S533, and outputting all the numbers from 0 to 9.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] In the present application, the trained rectangular edge data is trained before leaving the factory through step S51, which provides a judgment basis for finding the target character wheel area in the subsequent step S52. Due to the inevitable difference between the real-time picture and the training picture during the transportation and installation of the water meter, the target rectangular edge obtained by the real-time detection photo analysis and the trained rectangular edge data obtained from the training photo are coordinated with each other, so that the data obtained in the target character wheel area is more accurate, thereby improving the accuracy of finding characters on the water meter photo.
[0035] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 The water meter wheel photo obtained by the camera in step S1.
[0037] Figure 2 The grayscale image is obtained by converting the water meter wheel photo into a grayscale image in step S3. DETAILED DESCRIPTION
[0038] In order to make the technical means, creative features, objectives and functions of the present invention clearer and easier to understand, the present invention is further described below in conjunction with the accompanying drawings and specific embodiments:
[0039] like Figure 1 as well as Figure 2 As shown, the present invention discloses a method for identifying a digital water meter wheel reading, comprising the following steps:
[0040] S1. Obtain a photo of the water meter wheel through a camera, which also contains information parameters, including: light intensity, longitude and latitude, and shooting time;
[0041] S2, calculating the weather conditions at the time of shooting according to the longitude and latitude and the shooting time, and performing digital image processing on the photo in combination with the light intensity in step S1, correcting underexposure and overexposure, and automatically adjusting the saturation;
[0042] S3, converting the water meter wheel photo into a grayscale image;
[0043] S4, automatically calculating the histogram distribution, performing histogram equalization, optimizing and enhancing the water meter wheel photo, and obtaining the optimized picture;
[0044] S5, submitting the optimized image to the character wheel reasoning module for text reasoning and recognition, including the following steps:
[0045] S51, training to obtain the trained rectangular edge data of the area where the word wheel is located in the optimized image, the trained rectangular edge data includes: a first group of four right-angle point coordinates and a first rectangular area M0, the first group of four right-angle point coordinates are: (x01, y01), (x02, y02), (x03, y03) and (x04, y04); (the purpose is to obtain the rectangular edge data to provide verification basis for step S52)
[0046] S52, using the trained rectangle edge data and the Prewitt operator in real time to extract the area where the square-shaped character wheel is located in the optimized image, and obtaining the target character wheel area; (using the Prewitt operator to extract the edge, and obtaining the target rectangle edge through the rectangle feature, and verifying whether the target rectangle edge is correct through the trained rectangle edge data, and also using the target rectangle edge and the trained rectangle edge data in conjunction with each other, so as to obtain a more accurate target character wheel area)
[0047] S53, according to the obtained target character wheel area, adjusting the area of the largest reasoning result so that all characters are placed in the front position, and obtaining a front character wheel area image;
[0048] S54, training the front character wheel area picture after the above processing with a second CNN convolutional neural network model to calculate the character wheel number.
[0049] Step S51 includes the following steps: S511, collecting several optimized images obtained by processing; S512, manually framing the area where the square-shaped character wheel is located in each optimized image; S513, putting the optimized image with the manually framed square-shaped character wheel area into the first CNN convolutional neural network model, and training the first CNN convolutional neural network model so that the first CNN convolutional neural network model, the convolution kernel and the convolution pool can recognize the trained rectangular edge data where the character wheel is located in all optimized images.
[0050] Step S52 includes the following steps:
[0051] S521, input the optimized image obtained by step S4, and use the Prewitt operator to detect edge data in the optimized image;
[0052] S522, using the feature that two pairs of sides of a rectangular edge are equal and parallel, find all rectangular edges from the edge data;
[0053] S523, calculating the edge areas M1 of all rectangles;
[0054] S524, sort all the rectangular edges according to the size of M1, and after sorting, all the rectangular edges are numbered from 1 to N. The smaller the number, the larger the M1 of the corresponding rectangular edge, and i is initialized to 0;
[0055] S525, life i=i+1;
[0056] S526, determining whether i is greater than N, if i is greater than N, proceeding to step S530 and outputting a result that the camera may be installed incorrectly; if i is not greater than N, proceeding to step S537;
[0057] S527, designate the edge of the rectangle with index equal to i as the edge of the target rectangle, the coordinates of the second set of four right-angle points of the edge of the target rectangle are (x11, y11), (x12, y12), (x13, y13) and (x14, y14), and the area of the second rectangle of the edge of the target rectangle is M2;
[0058] S528, determine whether at least three of the conditions 1, 2, 3 and 4 are met, condition 1 is whether (x11, y11) is within the range (x01±△p1, y01±△q1), condition 2 is whether (x12, y12) is within the range (x02±△p2, y02±△q2), condition 3 is whether (x13, y13) is within the range (x03±△p3, y03±△q3), condition 4 is whether (x14, y14) is within the range (x04±△p4, y04±△q4); if at least three conditions are met, proceed to step S529. 528; if at least three conditions cannot be met, return to step S525; (the range (x01±△p1, y01±△q1) means whether x11 is within the range x01±△p1, whether y11 is within the range y01±△q1, and the others are the same) (The purpose of the loop between step S528 and step S524 is to find the target rectangular edge that is similar to the trained rectangular edge data, exclude the long edge of the non-digital area in the photo, and use the trained rectangular edge data to calibrate the target rectangular edge, so that the final target word wheel area is more accurate)
[0059] S529, compare the second rectangular area M2 of the target rectangular edge with the first rectangular area M0 of the trained rectangular edge. If M2 is greater than or equal to M0, the area surrounded by the target rectangular edge is used as the target character wheel area, and the four right-angle point coordinates of the target character wheel area are the second group of four right-angle point coordinates; if M2 is less than M0, the area surrounded by the trained rectangular edge data is used as the target character wheel area, and the four right-angle point coordinates of the target character wheel area are the first group of four right-angle point coordinates, and the result of the target character wheel area is output; (by comparing M0 and M2 with each other, a target character wheel area with a larger area is obtained, so that the target character wheel area can fully frame the area where the digit is located)
[0060] S530, end.
[0061] Preferably, step S53 includes the following steps:
[0062] S531, according to the coordinates of the four rectangular points of the target character wheel area, the perspective transformation matrix of the original image is transformed into the target image, the original image is rotated to the horizontal, and the character wheel area image is taken out by taking a screenshot according to the four rectangular coordinates after the perspective transformation;
[0063] S532, calculate the length and width of the wheel area image, the length is in the X direction, the width is in the Y direction, if the length is smaller than the width, rotate 90 degrees clockwise;
[0064] S533, performing a third CNN convolutional neural network model digital direction recognition on the extracted character wheel area image to identify whether the number is inverted. If it is inverted, horizontal rotation is performed; if it is not inverted, no operation is performed;
[0065] S534, performing digital recognition using the fourth CNN convolutional neural network model on the character wheel area image processed in S533, and outputting all the numbers from 0 to 9.
[0066] It can judge whether the number is inverted or vertical, and recognize the number after rotating the photo. It avoids the phenomenon that the number cannot be recognized when it is inverted or vertical.
[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
Claims
1. A method for identifying the reading of a digital water meter wheel, characterized in that: The steps include: S1. Obtain a photo of the water meter wheel through a camera, which also contains information parameters, including: light intensity, longitude and latitude, and shooting time; S2, calculating the weather conditions at the time of shooting according to the longitude and latitude and the shooting time, and performing digital image processing on the photo in combination with the light intensity in step S1, correcting underexposure and overexposure, and automatically adjusting the saturation; S3, converting the water meter wheel photo into a grayscale image; S4, automatically calculating the histogram distribution, performing histogram equalization, optimizing and enhancing the water meter wheel photo, and obtaining the optimized picture; S5, submitting the optimized image to the character wheel reasoning module for text reasoning and recognition, including the following steps: S51, training to obtain trained rectangular edge data of the area where the character wheel is located in the optimized image, the trained rectangular edge data including: a first group of four right-angle point coordinates and a first rectangular area M0, the first group of four right-angle point coordinates are: (x01, y01), (x02, y02), (x03, y03) and (x04, y04); S52, using the trained rectangular edge data and the Prewitt operator in real time to extract the area where the square-shaped character wheel is located in the optimized image to obtain a target character wheel area; S53, according to the obtained target character wheel area, adjusting the area of the largest reasoning result so that all characters are placed in the front position, and obtaining a front character wheel area image; S54, training the front character wheel area picture after the above processing with a second CNN convolutional neural network model to calculate the character wheel number.
2. A method for identifying the reading of a digital water meter wheel according to claim 1, characterized in that: Step S51 includes the following steps: S511, collecting several optimized images obtained by processing; S512, manually framing the area where the square-shaped character wheel is located in each optimized image; S513, putting the optimized image with the manually framed square-shaped character wheel area into the first CNN convolutional neural network model, and training the first CNN convolutional neural network model so that the first CNN convolutional neural network model, the convolution kernel and the convolution pool can recognize the trained rectangular edge data where the character wheel is located in all optimized images.
3. A method for identifying the reading of a digital water meter wheel according to claim 2, characterized in that: Step S52 includes the following steps: S521, inputting the optimized image obtained by processing in step S4, and using the Prewitt operator to detect edge data in the optimized image; S522, using the feature that two pairs of sides of a rectangular edge are equal and parallel, find all circumscribed rectangular edges from the edge data; S523, calculating the edge areas M1 of all rectangles; S524, sort all the rectangular edges according to the size of M1, and after sorting, all the rectangular edges are numbered from 1 to N. The smaller the number, the larger the M1 of the corresponding rectangular edge, and i is initialized to 0; S525, life i=i+1; S526, determining whether i is greater than N, if i is greater than N, proceeding to step S530 and outputting a result that the camera may be installed incorrectly; If i is not greater than N, proceed to step S537; S527, designate the edge of the rectangle with index equal to i as the edge of the target rectangle, the coordinates of the second set of four right-angle points of the edge of the target rectangle are (x11, y11), (x12, y12), (x13, y13) and (x14, y14), and the area of the second rectangle of the edge of the target rectangle is M2; S528, determine whether at least three of the conditions 1, 2, 3 and 4 are met, condition 1 is whether (x11, y11) is within the range (x01±△p1, y01±△q1), condition 2 is whether (x12, y12) is within the range (x02±△p2, y02±△q2), condition 3 is whether (x13, y13) is within the range (x03±△p3, y03±△q3), condition 4 is whether (x14, y14) is within the range (x04±△p4, y04±△q4); if at least three conditions are met, proceed to step S528; if at least three conditions are not met, return to step S525; S529, compare the second rectangular area M2 of the target rectangular edge with the first rectangular area M0 of the trained rectangular edge. If M2 is greater than or equal to M0, the area surrounded by the target rectangular edge is used as the target character wheel area, and the four right-angle point coordinates of the target character wheel area are the second group of four right-angle point coordinates; if M2 is less than M0, the area surrounded by the trained rectangular edge data is used as the target character wheel area, and the four right-angle point coordinates of the target character wheel area are the first group of four right-angle point coordinates, and the result of obtaining the target character wheel area is output; S530, end.
4. A method for identifying the reading of a digital water meter wheel according to claim 3, characterized in that: Step S53 includes the following steps: S531, according to the coordinates of the four rectangular points of the target character wheel area, the perspective transformation matrix of the original image is transformed into the target image, the original image is rotated to the horizontal, and the character wheel area image is taken out by taking a screenshot according to the four rectangular coordinates after the perspective transformation; S532, calculate the length and width of the wheel area image, the length is in the X direction, the width is in the Y direction, if the length is smaller than the width, rotate 90 degrees clockwise; S533, the third CNN convolutional neural network model is used to identify the direction of the number on the extracted character wheel area image to identify whether the number is inverted. If it is inverted, it is rotated horizontally; if it is not inverted, no operation is performed. S534, performing digital recognition using the fourth CNN convolutional neural network model on the character wheel area image processed in S533, and outputting all the numbers from 0 to 9.
Citation Information
Patent Citations
A method for digital recognition and processing of wheel-type water meters based on deep learning
CN117115802B