Water gauge identification method and device based on 3D projection, and electronic equipment
Through the water level ruler recognition method based on 3D projection, the world coordinates of the water level ruler are calculated using the initial detection frame and the camera's internal and external parameters, the identification accuracy problem of the water level ruler reading in poor lighting environments is solved, and high-precision water level monitoring is achieved in all-weather and multi-scene scenarios.
Patent Information
- Application Number
- CN202510435104.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-29
AI Technical Summary
In the prior art, the recognition accuracy of water level reading recognition is poor in environments with poor lighting conditions, especially in night or in severe weather conditions, resulting in untimely acquisition of water level information, affecting the timeliness and accuracy of disaster warning and emergency response.
The water level ruler recognition method based on 3D projection is adopted. By obtaining the water level ruler image, the initial detection frame is used to identify the image coordinates of the water level ruler and the contact point of the water surface, and 3D projection calculation is performed in combination with the camera's internal and external parameters to determine the water level value.
Maintaining high-precision water level reading recognition under various lighting and weather conditions improves the accuracy and robustness of water level scale readings, reduces the demand for computing resources, adapts to a variety of monitoring scenarios, and reduces dependence on deep learning models.
Smart Images

Figure CN120388381A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image water level recognition or other related fields. Specifically, it relates to a water level gauge recognition method and device based on 3D projection, and an electronic device. Background Art
[0002] The water level gauge reading recognition technology in the hydrological field plays a crucial role in hydrological monitoring. It realizes the automatic recognition of water gauge scales and numbers, so as to quickly and accurately monitor the water level changes, especially in the water level monitoring of rivers, lakes and reservoirs. Traditional technical solutions mainly rely on image processing technologies such as grayscale conversion, binarization, denoising, edge detection, etc., and use template matching or classical machine learning algorithms (such as support vector machine SVM, random forest, K-nearest neighbor KNN) to identify the numbers on the water gauge. However, these methods have limitations in terms of generalization and robustness. Especially in an environment with poor lighting conditions, such as at night or in bad weather, the accuracy and efficiency of recognition will drop significantly.
[0003] Although machine learning methods have made significant progress in water gauge reading recognition, there are still some key problems. Especially in specific environmental conditions, such as at night or in scenes with insufficient lighting, the recognition accuracy will drop significantly. This is because the lighting is insufficient at night, and the numbers on the water gauge under the monitoring camera at medium and high positions become blurred, making it difficult for OCR technology to accurately identify. This may lead to the inability to obtain water level information in a timely and accurate manner during critical periods, such as flood warnings, thus affecting the timeliness and accuracy of disaster warnings and emergency responses.
[0004] In addition, in related technologies, the hydrological water gauge reading recognition based on traditional image processing has poor generalization and versatility. One algorithm can only support one water level gauge, and many thresholds need to be set according to human experience. It is very sensitive to background lighting and is mostly used in single scenes, with a large error in recognition accuracy.
[0005] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention
[0006] Embodiments of the present invention provide a water level gauge recognition method and device based on 3D projection, and an electronic device, so as to at least solve the technical problem of poor recognition accuracy in the water level gauge reading recognition method in related technologies.
[0007] To achieve the above object, according to an aspect of the present application, a water level gauge recognition method based on 3D projection is provided, including: obtaining a current image of the water level gauge, recognizing the current image based on an initialized detection frame, and obtaining the image coordinates of the contact point between the water level gauge and the current water surface; calculating the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of a preset camera; calculating the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value.
[0008] Optionally, the step of obtaining a current image of the water level gauge and recognizing the current image based on an initialized detection frame to obtain the image coordinates of the contact point between the water level gauge and the current water surface includes: performing frame expansion processing on the left and right sides and the lower side of the detection frame; respectively performing threshold transformation processing, opening and closing operation processing, and maximum contour query on the expanded detection frame to obtain the mask area of the water level gauge above the water surface; obtaining the coordinates of the points in the lowermost area of the mask in the mask area, and determining the coordinates as the local image coordinates of the contact point between the water level gauge and the current water surface; transforming the local image coordinates to the full-image coordinates through a coordinate transformation strategy to obtain the image coordinates of the contact point between the water level gauge and the current water surface.
[0009] Optionally, the initialized world coordinates of the water level gauge and the initialized water level value are obtained in the following manner: collecting multiple frames of images of the water level gauge through a preset camera, and performing target detection on each frame of the image to identify the area of the water level gauge in the image; cropping the area of the water level gauge in the image, and obtaining the position and character information of the specified character in the area of the water level gauge through an image recognition algorithm; obtaining the initialized water level value based on the position and character information of the specified character in the water level gauge; performing feature point matching on each frame of the image to obtain the internal and external parameters of the preset camera, and obtaining the initial image coordinates of the contact point between the water level gauge and the water surface; determining the initialized world coordinates of the water level gauge based on the internal and external parameters of the preset camera and the initial image coordinates of the contact point between the water level gauge and the water surface.
[0010] Optionally, the step of obtaining the position and character information of the specified character in the area of the water level gauge through an image recognition algorithm includes: detecting the character position of the specified character in the area of the water level gauge through a text detection model, where the text detection model; using a text recognition model to perform text recognition on the character displayed at the character position to obtain the character information.
[0011] Optionally, the step of obtaining the initialized water level value based on the positions and character information of specified characters in the water level gauge includes: sorting all characters from bottom to top by position, calculating the interval difference between numbers, and using the interval difference as the basic scale value; determining whether there is an 'E' character among all characters; if there is an 'E' character, obtaining the scale value corresponding to a complete 'E' character, and calculating the image pixel value corresponding to the complete 'E' character closest to the water surface through the text detection frame; selecting the complete number closest to the water surface from the character sorting result as the reference number, and extracting the water level value corresponding to the reference number; obtaining the initial position of the contact point between the water level gauge and the water surface, and calculating the distance value of the reference number from the water surface based on the initial position and the water level value corresponding to the reference number; obtaining the initialized water level value based on the water level value corresponding to the reference number, the distance value of the reference number from the water surface, the image pixel value corresponding to the complete 'E' character closest to the water surface, and the scale value corresponding to the complete 'E' character; if there is no 'E' character, solving the pixel difference between the two numbers closest to the water surface; obtaining the initialized water level value based on the pixel difference, the basic scale value, the water level value corresponding to the reference number, and the distance value of the reference number from the water surface.
[0012] Optionally, the step of calculating the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value includes: calculating the coordinate difference between the world coordinates of the current water surface contact point and the initialized world coordinates of the water level gauge; calculating the change value of the current water level value compared to when the water level gauge was initialized based on the coordinate difference; calculating the difference between the change value of the current water level value compared to the initialization and the initialized water level value to obtain the current water level value.
[0013] Optionally, the step of calculating the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of a preset camera includes: converting the image coordinates of the water level gauge and the current water surface contact point into camera coordinates through the internal parameter matrix of the preset camera; converting the points in the camera coordinates into points in the world coordinate system through the external parameter matrix of the preset camera and a preset translation vector to obtain the world coordinates of the current water surface contact point.
[0014] According to another aspect of the embodiments of the present invention, a water level gauge recognition device based on 3D projection is further provided, including: an image recognition unit, configured to obtain a current image of the water level gauge, recognize the current image based on an initialized detection frame, and obtain the image coordinates of the contact point between the water level gauge and the current water surface; a coordinate calculation unit, configured to calculate the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of a preset camera; a water level calculation unit, configured to calculate the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value.
[0015] Optionally, the image recognition unit includes: a frame expansion module, configured to perform frame expansion processing on the left and right sides and the lower side of the detection frame; a mask acquisition module, configured to perform threshold transformation processing, opening and closing operation processing, and maximum contour query on the expanded detection frame respectively, to obtain the mask area of the water level gauge above the water surface; a first coordinate acquisition module, configured to obtain the coordinates of the points in the lowermost area of the mask in the mask area, and determine the coordinates as the local image coordinates of the contact point between the water level gauge and the current water surface; a coordinate transformation module, configured to transform the local image coordinates to the full-image coordinates through a coordinate transformation strategy to obtain the image coordinates of the contact point between the water level gauge and the current water surface.
[0016] Optionally, when the water level gauge recognition device based on 3D projection obtains the initialized world coordinates of the water level gauge and the initialized water level value, it includes: a target detection unit, configured to collect multiple frames of images of the water level gauge through a preset camera, and perform target detection on each frame of the image to identify the area where the water level gauge in the image belongs; an image adjudication unit, configured to crop the area where the water level gauge in the image belongs, and obtain the position and character information of the specified character in the area where the water level gauge belongs through an image recognition algorithm; a water level value initialization unit, configured to obtain the initialized water level value based on the position and character information of the specified character in the water level gauge; a feature point matching unit, configured to perform feature point matching on each frame of the image, obtain the internal and external parameters of the preset camera, and obtain the initial image coordinates of the contact point between the water level gauge and the water surface; an initialized world coordinate unit, configured to determine the initialized world coordinates of the water level gauge based on the internal and external parameters of the preset camera and the initial image coordinates of the contact point between the water level gauge and the water surface.
[0017] Optionally, the image adjudication unit includes: a character detection module, configured to detect the character position of the specified character in the area where the water level gauge belongs through a text detection model, where the text detection model; a text recognition module, configured to perform text recognition on the character displayed at the character position by using a text recognition model to obtain the character information.
[0018] Optionally, the water level value initialization unit includes: a character sorting module for sorting all characters from bottom to top by position, calculating the interval difference between numbers, and using the interval difference as the base scale value; an E character judgment module for judging whether there is an E character in all characters; a first initialized water level value determination module for, if there is an E character, obtaining the scale value corresponding to a complete E character, and calculating the image pixel value corresponding to the complete E character closest to the water surface through the text detection frame; selecting the complete number closest to the water surface from the character sorting result as the reference number, and extracting the water level value corresponding to the reference number; obtaining the initial position of the contact point between the water level ruler and the water surface, and calculating the distance value of the reference number from the water surface based on the initial position and the water level value corresponding to the reference number; obtaining the initialized water level value based on the water level value corresponding to the reference number, the distance value of the reference number from the water surface, the image pixel value corresponding to the complete E character closest to the water surface, and the scale value corresponding to the complete E character; a second initialized water level value determination module for, if there is no E character, solving the pixel difference between the two numbers closest to the water surface; and obtaining the initialized water level value based on the pixel difference, the base scale value, the water level value corresponding to the reference number, and the distance value of the reference number from the water surface.
[0019] Optionally, the water level calculation unit includes: a coordinate difference calculation module for calculating the coordinate difference between the world coordinates of the current water surface contact point and the world coordinates of the initialized water level ruler; a water level change calculation module for calculating the change value of the current water level value compared to when the water level ruler is initialized based on the coordinate difference; and a current water level calculation module for calculating the difference between the change value of the current water level value compared to the initialization and the initialized water level value to obtain the current water level value.
[0020] Optionally, the coordinate calculation unit includes: a camera coordinate conversion module for converting the image coordinates of the water level ruler and the current water surface contact point into camera coordinates through the internal parameter matrix of the preset camera; and a world coordinate conversion module for converting the points in the camera coordinates into points in the world coordinate system through the external parameter matrix of the preset camera and the preset translation vector to obtain the world coordinates of the current water surface contact point.
[0021] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, which includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the 3D projection-based water level ruler recognition method described in any one of the above.
[0022] According to another aspect of the embodiments of the present invention, an electronic device is further provided, including one or more processors and a memory, where the memory is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method for identifying a water level gauge based on 3D projection according to any one of the above.
[0023] According to another aspect of the embodiments of the present invention, a computer program product is further provided, including a computer program, where when the computer program is executed by a processor, the steps of the method for identifying a water level gauge based on 3D projection according to any one of the above are implemented.
[0024] In the present disclosure, a current image of the water level gauge is obtained, the current image is identified based on an initialized detection frame to obtain the image coordinates of the contact point between the water level gauge and the current water surface, and based on the internal and external parameters of a preset camera, the world coordinates of the current water surface contact point are calculated through a 3D projection strategy. Based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value, the current water level value calibrated by the water level gauge is calculated.
[0025] From the above disclosure, key information extraction in the initialization stage (including the initialized position of the water gauge and character information) can be performed first, and the accurate calculation of the water level value can be realized through 3D projection technology. While reducing the demand for computing resources, it ensures high-precision water level reading recognition under various lighting and weather conditions, improves the reading accuracy of the water level gauge, and thus solves the technical problem of poor recognition accuracy in the water level gauge reading recognition method in the related art. Description of the Drawings
[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0027] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing the method for identifying a water level gauge based on 3D projection is shown;
[0028] Figure 2 It is a flowchart of an optional method for identifying a water level gauge based on 3D projection according to an embodiment of the present invention;
[0029] Figure 3 It is an overall flowchart of an optional method for identifying a general water level gauge based on 3D projection in a monitoring scenario according to an embodiment of the present invention;
[0030] Figure 4 It is an optional flowchart for estimating camera parameters according to an embodiment of the present invention;
[0031] Figure 5 It is a schematic diagram of an optional water level gauge target detection according to an embodiment of the present invention;
[0032] Figure 6 It is a schematic diagram of calculating the position of the contact point between the water level gauge and the water surface according to an embodiment of the present invention;
[0033] Figure 7 It is a schematic diagram of an optional key character recognition of the water level gauge according to an embodiment of the present invention;
[0034] Figure 8 It is a flowchart of an optional calculation of the initial water level value according to an embodiment of the present invention;
[0035] Figure 9 It is a schematic diagram of an optional water level gauge recognition device based on 3D projection according to an embodiment of the present invention;
[0036] Figure 10 It is a block diagram of the structure of an electronic device according to an embodiment of the present application. Detailed implementation manners
[0037] In order to enable those skilled in the art of this technology to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0039] For the convenience of those skilled in the art to understand the present invention, the following explanations are made for some terms or nouns involved in each embodiment of the present invention:
[0040] Optical Character Recognition, abbreviated as OCR, is a technology that converts text in images into editable and searchable text data. In the scenario of water gauge reading recognition in the hydrological field of the present invention, OCR is used to recognize the numbers and letters detected from the water gauge images, such as recognizing "E" and specific numerical values, which are crucial for calculating the actual water level. In the present invention, the OCR technology is used for key character detection and recognition in the initialization stage to obtain the numbers and "E" characters on the water gauge, ensuring that the algorithm can calculate the accurate water level value.
[0041] 3D projection is used to map points in 3D space onto a 2D image plane. In the present invention, the 3D projection technology is used to convert the coordinates of the water gauge and water surface contact points calculated from the image coordinate system into the world coordinate system, so that the water level can be calculated based on the real spatial position information. By combining the internal and external parameters of the camera, 3D projection can more accurately determine the actual height of the water gauge reading. Especially at night or in bad weather conditions when it is difficult to identify based on 2D images, 3D projection provides a more robust method to calculate the water level.
[0042] A PTZ (Pan Tilt Zoom) camera, also known as a rotating ball camera, is a camera that can remotely control its pan, tilt, and zoom functions. In the camera parameter estimation stage of the present invention, multiple frames of pictures are obtained through the rotating ball camera, and these pictures are used to calculate the internal and external parameters of the camera, thus providing accurate camera position information for subsequent 3D projection calculation and water level monitoring. The use of the rotating ball camera, especially its zoom-invariant rotation, ensures that the obtained pictures can meet the needs of parameter calculation, while providing sufficient image details and viewing range.
[0043] YOLOv8s, a target detection model, provides fast and accurate target localization and classification. In the present invention, YOLOv8s is used for water gauge target detection, that is, to determine the position of the water gauge in the image in the initialization stage. This model is trained to accurately recognize the water gauge from a complex image background, providing a basis for subsequent key character detection and water level calculation.
[0044] The text detection model DBnet (Differentiable Binarization net) is a deep learning model for text detection. It can detect the regions where text exists in the image, that is, text lines. In the present invention, DBnet is used to detect the positions of key characters on the water gauge, such as numbers and "E" characters. By training on a large amount of general and water-gauge-specific data, DBnet can accurately locate the text regions on the water gauge, preparing data for subsequent character recognition steps.
[0045] The recognition model CRNN, Convolutional Recurrent Neural Network, is a deep learning model for optical character recognition (OCR). It combines the characteristics of convolutional neural network (CNN) and recurrent neural network (RNN). In the present invention, CRNN is used to recognize the text content detected from the water gauge image, including numbers, units, etc. CRNN extracts image features through CNN and then serially processes these features through RNN to recognize continuous text. Even when the character part is blurred or occluded, it can provide relatively accurate recognition results.
[0046] It should be noted that the 3D projection-based water gauge recognition method and device in the present disclosure can be used in the field of image water level recognition technology for water gauge recognition based on 3D projection calibration in a monitoring scenario, and can also be used in any field other than the field of image water level recognition technology for water gauge recognition based on 3D projection calibration in a monitoring scenario. The application field of the 3D projection-based water gauge recognition method and device in the present disclosure is not limited.
[0047] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected in the present disclosure are information and data authorized by the user or fully authorized by all parties. And the processing of relevant data, such as collection, storage, use, processing, transmission, provision, disclosure, and application, all comply with the relevant laws, regulations, and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse. For example, there is an interface between the present system and relevant users or institutions. Before obtaining relevant information, a request for acquisition needs to be sent to the aforementioned users or institutions through the interface, and after receiving the consent information feedback from the aforementioned users or institutions, the relevant information is obtained.
[0048] It should be noted that in the present disclosure, when collecting customer information, analyzing customer information, a corresponding operation entrance is provided for users to choose to agree or refuse the automated decision result; if the user chooses to refuse, the expert decision-making process will be entered.
[0049] It should be noted that the present invention can be applied to scenarios such as river monitoring, urban waterlogging early warning, agricultural irrigation management, marine and lake ecological research, etc. The present invention is illustrated by taking the river monitoring scenario as an example. For example, monitoring devices (such as PTZ cameras) can be installed at fixed or mobile monitoring points in waters such as rivers, lakes, and reservoirs. Especially in high-point monitoring scenarios, such as high-altitude cameras on bridges, dams, or mountains, they are used to monitor the water level changes in real time. Especially at night or under bad weather conditions, it ensures the accurate acquisition of water level information.
[0050] The following embodiments of the present invention can be applied to various systems / applications / devices for 3D projection-based water level gauge recognition. The present invention can still accurately recognize the numbers on the water level gauge at night or under bad weather with poor lighting conditions, which can avoid the problem of misrecognition of the water gauge readings caused by the blurring of key numbers on the water gauge in harsh environments such as at night, under low light, or on foggy and rainy days. It has strong generalization ability and can cope with various harsh environments.
[0051] In addition, except for the initialization stage which requires calling a deep learning model, the subsequent monitoring process of the present invention is based on traditional image processing techniques and 3D projection calculations, greatly reducing the dependence on GPU resources, reducing the computing cost, accelerating the running speed of the algorithm, and improving the real-time performance and responsiveness.
[0052] The present invention can support more than 20 common water level gauges through a set of algorithms, adapt to various monitoring scenarios, and does not require separate parameter adjustment for each water level gauge, greatly improving the applicable range and efficiency of the algorithm.
[0053] Furthermore, the present invention has a certain anti-interference ability against the occlusion of key characters. Even if some numbers or characters are occluded, the water level value can still be accurately judged through other recognizable characters and 3D projection calculations, improving the robustness of the system in complex environments.
[0054] The following will describe the present invention in detail in conjunction with each embodiment.
[0055] Embodiment 1
[0056] According to an embodiment of the present invention, an embodiment of a method for recognizing a water level gauge based on 3D projection is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0057] The embodiment of the method for recognizing a water level gauge based on 3D projection provided in the first embodiment of the present application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Figure 1The figure shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a water level gauge recognition method based on 3D projection. As Figure 1 shown, the computer terminal 10 (or mobile device) may include one or more ( Figure 1 illustrated as 102a, 102b, ……, 102n in the figure) processors 102 (the processor 102 may include, but is not limited to, processing devices such as a microprocessor MCU (Microcontroller Unit) or a field programmable gate array FPGA (Field Programmable Gate Array)), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only illustrative and does not limit the structure of the above electronic device. For example, the computer terminal 10 may further include more or fewer components than Figure 1 shown in the figure, or have a different configuration from Figure 1 shown in the figure.
[0058] It should be noted that the above one or more processors 102 and / or other data processing circuits are generally referred to as "data processing circuits" herein. The data processing circuit may be embodied in whole or in part as software, hardware, firmware, or any other combination. In addition, the data processing circuit may be a single independent processing module, or be incorporated in whole or in part into any one of the other elements in the computer terminal 10 (or mobile device). As involved in the embodiments of the present application, the data processing circuit is used for processor control (such as the selection of a variable resistor terminal path connected to an interface).
[0059] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the water level gauge recognition method based on 3D projection in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned water level gauge recognition method based on 3D projection. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories can be connected to the computer terminal 10 through a network. Examples of the above network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and combinations thereof.
[0060] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one instance, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0061] The display can be, for example, a touch-screen liquid crystal display (Liquid Crystal Display, LCD for short), and this liquid crystal display enables a user to interact with the user interface of the computer terminal 10 (or mobile device).
[0062] Under the above operating environment, the present application provides a Figure 2 water level gauge recognition method based on 3D projection as shown. Figure 2 is a flowchart of an optional water level gauge recognition method based on 3D projection according to an embodiment of the present invention, as Figure 2 shown, and the method includes the following steps:
[0063] Step S201, obtain a current image of the water level gauge, and recognize the current image based on an initialized detection frame to obtain the image coordinates of the contact point between the water level gauge and the current water surface.
[0064] In the continuous monitoring stage of the present invention, first, it is necessary to obtain the current image of the water level gauge captured by the monitoring camera (for example, a PTZ camera). Since the accurate position of the water level gauge has been obtained through a deep learning model (such as the YOLOv8s neural network or the GAN network, selected by oneself) in the initialization stage, this detection frame at a fixed position can be used to further analyze the current image. Specifically, by applying the initialized detection frame to the current image, the water level gauge area can be effectively located. Through the recognition based on the initialized detection frame, repositioning the water level gauge every time of monitoring can be avoided, improving the detection efficiency and stability. In addition, the application of image processing technology can more accurately locate the contact point, ensuring the accuracy of the contact point coordinates even at night or under bad weather conditions, thus providing reliable basic data for the subsequent calculation of the water level value.
[0065] Optionally, the step of obtaining the current image of the water level gauge captured, and identifying the current image based on the initialized detection frame to obtain the image coordinates of the contact point between the water level gauge and the current water surface includes: performing an expansion frame process on the left and right sides and the lower side of the detection frame; respectively performing threshold transformation processing, opening and closing operation processing, and maximum contour query on the expanded detection frame to obtain the mask area of the water level gauge above the water surface; obtaining the coordinates of the points in the lowermost area of the mask in the mask area, and determining this coordinate as the local image coordinates of the contact point between the water level gauge and the current water surface; transforming the local image coordinates to the full-image coordinates through a coordinate transformation strategy to obtain the image coordinates of the contact point between the water level gauge and the current water surface.
[0066] In the initialization stage, the algorithm obtains the detection frame of the water level gauge through a deep learning model. However, since the contact point between the water level gauge and the water surface may be located at the edge of the detection frame or slightly exceed the detection frame, directly using the detection frame may not accurately capture the details of the contact point. Therefore, it is necessary to perform an expansion frame process on the detection frame to increase the coverage range of the detection frame to ensure that all information of the water gauge is covered, especially the junction between the water gauge and the water surface. Among them, the expansion frame strategy can be set by oneself. For example, the width of the detection frame is respectively expanded by 10% on the left and right sides, and the height is expanded by 10% downward to include more edge information and possible water surface parts, which helps to more accurately locate the contact point in the subsequent processing. Through the expansion frame, the algorithm can analyze the contact between the water gauge and the water surface from a broader perspective, reducing the omission of key information that may be caused by the edge limitation of the detection frame and improving the accuracy of the contact point positioning.
[0067] It should be noted that in this embodiment, threshold transformation processing is performed on the detected frames after frame expansion. The purpose is to convert the image into a binary image, enhance the contrast between the water gauge and the background, and make the edge features of the contact points more obvious. By selecting an appropriate threshold, the parts of the water gauge and the water surface in the image are marked as the foreground (for example, white), and the remaining parts are marked as the background (for example, black), so as to highlight the numbers and scales of the water gauge and facilitate subsequent processing. The opening and closing operation processing is a morphological operation used to remove noise in the image and fill small holes in the target area. The opening operation first performs an erosion operation to remove small foreground areas (such as stains on the water gauge or other non-scale features), and then performs a dilation operation to fill the breaks in the scale lines, making the contour of the water gauge smoother and more continuous. The closing operation first performs a dilation operation and then an erosion operation to close the small holes in the water gauge digital area and eliminate the connection noise between the numbers, ensuring that the digital area is clearly distinguishable. Further, the maximum contour query means that after binarization and morphological processing, the algorithm needs to identify the contour belonging to the water gauge from the processed image. By querying the maximum contour, the boundary of the water gauge can be determined, especially the part where the water gauge contacts the water surface. The maximum contour usually represents the main visible part of the water gauge in the image, including the scale lines and the digital area, which helps to further accurately locate the contact point between the water gauge and the water surface.
[0068] After the maximum contour query, the obtained mask region contains the complete information of the water gauge. Analyzing the bottom of the mask region, the bottommost pixel point or pixel region usually corresponds to the contact point between the water gauge and the water surface. If the bottommost region appears as a line, the midpoint coordinates of the line are taken as the local image coordinates of the contact point. If it is a point, the coordinates of the point are directly used. This coordinate is the relative position within the local frame after frame expansion.
[0069] Since the local image coordinates are determined in the local area after frame expansion, in order to locate the contact point in the whole image, coordinate transformation is required. This step utilizes the image scaling and translation relationship before and after frame expansion to map the local image coordinates back to the coordinate system of the whole image, obtaining the coordinates in the whole image, that is, the image coordinates of the contact point between the water level gauge and the current water surface.
[0070] Through the above image processing technology, the embodiments of the present invention can accurately identify the contact point between the water gauge and the water surface under various lighting conditions. Even in low light at night or in bad weather, the contact point can be determined through the processed image features such as edges and contours, thus ensuring the accuracy and reliability of the water level reading. In addition, through the transformation from local coordinates to full-map coordinates, the consistency of the position information of the contact point in the image with the full-map coordinate system is ensured, providing an accurate basis for subsequent 3D projection calculations. This not only improves the robustness and accuracy of the water level gauge reading recognition algorithm, but also reduces the dependence on the deep learning model, reduces the consumption of computing resources, and ensures the stable operation and efficient processing ability of the algorithm in various environments.
[0071] Step S202, based on the internal and external parameters of the preset camera, calculate the world coordinates of the current water surface contact point through a 3D projection strategy.
[0072] After obtaining the image coordinates of the water gauge and the current water surface contact point, the next step is to convert these two-dimensional coordinates into three-dimensional world coordinates to calculate the actual water level. Since the internal and external parameters of the camera, including the focal length, the coordinates of the image center point, and the position and attitude of the camera in the world coordinate system, have been calculated in the initialization stage, these parameters can be used for 3D projection calculations. Specifically, first convert the image coordinates into coordinates in the camera coordinate system, and then use the external parameter matrix R and translation vector T of the camera to convert the contact point coordinates in the camera coordinate system into coordinates in the world coordinate system. In this way, the accurate position of the contact point in space can be obtained, rather than just the relative position in the image.
[0073] Optionally, the step of calculating the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of the preset camera includes: converting the image coordinates of the water gauge and the current water surface contact point into camera coordinates through the internal parameter matrix of the preset camera; converting the points in the camera coordinates into points in the world coordinate system through the external parameter matrix of the preset camera and the preset translation vector to obtain the world coordinates of the current water surface contact point.
[0074] Among them, the 3D projection strategy is a key step in converting two-dimensional image coordinates into three-dimensional world coordinates. This step is particularly crucial for improving the accuracy of water level reading recognition, especially when the lighting conditions are poor or the water gauge is in an inclined state.
[0075] It should be noted that the camera intrinsic parameter matrix in this embodiment includes the optical characteristics of the camera, such as focal length and image center coordinates, and is used to convert pixel coordinates on the image into coordinates in the camera coordinate system. This conversion process takes into account the perspective projection relationship of the camera and maps points on the image plane into the three-dimensional space of the camera coordinate system. For example, given a pixel point (u, v) on an image, the position of the point relative to the camera in the camera coordinate system can be obtained by transforming it using the intrinsic parameter matrix K (usually a 3x3 matrix).
[0076] It should also be noted that the extrinsic parameter matrix and preset translation vector in this embodiment are used to describe the position and posture of the camera in the world coordinate system. The extrinsic parameter matrix can be a 3x3 rotation matrix, which describes the rotation relationship between the camera coordinate system and the world coordinate system; the translation vector describes the position of the camera in the world coordinate system. Using the extrinsic parameter matrix and the preset translation vector, a point in the camera coordinate system can be transformed into the world coordinate system, thereby obtaining the actual position of the point in three-dimensional space.
[0077] The acquisition of the extrinsic parameter matrix and the preset translation vector is usually completed in the initialization phase. Through feature point matching of multiple frames of images and the camera pose estimation algorithm, the precise position and posture of the camera relative to the world coordinate system are obtained. In this process, the purpose is to ensure that the calculated extrinsic parameters can accurately reflect the geometric relationship between the camera and the world coordinate system. In subsequent water level monitoring, these preset parameters are used to convert each detected water surface contact point from camera coordinates to world coordinates, thereby obtaining the actual height information of the contact point. Compared with the intrinsic parameter conversion, the extrinsic parameter conversion focuses more on describing the relative position of the camera and the external environment, providing the necessary spatial coordinate information for water level calculation, and ensuring the consistency and accuracy of the monitoring results under different lighting and weather conditions.
[0078] Through the above implementation steps, it is possible to maintain high accuracy of water level gauge reading recognition not only during well-lit daytime, but also at night or in harsh environments such as foggy and rainy days. This reduces the need to rely on deep learning models, reduces the consumption of computing resources, and also enhances the generalization ability and robustness of the algorithm.
[0079] By introducing 3D projection, the embodiments of the present invention can more comprehensively consider the spatial position of the water gauge in the actual environment, improve the accuracy and reliability of recognition, and are of great significance for realizing all-weather and multi-scenario automatic water level monitoring. At the same time, the embodiments of the present invention calculate the world coordinates through the 3D projection strategy, which can effectively solve the problem of reading errors caused by inclination, angle change or distance in the image. Even if the water level gauge appears distorted or deformed in the image, the converted world coordinates can still accurately reflect the actual position of the contact point, thereby ensuring that the calculated water level value is more accurate. Especially in the case of long-distance monitoring or uncertain position of the water level gauge, the application of 3D projection technology improves the robustness and generalization ability of the algorithm.
[0080] Step S203: Calculate the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value.
[0081] Optionally, the step of calculating the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value includes: calculating the coordinate difference between the world coordinates of the current water surface contact point and the initialized world coordinates of the water level gauge; based on the coordinate difference, calculating the change value of the current water level value compared with the initialization of the water level gauge; calculating the difference between the change value of the current water level value compared with the initialization and the initialized water level value to obtain the current water level value.
[0082] In the continuous monitoring mode, whenever the algorithm determines the image coordinates of a new water surface contact point from the current image, it will use the preset internal and external camera parameters to convert it into coordinates in the world coordinate system through the 3D projection strategy. This coordinate represents the actual spatial position where the water surface contacts the water level gauge at the current moment. Subsequently, this world coordinate is compared with the base point of the world coordinates of the water level gauge calculated in the initialization stage (i.e., the contact point coordinates of the water level gauge in the initial state), and the coordinate difference between the two is calculated, which is the change in spatial distance. This coordinate difference is the basis for subsequent calculation of the water level change amount and provides a quantitative index for evaluating the water level change from the spatial dimension.
[0083] It should be noted that the coordinate difference in this embodiment represents the displacement of the water surface contact point on the water level gauge in the world coordinate system, which is a direct manifestation of the water level change. In order to convert this displacement into a water level change value, a mapping relationship between the coordinate difference and the water level change needs to be established. In the initialization stage, by detecting and identifying the position and content of the key numbers on the water level gauge, the proportional relationship between the water level increment represented by each number and the pixel distance in the image has been calculated. Now, using this proportional relationship, the relative change value of the water level can be calculated according to the coordinate difference between the current contact point and the initialized contact point. For example, if the coordinate difference value is positive, it means that the water surface contact point moves upward and the water level rises; conversely, if the coordinate difference value is negative, the water level drops.
[0084] After obtaining the change value (rise or fall) of the current water level compared to the initial water level, it is necessary to further obtain the current absolute water level value. Here, this change value needs to be combined with the water level value measured during the initialization phase. Specifically, if the current water level has risen compared to the initialization, then the current water level value will be the sum of the initial water level value and the water level rise change value; if it has fallen, it will be the initial water level value minus the water level fall change value, so as to obtain the water level value calibrated by the current water level gauge.
[0085] In this embodiment, after obtaining the world coordinates of the current water surface contact point, the key parameters obtained during the initialization phase, namely the base point of the water level gauge world coordinates and the corresponding initial water level value, can be combined to calculate the current water level value. First, calculate the spatial distance between the current contact point coordinates and the base point of the initial water level gauge coordinates. Then, based on the water level value calculated during the initialization phase and the pixel distance of the contact point from the water surface in the initial image, deduce the proportional relationship between the pixel distance and the actual water level value. Finally, use the spatial distance between the current contact point and the base point of the initial water level gauge coordinates, combined with the preset proportional relationship, to calculate the actual water level corresponding to the current contact point, and compare it with the initial water level value to obtain the change amount of the current water level.
[0086] By converting the coordinates of the contact point into world coordinates and performing calculations in combination with the initial water level value, this method can effectively avoid reading errors caused by changes in illumination, angle, and resolution in image processing. Even in the case of poor lighting conditions or a decrease in the quality of the water gauge image, it can maintain high-precision water level calculation, ensuring the continuity and accuracy of water level monitoring. In addition, since the calculation is mainly based on the fixed parameters obtained during the initialization phase, the subsequent calls to the deep learning model are reduced, thereby reducing the consumption of computing resources and improving the running efficiency and real-time performance of the algorithm.
[0087] Through the above steps, the current image of the water level gauge can be obtained, the current image can be recognized based on the initialized detection frame to obtain the image coordinates of the water level gauge and the current water surface contact point. Based on the internal and external parameters of the preset camera, the world coordinates of the current water surface contact point can be calculated through a 3D projection strategy. Based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value, the current water level value calibrated by the water level gauge can be calculated. In this embodiment, the key information extraction (including the initialized position of the water level gauge and character information) in the initialization phase can be carried out, and the accurate calculation of the water level value can be realized through 3D projection technology, so as to ensure high-precision water level reading recognition under various lighting and weather conditions while reducing the computing resource requirements, improving the reading accuracy of the water level gauge, and thus solving the technical problem of poor recognition accuracy in the water level gauge reading recognition method in the related art.
[0088] Optionally, the world coordinates of the water level gauge initialization and the initialized water level value are obtained as follows: capture multiple frames of images of the water level gauge through a preset camera, and perform object detection on each frame of the image to identify the area where the water level gauge is located in the image; crop the area where the water level gauge is located in the image, and obtain the position and character information of the specified characters in the area where the water level gauge is located through an image recognition algorithm; obtain the initialized water level value based on the position and character information of the specified characters in the water level gauge; perform feature point matching on each frame of the image to obtain the internal and external parameters of the preset camera, and obtain the initial image coordinates of the contact point between the water level gauge and the water surface; based on the internal and external parameters of the preset camera and the initial image coordinates of the contact point between the water level gauge and the water surface, determine the world coordinates of the water level gauge initialization.
[0089] First, use a camera (for example, a PTZ (Pan / Tilt / Zoom) dome camera, or a picture of the water level gauge scene taken by a drone) to take multi-angle pictures of the water level gauge (multi-angle pictures help to comprehensively capture the features of the water level gauge and ensure accurate detection of the model under different illuminations and angles), obtain a series of images containing the water level gauge, and then perform object detection on each frame of the image (of course, it can also be replaced by an instance segmentation method, which can be selected by yourself as long as the object in the image can be determined). It should be noted that when performing object detection, a deep learning model can be used to train the model to recognize the features of the water level gauge, so as to accurately locate the water level gauge area in the image.
[0090] After determining the position of the water level gauge in the image, crop the area where the water level gauge is located from the original image to reduce the size of the image for subsequent processing and improve efficiency. The cropped image detects the positions of the key characters on the water level gauge through a text detection algorithm (such as DBNet), and then identifies the content of the characters, including information such as numbers, units, and decimal points, through a text recognition algorithm (such as CRNN). The text detection and recognition technology ensures the accurate extraction of key numbers from the water level gauge. Even if the character part is blocked or blurred, it can be recognized through the detected features. Moreover, the accurate acquisition of character information is a prerequisite for calculating the water level value. Through this step, the algorithm can identify the values on the water scale, providing a direct basis for water level calculation.
[0091] Finally, using the obtained key character positions and contents, the algorithm will calculate the current water level value according to the scale rule of the water level gauge. For example, calculate the distance between the number closest to the water surface and the E character (if any) and the contact point with the water surface, as well as the numerical values of these numbers, to determine the reference value of the water level. Through the above information, the relationship between the pixel distance on the water scale and the actual water level value can be established, so as to obtain the initialized water level value as the reference point for subsequent calculation of water level changes. This step fully reflects the intelligent and automated characteristics of the algorithm, can adapt to various different types of water level gauges, and improves the versatility and adaptability of the system.
[0092] In addition, in multiple frames of images, feature points are extracted from each frame. For example, the SIFT (Scale-Invariant Feature Transform) feature is used, and then feature point matching is performed through algorithms such as BFMatcher or FLANN to determine the corresponding relationships between the images. Through feature point matching and camera pose estimation algorithms (such as cv.detail_HomographyBasedEstimator or cv.detail_AffineBasedEstimator), the internal and external parameters of the camera are estimated, including focal length, camera center position, rotation, and translation, etc. These parameters are crucial for 3D projection calculation. At the same time, image processing is performed on the contact points between the water level gauge and the water surface, such as threshold transformation, opening and closing operations, and maximum contour query, to obtain the initial coordinates of the contact points in the image.
[0093] It should be noted that in the present invention, when solving the camera parameters, in addition to selecting the SIFT feature of the image, the ORB feature can also be selected. In addition to BFMatcher for the feature matching algorithm, the FLANN feature matching algorithm can also be selected. In addition to cv.detail_HomographyBasedEstimator for the camera parameter estimation algorithm, cv.detail_AffineBasedEstimator can also be used. The text detection and recognition algorithm used in the present invention can also be replaced by other algorithms.
[0094] Based on the internal and external parameters of the preset camera and the initial image coordinates of the contact points between the water level gauge and the water surface, the initial world coordinates of the water level gauge are determined. Here, the internal and external parameters of the camera are used to convert the initial image coordinates of the contact points between the water level gauge and the water surface into the world coordinate system. Specifically, the image coordinates are converted into the coordinates in the camera coordinate system through the camera internal parameter matrix, and then the coordinates in the camera coordinate system are converted into the coordinates in the world coordinate system by using the external parameter matrix and the translation vector. The initial world coordinates of the water level gauge provide a stable reference point for subsequent water level change calculation. Even if the water gauge moves slightly due to water flow or wind force, accurate water level calculation can still be performed based on the world coordinates.
[0095] Through 3D projection technology, the algorithm can not only process planar images, but also consider the actual position of the water level gauge in space, improving the accuracy and reliability of the monitoring, especially in the case of the water gauge being tilted or having spatial deformation.
[0096] Through the implementation of these technical features, the present invention can not only accurately read the values on the water level gauge during the day with sufficient light, but also, even at night, under low light or adverse weather conditions, efficiently and accurately calculate the water level change through the key parameters obtained in the initialization stage, realizing all-weather and multi-scenario automatic water level monitoring.
[0097] Optionally, the step of obtaining the position and character information of the specified character in the area where the water level gauge is located through the image recognition algorithm includes: detecting the character position of the specified character in the area where the water level gauge is located through the text detection model, where the text detection model; using the text recognition model to perform text recognition on the character displayed at the character position to obtain the character information.
[0098] It should be noted that the text detection model in this embodiment is used to locate and frame the text area in the image. In particular, for the key specified characters (such as numbers and unit symbols) on the water level gauge, a specially trained deep learning model, such as DBNet (a real-time scene text detection model based on differentiable binarization), can be used to implement it. In the present invention, the text detection model is first applied to the water level gauge area cropped in the initialization stage, which is extracted from the initialization detection box and contains the complete information of the water gauge. The text detection model analyzes the image features, identifies the text area and gives its exact position in the image, usually represented in the form of a bounding box, and these bounding boxes accurately frame the area where each character or number is located. Through the text detection model, the characters on the water gauge can be quickly and accurately located. Even in the case of poor lighting, complex background or slightly blurred characters, the model can identify the exact position of the characters through the learned feature patterns, thus providing key positioning information for subsequent character recognition and improving the efficiency and accuracy of the overall recognition.
[0099] After the text detection model determines the exact position of the characters, the text recognition model (such as CRNN, a text recognition model based on recurrent neural network) is then used to interpret these characters. The text recognition model analyzes the image features of the character area and converts the characters in the image into readable text information. In the embodiment of the present invention, the text recognition model is designed to be able to recognize numbers, decimal points, units (such as meters, centimeters, millimeters, etc.) and special characters (such as E, used for scientific notation). Through the text recognition model, the detected character area can be converted into specific text information. Even if the characters are partially blurred or the lighting conditions are poor, the character content can be accurately parsed through the feature recognition ability of the deep learning model. This step is crucial for the accurate calculation of the water level reading because the correct character information is the basis for subsequent calculations and can ensure the correctness and consistency of the water level value.
[0100] It should be noted that the text recognition model can not only recognize numbers, but also special characters (such as E) and unit symbols, which enables the present invention to adapt to different types of water level gauges and increases the versatility and application scope of the algorithm.
[0101] By combining the text detection and recognition models, the present invention can accurately obtain the character information on the water level gauge under various lighting and weather conditions, improving the robustness of recognition and avoiding recognition errors caused by lighting changes or background complexity. The automatic processing of the text detection and recognition models reduces the dependence on manual annotation, automates the entire recognition process, improves the processing speed and efficiency, and reduces the operation cost.
[0102] Optionally, the step of obtaining the initialized water level value based on the positions and character information of the specified characters in the water level gauge includes: sorting all the characters from bottom to top according to their positions, calculating the interval differences between the numbers, and using the interval differences as the basic scale values; determining whether there is an E character among all the characters; if there is an E character, obtaining the scale value corresponding to a complete E character, and calculating the image pixel value corresponding to the complete E character closest to the water surface through the text detection box; selecting the complete number closest to the water surface from the character sorting result as the reference number, and extracting the water level value corresponding to the reference number; obtaining the initial position of the contact point between the water level gauge and the water surface, and calculating the distance value of the reference number from the water surface based on the initial position and the water level value corresponding to the reference number; obtaining the initialized water level value based on the water level value corresponding to the reference number, the distance value of the reference number from the water surface, the image pixel value corresponding to the complete E character closest to the water surface, and the scale value corresponding to the complete E character; if there is no E character, solving the pixel difference between the two numbers closest to the water surface; obtaining the initialized water level value based on the pixel difference, the basic scale value, the water level value corresponding to the reference number, and the distance value of the reference number from the water surface.
[0103] In the water level gauge image, the characters are usually arranged from bottom to top in the direction of rising water level. To ensure the accuracy of subsequent calculations, it is first necessary to sort the positions of all the recognized characters, that is, arrange them in the order from bottom to top, which helps to determine the correct order of the numbers on the water level gauge and their corresponding water level heights. After sorting, the algorithm calculates the image pixel intervals between adjacent numbers, and these intervals correspond to the scale lengths on the water level gauge. By analyzing the average interval between the numbers, the basic scale unit of the water level gauge, that is, the basic scale value, can be inferred, which is crucial for the subsequent calculation of water level changes.
[0104] The appearance of the E character usually represents special graduations on the water gauge, such as 1E3 (1000) meters. By detecting the E character, the algorithm can identify the large-value graduations that may exist in the water gauge, which is particularly important for supporting the reading recognition of various types of water gauges. Once the E character is detected, its corresponding numerical graduation is further determined. For example, E usually represents a multiple of 1000 meters. At the same time, the pixel value of the nearest complete E character to the water surface in the image is calculated using the text detection box, providing an important reference for subsequent water level calculation. Among all the recognized numbers, the number closest to the water surface contact point is selected as the reference number. The water level value of the reference number is directly obtained based on its corresponding height graduation on the water gauge, providing a reference point for subsequent calculations. Using the initial position of the water gauge-water surface contact point, the actual distance of the reference number from the water surface is calculated. This step requires combining the tilt angle of the water gauge and camera parameters, and through 3D projection or geometric calculations, mapping the two-dimensional image coordinates to the actual distance in three-dimensional space.
[0105] When there is an E character on the water gauge, the calculation of the initial water level value is more complex and requires combining the scale value corresponding to the E character, the image pixel value, as well as the water level value and the distance value from the water surface of the reference number. The specific calculation method may involve proportional calculation and application of mathematical formulas to determine the actual water level of the water gauge during initialization, while considering the numerical amplification effect brought by the E character.
[0106] If there is no E character on the water gauge, the calculation of the initial water level value is relatively straightforward. At this time, the pixel difference between the two numbers closest to the water surface and the basic scale value will be used for calculation. Through the proportional relationship, combined with the water level value of the reference number and its distance from the water surface, the actual water level value of the current water gauge, that is, the initial water level value, can be deduced.
[0107] Through the above detailed steps, the present invention can accurately identify the initial water level value for different types of water gauges, including those with E characters. Even in complex backgrounds or low-light conditions, by combining the position information and content information of the characters, the algorithm can still stably initialize the water level value, ensuring the accuracy of subsequent monitoring.
[0108] Whether it is a standard water gauge or a water gauge containing special characters (such as E), the present invention can be initialized by the same method, greatly enhancing the generality and adaptability of the algorithm and reducing the need for manual parameter adjustment for different water gauges.
[0109] Under nighttime or adverse weather conditions, the characters may become blurred, but by calculating the reference information of the nearest complete number or E character to the water surface, the algorithm can still accurately locate and identify the key information on the water gauge, reducing the risk of misrecognition due to insufficient lighting or degraded image quality.
[0110] The following is a detailed description in combination with another optional specific implementation manner.
[0111] Figure 3 It is the overall flowchart of an optional method for identifying a general water level gauge based on 3D projection in a monitoring scenario according to an embodiment of the present invention. As Figure 3 shown, in the initialization stage, the internal and external parameters of the camera are calculated by rotating the PTZ camera and feature matching (such as Figure 3 the SIFT feature point matching of the schematic picture SI FT). After calculating the camera parameters, the PTZ camera is fixed to a preset position, and target detection is performed on the collected images. The detection algorithm will detect the initialization position of the water level gauge, and then the precise image coordinates of the contact point between the water level gauge and the water surface are given through image processing technology. The world coordinates of the contact point between the water level gauge and the water surface can be calculated through 3D projection; in order to obtain the current water level value, the water level gauge is cropped from the original image through the detection frame, and the position and content of the key numbers (E and numbers) in the water level gauge are obtained through the OCR detection and recognition algorithm (such as Figure 3 the detection of shutdown numbers and the recognition of key numbers on the obtained water level gauge picture are shown). Finally, based on this position and content information, the initialization value of the water level is calculated. After the algorithm initialization is completed, for the subsequent collected images, the image coordinates of the current contact point between the water level gauge and the water surface are obtained through the initialized detection frame and image processing technology, and then the world coordinates of the current contact point are calculated through 3D projection. Finally, the current water level value is calculated through the initialized world coordinates, the initialized water level value, and the current world coordinates. The core steps of the embodiment of the present invention include camera parameter estimation, target detection, calculation of the contact point between the water level gauge and the water surface, 3D projection, detection and recognition of key numbers on the water level gauge, calculation of the initialized water level value, and calculation of the current water level value. The following will describe the present invention in detail in combination with these steps respectively.
[0112] The first step is camera parameter estimation. Figure 4 It is an optional flowchart for camera parameter estimation according to an embodiment of the present invention. As Figure 4 shown, for a freely selectable PTZ camera, it should be ensured that the PTZ camera is rotated left and right at a small angle with Z (zoom) unchanged, and a specified number (for example, 5, 10) of overlapping pictures are obtained. First, extract SIFT features from the pictures, and then use BFMatcher to match these feature points. After the feature matching is successful, use the cv.detail.HomographyBasedEstimator function provided by opencv to estimate the internal and external parameters of the camera at the initial position.
[0113] The second step is target detection. Figure 5It is a schematic diagram of an optional water level gauge target detection according to an embodiment of the present invention. By taking pictures of the bridge piers involving the water level gauge, the position of the water level gauge is detected. In the initialization stage, in order to obtain the position of the water level gauge, it is necessary to train an object detection model to detect the water level gauge in the large image. The present invention can detect the water level gauge in the picture based on YOLOv8s, and use about 1500 pictures to train the model. The size of the input picture during training is 1280*1280. Figure 5 Schematic diagram of the effect of water level gauge target detection.
[0114] The third step is to calculate the contact point between the water level gauge and the water surface. Figure 6 It is a schematic diagram of the position calculation of the contact point between the water level gauge and the water surface according to an embodiment of the present invention. As Figure 6 shown, since the object detection box cannot accurately give the coordinates of the contact point between the water level gauge and the water surface, after obtaining the detection box, first expand the box to the left, right, and below of the detection box (expand 0.1*W to the left and right, and expand 0.1*H below, where W and H are the width and height of the water gauge detection box), and then obtain the mask area of the water gauge above the water surface through threshold transformation, opening and closing operations, and maximum contour query. Then, the point coordinates in the lowermost area of the mask are the coordinates of the contact point between the water level gauge and the water surface (if the lowermost is a line, take the midpoint of the line). Finally, through coordinate transformation, the local image coordinates are transformed into the full-image coordinates.
[0115] The fourth step is 3D projection. To calculate the position of a point in the image coordinate system in the world coordinate system, first convert the image coordinates (u, v) to camera coordinates (X c , Y c , Z c ) through the camera internal parameters. The calculation formula is as follows.
[0116]
[0117] where K is the internal parameter matrix, in the form of:
[0118]
[0119] f x and f y are the focal lengths in the x and y directions respectively, c x and c y are the coordinates of the image center point. For a 1920*1080 picture, the values are 960 and 540, and Z c is defaulted to 1. After obtaining the camera coordinates, use the external parameter matrix R and the translation vector T to convert the points in the camera coordinates to the points in the world coordinate system (X w , Y w , Z w ). The conversion formula is as follows.
[0120]
[0121] Step 5: Detection and recognition of key numbers on the water level gauge. Figure 7 It is a schematic diagram of an optional key character recognition of the water level gauge according to an embodiment of the present invention. As Figure 7 shown, in the initialization stage, the reading of the water level gauge needs to be recognized. The present invention first detects the positions of key characters in the water level gauge through a text detection model (DBnet, Real-time Scene Text Detection with Differentiable Binarization). About 3,000 pictures of general text lines and water gauge annotation data are used for DBnet training, and the input picture size is 512. Then, the content of the key characters is recognized through a recognition model (CRNN). CRNN supports numbers, E, decimal points, and units (such as meters / centimeters / millimeters / m / cm / mm, etc.). The input picture size of the recognition model can be 32*100.
[0122] Step 6: Calculation of the initialized water level value. Figure 8 It is a flowchart of an optional calculation of the initialized water level value according to an embodiment of the present invention. As Figure 8 shown, after obtaining the positions and contents of the key numbers on the water level gauge, the key to water level calculation lies in the proportional relationship between the pixel value and the scale value. Due to the angular distortion of the water gauge, the closer the key characters referred to in the water level calculation are to the water surface, the smaller the error. The present invention selects the closest complete E and complete numbers to the water surface as references. After sorting all characters from bottom to top by position, the difference between the numbers is the basic scale value N h , if the character contains the E character, first find the scale value E corresponding to one E h , by equaling N h or 0.5N h , and at the same time, the image pixel value E corresponding to E can be calculated through the text detection box of E pixel , it is known that the water level corresponding to the reference number is H base , the pixel distance from the reference number to the water surface is d, then the current water level value H water can be calculated by the following formula,
[0123]
[0124] If the character does not contain the E character, first solve the pixel difference between the two closest numbers to the water surface and record it as N dif_pixel , then the current water level value H water can be calculated by the following formula,
[0125]
[0126] Step 7: Calculate the current water level value. In the initialization stage of the implementation of the present invention, key information such as camera parameters, the target frame of the water level gauge, the initialized water level gauge, the world coordinates of the water surface contact point, and the initialized water level value are obtained. During the subsequent algorithm operation, first, based on the target frame of the water level target gauge, the image positions of the current water level gauge and the water surface contact point are obtained, and then the world coordinates of the current water level gauge and the water surface contact point are calculated. By taking the difference between them and the initialized world coordinates, the change value of the current water level compared to the initialization can be calculated. Subtracting the change value from the initialized water level value gives the current water level value.
[0127] Through the above implementation method, problems such as misrecognition of water level gauge readings in environments such as at night, in rainy and foggy days, and under low light can be avoided. In addition, except for the initialization stage, it does not rely on deep learning models at other times, which can effectively avoid problems such as missed detection and false detection in object detection and text detection, and misrecognition in text recognition.
[0128] Furthermore, the embodiment of the present invention has low resource consumption, fast running speed, does not require GPU resources, has strong generalization ability, does not require manual intervention, and the algorithm can support more than 20 common types of water level gauges and can adapt to various scenarios.
[0129] The following will be described in detail in combination with another embodiment.
[0130] Embodiment 2
[0131] A water level gauge recognition device based on 3D projection provided in this embodiment includes multiple implementation units. Each implementation unit corresponds to each implementation step in Embodiment 1 above. Its specific implementation method and beneficial effects can be referred to the foregoing method embodiment and will not be elaborated here.
[0132] Figure 9 It is a schematic diagram of an optional water level gauge recognition device based on 3D projection according to an embodiment of the present invention. As Figure 9 shown, the water level gauge recognition device based on 3D projection may include: an image recognition unit 91, a coordinate calculation unit 92, and a water level calculation unit 93.
[0133] Among them, the image recognition unit 91 is used to obtain the current image of the water level gauge and recognize the current image based on the initialized detection frame to obtain the image coordinates of the water level gauge and the current water surface contact point.
[0134] The coordinate calculation unit 92 is used to calculate the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of the preset camera.
[0135] The water level calculation unit 93 is used to calculate the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value.
[0136] The above water level gauge recognition device based on 3D projection can obtain the current image of the water level gauge captured by the image recognition unit 91, recognize the current image based on the initialized detection frame, obtain the image coordinates of the contact point between the water level gauge and the current water surface, calculate the world coordinates of the current water surface contact point through the coordinate calculation unit 92 based on the internal and external parameters of the preset camera by means of the 3D projection strategy, and calculate the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value. In this embodiment, key information extraction in the initialization stage (including the initialized position of the water gauge and character information) can be performed, and the accurate calculation of the water level value can be realized through 3D projection technology, so as to ensure high-precision water level reading recognition under various lighting and weather conditions while reducing the demand for computing resources, improve the reading accuracy of the water level gauge, and thus solve the technical problem of poor recognition accuracy in the water level gauge reading recognition method in the related art.
[0137] Optionally, the image recognition unit includes: an expanding frame module for expanding the left and right sides and the lower side of the detection frame; a mask acquisition module for performing threshold transformation processing, opening and closing operation processing, and maximum contour query on the expanded detection frame respectively to obtain the mask area of the water level gauge above the water surface; a first coordinate acquisition module for obtaining the coordinates of the points in the lowest area of the mask in the mask area and determining the coordinates as the local image coordinates of the contact point between the water level gauge and the current water surface; and a coordinate transformation module for transforming the local image coordinates to the full-image coordinates through a coordinate transformation strategy to obtain the image coordinates of the contact point between the water level gauge and the current water surface.
[0138] Optionally, when the water level gauge recognition device based on 3D projection obtains the initialized world coordinates of the water level gauge and the initialized water level value, it includes: a target detection unit for collecting multiple frames of images of the water level gauge through a preset camera and performing target detection on each frame of image to identify the area where the water level gauge is located in the image; an image adjudication unit for cropping the area where the water level gauge is located in the image and obtaining the position and character information of the specified characters in the area where the water level gauge is located through an image recognition algorithm; a water level value initialization unit for obtaining the initialized water level value based on the position and character information of the specified characters in the water level gauge; a feature point matching unit for performing feature point matching on each frame of image to obtain the internal and external parameters of the preset camera and obtaining the initial image coordinates of the contact point between the water level gauge and the water surface; and an initialized world coordinate unit for determining the initialized world coordinates of the water level gauge based on the internal and external parameters of the preset camera and the initial image coordinates of the contact point between the water level gauge and the water surface.
[0139] Optionally, the image adjudication unit includes: a character detection module for detecting the character positions of specified characters in the area where the water level gauge belongs through a text detection model, where the text detection model; a text recognition module for performing text recognition on the characters displayed at the character positions using a text recognition model to obtain character information.
[0140] Optionally, the water level value initialization unit includes: a character sorting module for sorting all characters from bottom to top by position, calculating the interval difference between the numbers, and taking the interval difference as the basic scale value; an E character judgment module for judging whether there is an E character among all characters; a first initialized water level value determination module for, if there is an E character, obtaining the scale value corresponding to a complete E character, and calculating the image pixel value corresponding to the complete E character closest to the water surface through the text detection frame; selecting the complete number closest to the water surface from the character sorting result as the reference number, and extracting the water level value corresponding to the reference number; obtaining the initial position of the contact point between the water level gauge and the water surface, and calculating the distance value of the reference number from the water surface based on the initial position and the water level value corresponding to the reference number; obtaining the initialized water level value based on the water level value corresponding to the reference number, the distance value of the reference number from the water surface, the image pixel value corresponding to the complete E character closest to the water surface, and the scale value corresponding to the complete E character; a second initialized water level value determination module for, if there is no E character, solving the pixel difference between the two numbers closest to the water surface; obtaining the initialized water level value based on the pixel difference, the basic scale value, the water level value corresponding to the reference number, and the distance value of the reference number from the water surface.
[0141] Optionally, the water level calculation unit includes: a coordinate difference calculation module for calculating the coordinate difference between the world coordinates of the current water surface contact point and the world coordinates of the initialized water level gauge; a water level change calculation module for calculating the change value of the current water level value compared to when the water level gauge was initialized based on the coordinate difference; a current water level calculation module for calculating the difference between the change value of the current water level value compared to the initialization and the initialized water level value to obtain the current water level value.
[0142] Optionally, the coordinate calculation unit includes: a camera coordinate conversion module for converting the image coordinates of the water level gauge and the current water surface contact point into camera coordinates through the internal parameter matrix of a preset camera; a world coordinate conversion module for converting the points in the camera coordinates into points in the world coordinate system through the external parameter matrix of the preset camera and a preset translation vector to obtain the world coordinates of the current water surface contact point.
[0143] The above water level gauge recognition device based on 3D projection may further include a processor and a memory. The above image recognition unit 91, coordinate calculation unit 92, water level calculation unit 93, etc. are all stored in the memory as program units, and the corresponding functions are implemented by the processor executing the above program units stored in the memory.
[0144] The above-mentioned processor includes a kernel, which retrieves corresponding program units from the memory. One or more kernels can be set, and by adjusting the kernel parameters, the water level value calibrated on the water level gauge can be recognized based on 3D projection in a monitoring scenario.
[0145] The above-mentioned memory may include non-permanent memory in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM (flash RAM), and the memory includes at least one memory chip.
[0146] Embodiment III
[0147] An embodiment of the present application can provide an electronic device. Figure 10 It is a structural block diagram of an electronic device according to an embodiment of the present application. As Figure 10 shown, the electronic device may include: one or more ( Figure 10 only one is shown in the figure) processors 1002, a memory 1004, a storage controller, and a peripheral interface, where the peripheral interface is connected to a radio frequency module, an audio module, and a display.
[0148] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the water level gauge recognition method and device based on 3D projection in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, to implement the above-mentioned water level gauge recognition method based on 3D projection. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory may further include a memory remotely set relative to the processor, and these remote memories can be connected to the terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise internal network, a local area network, a mobile communication network, and combinations thereof.
[0149] The processor can call the information and application programs stored in the memory through a transmission device to perform the following steps: obtaining a current image of the water level gauge, recognizing the current image based on an initialized detection frame to obtain the image coordinates of the contact point between the water level gauge and the current water surface; calculating the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of a preset camera; calculating the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value.
[0150] Those of ordinary skill in the art can understand. Figure 10The structure shown is only schematic, and the electronic device can also be a terminal device such as a smart phone, a tablet computer, a personal digital assistant, and mobile Internet devices (MIDs), PADs, etc. Figure 10 It does not limit the structure of the above-mentioned electronic device. For example, the electronic device may further include more or fewer components (such as a network interface, a display device, etc.) than those shown Figure 10 in the figure, or have a different configuration from that shown Figure 10 in the figure.
[0151] Those of ordinary skill in the art can understand that all or part of the steps in the above-mentioned various 3D projection-based water level gauge recognition methods of the embodiments can be completed by instructing the relevant hardware of the terminal device through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disc, etc.
[0152] Embodiment 4
[0153] An embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the above storage medium can be used to store the program code executed by the 3D projection-based water level gauge recognition method provided in Embodiment 1 above.
[0154] On the other hand, according to an embodiment of the present invention, there is also provided a computer-readable storage medium. The computer-readable storage medium includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute any one of the 3D projection-based water level gauge recognition methods in Embodiment 1 above.
[0155] Optionally, in this embodiment, the above storage medium can be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.
[0156] The present application also provides a computer program product, including a computer program, where when the computer program is executed by a processor, it implements the steps of the 3D projection-based water level gauge recognition method described in various embodiments of the present application.
[0157] The present application also provides a computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps of the 3D projection-based water level gauge recognition method described in various embodiments of the present application.
[0158] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.
[0159] In the above embodiments of the present invention, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0160] In the several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the units or modules can be in an electrical or other form.
[0161] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0163] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks or optical discs and other various media that can store program codes.
[0164] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A water level gauge recognition method based on 3D projection, characterized in that, Including: Obtain a current image captured of the water level gauge, identify the current image based on the initialized detection frame, and obtain the image coordinates of the contact point between the water level gauge and the current water surface; Based on the internal and external parameters of the preset camera, calculate the world coordinates of the current water surface contact point through a 3D projection strategy; Based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value, calculate the current water level value calibrated by the water level gauge.
2. The recognition method according to claim 1, wherein The step of obtaining a current image captured of the water level gauge and identifying the current image based on the initialized detection frame to obtain the image coordinates of the contact point between the water level gauge and the current water surface includes: Perform frame expansion processing on the left and right sides and the lower side of the detection frame; Perform threshold transformation processing, opening and closing operation processing, and maximum contour query on the expanded detection frame respectively to obtain the mask area of the water level gauge above the water surface; Obtain the coordinates of the points in the lowermost area of the mask in the mask area, and determine this coordinate as the local image coordinates of the contact point between the water level gauge and the current water surface; Transform the local image coordinates to the full-image coordinates through a coordinate transformation strategy to obtain the image coordinates of the contact point between the water level gauge and the current water surface.
3. The recognition method according to claim 1, wherein The initialized world coordinates of the water level gauge and the initialized water level value are obtained through the following methods: Collect multiple frames of images of the water level gauge through the preset camera, and perform target detection on each frame of the image to identify the area where the water level gauge is located in the image; Crop the area where the water level gauge is located in the image, and obtain the position and character information of the specified character in the area where the water level gauge is located through an image recognition algorithm; Based on the position and character information of the specified character in the water level gauge, obtain the initialized water level value; Perform feature point matching on each frame of the image, obtain the internal and external parameters of the preset camera, and obtain the initial image coordinates of the contact point between the water level gauge and the water surface; Based on the internal and external parameters of the preset camera and the initial image coordinates of the contact point between the water level gauge and the water surface, determine the initialized world coordinates of the water level gauge.
4. The recognition method according to claim 3, characterized in that The step of obtaining the position and character information of the specified character in the area where the water level gauge is located through an image recognition algorithm includes: Detect the character position of the specified character in the area where the water level gauge is located through a text detection model, where the text detection model; Use a text recognition model to perform text recognition on the character displayed at the character position to obtain the character information.
5. The recognition method according to claim 3, characterized in that The step of obtaining the initialized water level value based on the position and character information of the specified character in the water level gauge includes: Sort all characters from bottom to top by position, calculate the interval difference between the numbers, and use the interval difference as the basic scale value; Judge whether the character 'E' is contained in all characters; If there is an 'E' character, obtain the scale value corresponding to a complete 'E' character, and calculate the image pixel value corresponding to the complete 'E' character closest to the water surface through the text detection box; select the complete number closest to the water surface from the character sorting result as the reference number, and extract the water level value corresponding to the reference number; obtain the initial position of the contact point between the water level gauge and the water surface, and calculate the distance value of the reference number from the water surface based on the initial position and the water level value corresponding to the reference number; based on the water level value corresponding to the reference number, the distance value of the reference number from the water surface, the image pixel value corresponding to the complete 'E' character closest to the water surface, and the scale value corresponding to the complete 'E' character, obtain the initialized water level value; If there is no 'E' character, solve the pixel difference between the two numbers closest to the water surface; based on the pixel difference, the basic scale value, the water level value corresponding to the reference number, and the distance value of the reference number from the water surface, obtain the initialized water level value.
6. The recognition method according to claim 1, wherein The steps of calculating the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value include: Calculate the coordinate difference between the world coordinates of the current water surface contact point and the initialized world coordinates of the water level gauge; Based on the coordinate difference, calculate the change value of the current water level value compared to when the water level gauge was initialized; Calculate the difference between the change value of the current water level value compared to the initialization and the initialized water level value to obtain the current water level value.
7. The recognition method according to claim 1, characterized in that The steps of calculating the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of a preset camera include: Convert the image coordinates of the water level gauge and the current water surface contact point into camera coordinates through the internal parameter matrix of the preset camera; Convert the point in the camera coordinates into a point in the world coordinate system through the external parameter matrix of the preset camera and the preset translation vector to obtain the world coordinates of the current water surface contact point.
8. A water level gauge recognition device based on 3D projection, characterized in that, Include: An image recognition unit for obtaining the current image of the water level gauge, and performing recognition on the current image based on the initialized detection box to obtain the image coordinates of the water level gauge and the current water surface contact point; A coordinate calculation unit for calculating the world coordinates of the current water surface contact point through a 3D projection strategy based on the internal and external parameters of a preset camera; A water level calculation unit for calculating the current water level value calibrated by the water level gauge based on the world coordinates of the current water surface contact point, the initialized world coordinates of the water level gauge, and the initialized water level value.
9. An electronic device, characterized in that, Includes one or more processors and a memory, and the memory is used to store one or more programs. Among them, when the one or more programs are executed by the one or more processors, the one or more processors implement the 3D projection-based water level gauge recognition method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, The steps of the computer program implementing the 3D projection-based water level gauge recognition method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Cited By
Water gauge reading double-path visual measurement method, system and device in industrial scene and storage medium
CN120913193A
A water level gauge reading dual-path visual measurement method, system, device and storage medium in an industrial scene
CN120913193B