CN116071692A - Morphological image processing-based water gauge water level identification method and system - Google Patents

Morphological image processing-based water gauge water level identification method and system Download PDF

Info

Publication number
CN116071692A
CN116071692A CN202211675624.4A CN202211675624A CN116071692A CN 116071692 A CN116071692 A CN 116071692A CN 202211675624 A CN202211675624 A CN 202211675624A CN 116071692 A CN116071692 A CN 116071692A
Authority
CN
China
Prior art keywords
water gauge
image
water
gauge
water level
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211675624.4A
Other languages
Chinese (zh)
Inventor
李传奇
高杰
任英杰
王倩雯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong University
Original Assignee
Shandong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong University filed Critical Shandong University
Priority to CN202211675624.4A priority Critical patent/CN116071692A/en
Publication of CN116071692A publication Critical patent/CN116071692A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/28Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/30Assessment of water resources

Abstract

The invention discloses a water gauge water level identification method and a system based on morphological image processing, wherein the method comprises the following steps: collecting an original image of the water gauge, and preprocessing the original image of the water gauge; inputting the preprocessed original image of the water gauge into a water gauge water level identification model, and outputting an identified water level value; in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape. According to the invention, a water gauge water level identification model is established, and a water gauge scale extraction algorithm based on a morphological geometric algorithm is used for replacing straight line extraction by scale rectangle extraction, so that the feature identification of scale length and pixel width is increased, the identification precision is improved, and the identification time is shortened.

Description

Morphological image processing-based water gauge water level identification method and system
Technical Field
The invention relates to the technical field of image recognition, in particular to a water gauge water level recognition method and system based on morphological image processing.
Background
The water gauge is observed and is the simplest direct mode of monitoring the water level, compares with other instrument observations, need not to have avoided temperature, atmospheric pressure etc. to the influence of measurement with other media such as pressure, photoelectricity etc.. The currently adopted water gauge water level measuring method mainly comprises a manual water level gauge reading method and a water level automatic acquisition method by using a sensor. The manual reading water level gauge method is large in workload, inconvenient in data recording, transmission and storage, low in intelligent degree, high in measurement difficulty in severe environments, large in manpower consumption and unavoidable in human error. The sensors for measuring the water level in the market at present have the common problems of short service life, inaccurate measurement, unstable performance and the like of products, the working modes of the sensors are complex, the measurement accuracy is easily influenced by environmental factors, and all-weather monitoring cannot be carried out. In addition, referring to the monitoring station point for monitoring and checking the water level by video, most of the monitoring stations only use the functions of real-time playing and playback, and real-time checking and recording still need to be performed manually, so that certain limitations exist.
With the continuous development of computer languages, numerous image processing algorithms are approaching to maturity, wherein edge detection operators such as Roberts operator, prewitt operator, sobel operator and Laplacian operator have unique processing modes for pictures under different background environments, and technologies such as gray scale processing and image segmentation are commonly applied to image processing. The existing image preprocessing technology can meet the requirement of water gauge video image processing to realize the recognition of the water gauge water level, however, the water level recognition algorithm means is single, the existing water gauge image recognition usually uses Hough transformation as a core algorithm, but the algorithm has high time complexity and space complexity, the recognition time is long, in addition, in the detection process, the algorithm only considers the direction of a line segment, the influence of the length of the line segment is ignored, the influence of redundant horizontal lines such as a water line is easy to cause the water level recognition to generate larger errors. Therefore, as an emerging field of the combined development of computer technology and water conservancy industry, the research on water gauge water level identification still needs to be further advanced.
Disclosure of Invention
In order to solve the defects of the prior art, the invention provides a water gauge water level identification method and a system based on morphological image processing, and in order to avoid the defect of linear length limitation of Hough transformation, a water gauge water level identification model is established, a water gauge scale extraction algorithm based on a morphological geometric algorithm is used for replacing linear extraction with scale rectangular extraction, so that feature identification of scale length and pixel width is increased, identification precision is improved, and identification time is shortened.
In a first aspect, the present disclosure provides a method for identifying a water gauge water level based on morphological image processing, including:
collecting an original image of the water gauge, and preprocessing the original image of the water gauge;
inputting the preprocessed original image of the water gauge into a water gauge water level identification model, and outputting an identified water level value;
in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape.
According to a further technical scheme, the preprocessing comprises graying, noise processing, averaging and Canny edge detection, and the preprocessing comprises the following steps:
carrying out graying treatment on the original image of the water gauge through weighted average to obtain a gray image of the water gauge;
noise processing is carried out on the gray level image of the water gauge through median filtering;
carrying out averaging treatment on the gray level image of the water gauge after the median filtering denoising treatment;
and carrying out edge detection on the water gauge gray level image subjected to the averaging treatment by adopting a Canny operator to obtain a water gauge image subjected to the edge detection.
According to a further technical scheme, the preprocessed water gauge original image is subjected to image segmentation through vertical edge detection to obtain a water gauge image with the background removed, and the method comprises the following steps:
carrying out vertical pixel summation on the preprocessed original image of the water gauge, and determining pixels and a threshold value;
the position where the pixel and the peak value appear for the first time above the pixel and the threshold value is the left edge of the water gauge, and the position where the pixel and the peak value appear for the last time is the right edge of the water gauge, so that the water gauge area in the image is cut, and a water gauge image with the background removed is obtained.
According to a further technical scheme, the identification of the scale number in the binarized water gauge image through the morphological algorithm comprises the following steps:
processing the binarized water gauge image with the background removed by a morphological algorithm to obtain a water gauge horizontal straight line graph;
and carrying out horizontal pixel summation processing on the acquired water gauge horizontal straight line graph to acquire the water gauge scale number above the horizontal plane.
According to a further technical scheme, a morphological algorithm is adopted to process the binarized image, and a horizontal straight line in the image is obtained, namely a water gauge horizontal straight line diagram is obtained;
performing pixel value non-operation on the acquired water gauge horizontal straight line image, and performing horizontal direction pixel summation;
setting a pixel and a threshold value, judging the horizontal pixel sum exceeding the pixel and the threshold value above a horizontal straight line corresponding to a horizontal plane as the position of a scale mark, counting the times of the horizontal pixel sum exceeding the pixel and the threshold value above a water line, and further determining the instantaneous degree of the number of the horizontal straight lines above the water line in the water gauge image.
According to a further technical scheme, the water level value is calculated according to the following formula:
h=L-K*n/l
wherein h is a water level value, L is the total length of the water gauge, K is the scale number above the water surface, L is the scale number corresponding to each scale mark, and n is the height of the water gauge corresponding to each scale mark.
In a second aspect, the present disclosure provides a water gauge water level identification system based on morphological image processing, comprising:
the image acquisition module is used for acquiring an original image of the water gauge;
the image preprocessing module is used for preprocessing the original image of the water gauge;
the water gauge water level identification module is used for inputting the preprocessed water gauge original image into the water gauge water level identification model and outputting an identified water level value;
in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape.
In a third aspect, the present disclosure also provides an electronic device comprising a memory and a processor, and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the steps of the method of the first aspect.
In a fourth aspect, the present disclosure also provides a computer readable storage medium storing computer instructions which, when executed by a processor, perform the steps of the method of the first aspect.
The one or more of the above technical solutions have the following beneficial effects:
1. the invention provides a water gauge water level identification method and a system based on morphological image processing, which are used for establishing a water gauge water level identification model, and the identification precision is further improved by replacing straight line extraction with scale rectangular extraction through a water gauge scale extraction algorithm based on a morphological geometric algorithm, so that the feature identification of scale length and pixel width is increased.
2. According to the water gauge water level identification method and system provided by the invention, analysis processing is carried out from the pixel level, the scale number above the water surface is determined according to the horizontal pixels and the peak value number, and the final water level value is obtained by calculating the scale number, so that the conventional Hough conversion straight line extraction algorithm is avoided, the identification time is further shortened, and the identification efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention.
FIG. 1 is a flow chart of a method for identifying water level of a water gauge based on morphological image processing according to an embodiment of the invention;
FIG. 2 is an original image of a pretreated water gauge according to the first embodiment of the present invention;
FIG. 3 is a pixel diagram of a vertical pixel summing of images in accordance with a first embodiment of the present invention;
FIG. 4 is a graph showing the scale level during the extraction process according to the first embodiment of the present invention;
FIG. 5 is a pixel diagram of the water gauge horizontal pixel sum obtained in the first embodiment of the present invention;
FIG. 6 shows the result of identifying the water level value of the water gauge output in the first embodiment of the present invention;
FIG. 7 is a graph showing the result of error analysis in the first embodiment of the present invention.
Detailed Description
It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the invention. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the present invention. As used herein, the singular is also intended to include the plural unless the context clearly indicates otherwise, and furthermore, it is to be understood that the terms "comprises" and/or "comprising" when used in this specification are taken to specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof.
Example 1
In order to solve the problems in the background art, the present embodiment provides a method for identifying a water gauge water level based on morphological image processing, after preprocessing an obtained original image of the water gauge, extracting straight line elements of the water gauge in the image by using an OpenCV module in a Python library, optimizing by using a morphological algorithm, determining a scale number above the water surface according to horizontal pixels and peak values from a pixel layer, and calculating according to the scale number to obtain a final water level value, as shown in fig. 1, the method in the embodiment specifically includes the following steps:
s1, acquiring an original image of a water gauge, and preprocessing the original image of the water gauge;
s2, inputting the preprocessed original image of the water gauge into a water gauge water level identification model, and outputting an identified water level value; in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape.
In order to restore the actual water gauge observation environment as much as possible, a water tank experiment is carried out in the embodiment, a water tank with the length of 9m and the width of 0.5m is built in a hydraulic experiment hall, a wide top weir is arranged at a position 75cm away from the upstream, a bottom weir is arranged at a position 50cm away from the downstream in order to ensure that the water level is high and the water flow is stable, and an aluminum alloy flat plate-shaped water gauge with the height of 50cm and the width of 8cm is arranged in the water tank. Further, in order to ensure that the water flow at the place where the water gauge is placed remains substantially stable, the water gauge is placed at 430cm upstream.
Firstly, shooting at a water gauge position through camera and other image pickup equipment to obtain an original image of the water gauge, and preprocessing the original image of the water gauge by using an Opencv module in Python, wherein the preprocessing comprises graying, noise processing, averaging and Canny edge detection, and specifically:
and S1.1, carrying out gray processing on the original image of the water gauge through weighted average. Specifically, the acquired original image of the water gauge is an RGB image, different weights of the R, G, B components are given according to the importance degrees of the RGB components, so that the original image of the water gauge is weighted and averaged to acquire a gray image of the water gauge, as shown in fig. 2 (a);
and S1.2, carrying out noise processing on the gray scale image of the water gauge through median filtering. Specifically, collecting data of N periods, namely, a water gauge gray scale image obtained through the processing in the previous step S1.1, removing the maximum value and the minimum value in the data of N periods, taking the average value of the rest data, and effectively filtering accidental pulse interference, wherein the obtained image is shown in fig. 2 (b);
and S1.3, carrying out averaging treatment on the gray scale image of the water gauge after the intermediate value filtering denoising treatment. Specifically, the gray level with more pixels in the gray level image of the water gauge is widened, the gray level with less pixels is compressed, the dynamic range of pixel values is further expanded, the contrast and the change of gray tone are improved, the image is clearer, and the obtained image is shown in fig. 2 (c);
and S1.4, performing edge detection on the water gauge gray level image subjected to the averaging treatment by adopting a Canny operator to obtain a water gauge image subjected to the edge detection. Specifically, before processing, a Gaussian smoothing filter is utilized to smooth a water gauge gray image so as to remove noise, and then the gradient amplitude and direction are calculated through the finite difference of first-order partial derivatives; then, carrying out edge detection processing on the image by using a Canny operator, wherein the Canny operator designs a non-maximum value inhibition process; finally, two threshold connecting edges are adopted to obtain the preprocessed original image of the water gauge, and the original image is specifically shown in fig. 2 (d).
After the pretreatment of the original image of the water gauge is completed, the pretreated original image of the water gauge is input into a water gauge water level identification model, and an identified water level value is output.
In the above water gauge water level identification model, first, step S2.1, image segmentation is performed on the preprocessed original water gauge image through vertical edge detection, so as to obtain a water gauge image with the background removed. In this embodiment, vertical pixel summation processing is performed on the preprocessed water gauge original image, and the image is cut according to the vertical pixel summation result, so as to obtain a water gauge image with the background removed, which specifically includes:
step S2.1.1, considering that the preprocessed original image of the water gauge contains a background image, and because obvious edges exist between the left side, the right side and the background of the water gauge in the image, the pixels in the vertical direction of the image are summed up, and the pixels and the threshold M are determined through trial calculation; specifically, the pixels of the background and the water gauge in the image are obviously different from the values, as shown in fig. 3, by trial and error, the pixels between the background pixels and the maximum value and the pixels of the water gauge and the minimum value and the threshold value M are determined to be 22000, the peak value which is larger than the pixels and the threshold value M can be considered as the water gauge part, and the peak value which is smaller than the pixels and the threshold value should be considered as the background part;
in step S2.1.2, the position where the pixel and the peak value appear for the first time above the threshold value M is the left edge of the water gauge, the position where the pixel and the peak value appear for the last time is the right edge of the water gauge, and the Numpy module in Python is used for cutting the water gauge area in the image to obtain the water gauge image with the background removed, as shown in fig. 4 (a).
Step S2.2, performing binarization processing on the water gauge image with the background removed, obtaining a binarized water gauge image, and determining the position of the water surface line, wherein the method specifically comprises the following steps:
global binarization processing is carried out on the water gauge image, an iteration method is adopted to determine that the global threshold value is 150, the pixel value of the area below the threshold value is set to 0, the area is displayed as black, the area below the water surface line and the scale mark are both black, the pixel value of the area above the threshold value is positioned 255, white is displayed, the area above the water surface line, namely the water gauge surface is white, and the pixel value is 255, as shown in fig. 4 (b).
As another implementation manner, a cv.adaptive threshold algorithm in Python is utilized to perform local adaptive binarization processing on a water gauge image with a background removed, when the distinction between a target image and the background is low, the brightness of part of the water gauge image is too high or overexposure is performed during shooting, so that the gray value of a scale is low, at this time, local binarization is adopted to perform refinement processing, and the processed image is shown in fig. 4 (c);
specifically, the global binarization has a good effect of distinguishing images with larger gray scale distinction between the background and the target image, and can reflect the global features of the gray scale image, but when the distinction between the target image and the background is lower, the local adaptive binarization processing detail features are selected to be used. In this embodiment, the brightness of part of the water gauge image is too high or overexposure is performed during shooting, so that the gray value of the scale is low, all scales of the water gauge are difficult to be identified completely by global binarization, and at this time, the refinement treatment is performed by local binarization. Since the gray level distribution of the acquired water gauge image, i.e., the image 4 (a), excluding the background is more obvious, the images obtained by the two methods of global binarization and local adaptive binarization are basically consistent, and global features are more reflected by considering global binarization, so that the global binarization image, i.e., fig. 4 (b), is used as an input image extracted by the subsequent scales for the water gauge image.
Step S2.3, identifying the scale number of the water gauge in the water gauge image through a morphological algorithm, specifically, firstly, processing a binary water gauge image with the background removed through the morphological algorithm to obtain a horizontal straight line of the water gauge image, namely, obtaining a water gauge horizontal straight line graph, then, carrying out horizontal pixel summation processing on the obtained water gauge horizontal straight line graph to obtain the scale number above the horizontal plane, wherein the step comprises the following specific steps:
and S2.3.1, processing the image processed in the previous step by adopting a cv.getstructureelement algorithm in Python to acquire a horizontal straight line in the image so as to remove the influence of numbers in the water gauge. The algorithm operates the binarized image, recognizes rectangles (including straight lines), cross shapes and ellipses in the image through image morphology processing, performs expansion and corrosion operations after straight line extraction by the algorithm, strengthens the characteristics of the extracted scale marks, and an extracted water gauge horizontal straight line graph is shown in fig. 4 (d);
then, in step S2.3.2, the horizontal direction pixel summation is performed on the water gauge horizontal line graph obtained in the previous step, specifically, the "not" operation is performed first, as shown in fig. 4 (e), and then the horizontal pixel summation is performed thereon. In this embodiment, the height of the water gauge image is taken as the abscissa and the horizontal pixel sum is taken as the ordinate, a pixel image is established, the pixel and the threshold value are selected, a straight line exceeding 1/3 of the image width in the horizontal direction in the pixel image is judged as a scale mark, the straight line exceeding the pixel and the threshold value is reflected in the pixel image, namely, the horizontal pixel sum exceeding the pixel and the threshold value on the horizontal straight line corresponding to the horizontal plane is judged as the position of the scale mark, the number of times of the horizontal pixel sum exceeding the pixel and the threshold value above the water surface line is counted, and then the number of the horizontal straight lines above the water surface line in the water gauge image is determined, namely, the immediate degree. In this embodiment, as shown in fig. 5, since the image width is 90 pixels and the width of the horizontal pixels is 255, the selected pixels and the threshold are 255×90×1/3=7650, i.e., the lines exceeding 1/3 of the image width in the horizontal direction are determined as the scale marks, the broken lines shown in fig. 5 are the threshold 7650, and the peak number is counted on the basis of the determined lines, and the number of horizontal lines of the image is 25.
Finally, based on the scale number above the water surface line and the shape of the water gauge, obtaining a water level value, wherein the water level value calculation formula is as follows: h=l-K n/L, where h is the water level value (cm), L is the total length of the water gauge (cm), in this embodiment, the total length of the water gauge is 50cm, and K is the number of scale marks above the water surface; i is the number of scales corresponding to each scale mark, in this embodiment, 3 is set, i.e., the scale mark is "≡", and n is the height (cm) of the water gauge corresponding to each scale mark.
The identified water level value is output through the scheme, and as shown in fig. 6, the output water gauge water level value is 9.666667, so that accurate water level identification based on a water gauge water level image is realized.
In this embodiment, error analysis is performed on the water gauge recognition result according to the above scheme, specifically, the water level value observed by naked eyes is taken as an accurate value, the water level recognition result obtained by the above model is detected, and absolute error and relative error are taken as precision evaluation indexes, where: the absolute error is the measured value minus the absolute value of the algorithm identification result, and the relative error is the absolute error divided by the measured value. As shown in FIG. 7, the absolute error of the scheme in this embodiment is 1.30cm at maximum, the relative error is lower than 11%, and the recognition effect is better and the recognition accuracy is better in the comprehensive view.
Example two
The embodiment provides a water gauge water level identification system based on morphological image processing, including:
the image acquisition module is used for acquiring an original image of the water gauge;
the image preprocessing module is used for preprocessing the original image of the water gauge;
the water gauge water level identification module is used for inputting the preprocessed water gauge original image into the water gauge water level identification model and outputting an identified water level value;
in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape.
Example III
The embodiment provides an electronic device comprising a memory and a processor, and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the steps in the water gauge water level identification method based on morphological image processing as described above.
Example IV
The present embodiment also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, perform the steps in a water gauge water level identification method based on morphological image processing as described above.
The steps involved in the second to fourth embodiments correspond to the first embodiment of the method, and the detailed description of the second embodiment refers to the relevant description of the first embodiment. The term "computer-readable storage medium" should be taken to include a single medium or multiple media including one or more sets of instructions; it should also be understood to include any medium capable of storing, encoding or carrying a set of instructions for execution by a processor and that cause the processor to perform any one of the methods of the present invention.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented by general-purpose computer means, alternatively they may be implemented by program code executable by computing means, whereby they may be stored in storage means for execution by computing means, or they may be made into individual integrated circuit modules separately, or a plurality of modules or steps in them may be made into a single integrated circuit module. The present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
While the foregoing description of the embodiments of the present invention has been presented in conjunction with the drawings, it should be understood that it is not intended to limit the scope of the invention, but rather, it is intended to cover all modifications or variations within the scope of the invention as defined by the claims of the present invention.

Claims (10)

1. A water gauge water level identification method based on morphological image processing is characterized by comprising the following steps:
collecting an original image of the water gauge, and preprocessing the original image of the water gauge;
inputting the preprocessed original image of the water gauge into a water gauge water level identification model, and outputting an identified water level value;
in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape.
2. The morphological image processing based water gauge water level identification method according to claim 1, wherein the preprocessing comprises graying, noise processing, averaging and Canny edge detection, the preprocessing comprising the steps of:
carrying out graying treatment on the original image of the water gauge through weighted average to obtain a gray image of the water gauge;
noise processing is carried out on the gray level image of the water gauge through median filtering;
carrying out averaging treatment on the gray level image of the water gauge after the median filtering denoising treatment;
and carrying out edge detection on the water gauge gray level image subjected to the averaging treatment by adopting a Canny operator to obtain a water gauge image subjected to the edge detection.
3. The morphological image processing-based water gauge water level identification method according to claim 1, wherein the preprocessing of the original water gauge image is performed by image segmentation through vertical edge detection to obtain a background-removed water gauge image, comprising:
carrying out vertical pixel summation on the preprocessed original image of the water gauge, and determining pixels and a threshold value;
the position where the pixel and the peak value appear for the first time above the pixel and the threshold value is the left edge of the water gauge, and the position where the pixel and the peak value appear for the last time is the right edge of the water gauge, so that the water gauge area in the image is cut, and a water gauge image with the background removed is obtained.
4. The method for identifying water level of a water gauge based on morphological image processing according to claim 1, wherein the identifying the scale number in the binarized water gauge image by a morphological algorithm comprises:
processing the binarized water gauge image with the background removed by a morphological algorithm to obtain a water gauge horizontal straight line graph;
and carrying out horizontal pixel summation processing on the acquired water gauge horizontal straight line graph to acquire the water gauge scale number above the horizontal plane.
5. The method for identifying water level of water gauge based on morphological image processing as defined in claim 4, wherein said processing the binary water gauge image with background removed by morphological algorithm to obtain a water gauge horizontal line graph comprises:
and processing the binarized image by adopting a morphological algorithm to obtain a horizontal straight line in the image, namely obtaining a water gauge horizontal straight line graph.
6. The method for identifying water level of water gauge based on morphological image processing according to claim 4, wherein the step of performing horizontal pixel summation processing on the obtained water gauge horizontal line graph to obtain the water gauge scale number above the water level comprises the steps of:
performing pixel value non-operation on the acquired water gauge horizontal straight line image, and performing horizontal direction pixel summation;
setting a pixel and a threshold value, judging the horizontal pixel sum exceeding the pixel and the threshold value above a horizontal straight line corresponding to a horizontal plane as the position of a scale mark, counting the times of the horizontal pixel sum exceeding the pixel and the threshold value above a water line, and further determining the instantaneous degree of the number of the horizontal straight lines above the water line in the water gauge image.
7. The morphological image processing-based water gauge water level identification method according to claim 1, wherein the water level value is calculated according to the formula:
h=L-K*n/l
wherein h is a water level value, L is the total length of the water gauge, K is the scale number above the water surface, L is the scale number corresponding to each scale mark, and n is the height of the water gauge corresponding to each scale mark.
8. A water gauge water level identification system based on morphological image processing is characterized by comprising:
the image acquisition module is used for acquiring an original image of the water gauge;
the image preprocessing module is used for preprocessing the original image of the water gauge;
the water gauge water level identification module is used for inputting the preprocessed water gauge original image into the water gauge water level identification model and outputting an identified water level value;
in the water gauge water level identification model, an original water gauge image after pretreatment is subjected to image segmentation through vertical edge detection to obtain a water gauge image with a background removed, binarization processing is carried out on the water gauge image to obtain a binarized water gauge image, a water surface line is determined, the scale number in the binarized water gauge image is identified through a morphological algorithm, and a water level value is obtained based on the scale number above the water surface line and the water gauge shape.
9. An electronic device comprising a memory and a processor and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the steps of a morphological image processing based water gauge water level identification method as claimed in any one of claims 1 to 7.
10. A computer readable storage medium storing computer instructions which, when executed by a processor, perform the steps of a morphological image processing based water gauge water level identification method as claimed in any one of claims 1 to 7.
CN202211675624.4A 2022-12-26 2022-12-26 Morphological image processing-based water gauge water level identification method and system Pending CN116071692A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211675624.4A CN116071692A (en) 2022-12-26 2022-12-26 Morphological image processing-based water gauge water level identification method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211675624.4A CN116071692A (en) 2022-12-26 2022-12-26 Morphological image processing-based water gauge water level identification method and system

Publications (1)

Publication Number Publication Date
CN116071692A true CN116071692A (en) 2023-05-05

Family

ID=86177888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211675624.4A Pending CN116071692A (en) 2022-12-26 2022-12-26 Morphological image processing-based water gauge water level identification method and system

Country Status (1)

Country Link
CN (1) CN116071692A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116883808A (en) * 2023-06-27 2023-10-13 浪潮智慧科技有限公司 Method, equipment and storage medium for improving water gauge water level identification response speed

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116883808A (en) * 2023-06-27 2023-10-13 浪潮智慧科技有限公司 Method, equipment and storage medium for improving water gauge water level identification response speed

Similar Documents

Publication Publication Date Title
CN108921176B (en) Pointer instrument positioning and identifying method based on machine vision
CN109507192B (en) Magnetic core surface defect detection method based on machine vision
CN107169953B (en) Bridge concrete surface crack detection method based on HOG characteristics
CN112651968B (en) Wood board deformation and pit detection method based on depth information
CN108088799B (en) Method and system for measuring Motor vehicle exhaust Rigemann blackness
CN109872303B (en) Surface defect visual detection method and device and electronic equipment
CN107490582B (en) Assembly line workpiece detection system
CN115018844B (en) Plastic film quality evaluation method based on artificial intelligence
CN105160652A (en) Handset casing testing apparatus and method based on computer vision
CN108876860B (en) Image calibration method for measuring bubble offset of tube level
CN116758077B (en) Online detection method and system for surface flatness of surfboard
CN111046862B (en) Character segmentation method, device and computer readable storage medium
CN109781737B (en) Detection method and detection system for surface defects of hose
CN111415339B (en) Image defect detection method for complex texture industrial product
CN117237368B (en) Bridge crack detection method and system
CN116883408B (en) Integrating instrument shell defect detection method based on artificial intelligence
CN114549441A (en) Sucker defect detection method based on image processing
CN115205223A (en) Visual detection method and device for transparent object, computer equipment and medium
CN116468687A (en) Scratch defect detection method and device, storage medium and electronic equipment
CN115272336A (en) Metal part defect accurate detection method based on gradient vector
CN116071692A (en) Morphological image processing-based water gauge water level identification method and system
CN110276759B (en) Mobile phone screen bad line defect diagnosis method based on machine vision
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN109948629B (en) GIS equipment X-ray image fault detection method based on SIFT features
CN113643290B (en) Straw counting method and device based on image processing and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination