A method, device, equipment and storage medium for extracting length of water river

By acquiring grayscale images of water surface patches, extracting key points, and mapping point pairs along the mid-channel line, the problem of accurately extracting the length of rivers with water under irregular water surface morphology is solved, improving efficiency and reducing human error.

CN120107800BActive Publication Date: 2025-12-12BEIJING WATER SCI & TECH INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510284871.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-12-12
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately extract the length of rivers with irregular water surface morphology, and traditional methods are inefficient and prone to human error.

Method used

By acquiring grayscale images of water surface patches, key point information is extracted, the farthest key point pair is determined, and the mapping point pair is truncated on the thalweg line to update the river segment attributes and ensure the spatial continuity of the river segment with water.

Benefits of technology

It enables precise extraction of the length of rivers with water in irregular water surface morphology, improves extraction efficiency, reduces human error, and ensures the accuracy and consistency of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107800B_ABST
    Figure CN120107800B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of hydrology and water resources management, and discloses a water river length extraction method, device, equipment and storage medium, the method comprising: obtaining the gray image of the water surface patch of the target river and extracting the key points of the gray image; extracting the farthest key point pair of each water surface patch in the key point information; determining the mapping point pair of the farthest key point pair on the thalweg of the target river; according to the mapping point pair, the thalweg of the target river is cut off to obtain several river sections of the target river; matching the starting point and the ending point of the river section with the mapping point pair, and updating the attributes of each river section according to the matching result; according to the updated attributes of the river section, the water river length of the target river is obtained. The present method can adapt to the complex morphology of the water surface patch, accurately describe the length of the water surface patch in the river direction, solve the limitations of the traditional method in processing irregular water surfaces, and improve the efficiency and reduce human errors.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of hydrology and water resources management, and particularly relates to a water river length extraction method, device, equipment and storage medium. BACKGROUND

[0002] The water river length is a key index for judging the connectivity of a water system and is also often used as a key index for evaluating the ecological water supplement benefit. However, due to the irregular shape of the water surface, poor spatial connectivity and the fact that most water surface patches do not intersect with the thalweg of the river, it is impossible to obtain accurate water river length data by directly using spatial intersection analysis or buffer analysis. In actual work, in order to ensure the effective development of related work, the water river length is generally completed by manually visually breaking the thalweg of the river, but this method is low in efficiency and the data quality is limited by the working state and concentration of the interpreter, and the missed breaking or mistaken breaking can be found through cross-checking.

[0003] Therefore, there is an urgent need for a water river length extraction method that can adapt to the complex shape of the water surface patch and solve the limitations of the traditional method in processing irregular water surfaces. SUMMARY

[0004] Therefore, the present application provides a water river length extraction method, device, equipment and storage medium, which solves the limitations of the traditional method in processing irregular water surfaces. The technical solution is as follows.

[0005] In a first aspect, the present application provides a water river length extraction method, which comprises the following steps.

[0006] Obtaining a gray image of a water surface patch of a target river;

[0007] Extracting key points from the gray image to obtain key point information;

[0008] Extracting a farthest key point pair from the key point information; the farthest key point pair is the two key points farthest apart in the thalweg direction of the target river;

[0009] Determining a mapping point pair of the farthest key point pair on the thalweg of the target river;

[0010] According to the mapping point pair, the thalweg of the target river is cut to obtain a plurality of river segments of the target river;

[0011] Matching the start point and the end point of the river segment with the mapping point pair, and updating the attribute of each river segment according to the matching result; the attribute of the river segment is used to indicate whether the river segment has water;

[0012] According to the attribute of the updated river segment, the water river length of the target river is obtained.

[0013] In an optional implementation, the method further includes:

[0014] obtaining a water surface patch of the target river;

[0015] performing rasterization processing on the water surface patch to obtain a raster image of the water surface patch;

[0016] performing binarization processing on the raster image of the water surface patch to obtain a grayscale image of the water surface patch.

[0017] In an optional implementation, the method further includes:

[0018] extracting skeleton line information from the grayscale image;

[0019] performing key point extraction on the skeleton line information to obtain key point information.

[0020] In an optional implementation, the method further includes:

[0021] calculating a foot point of the farthest key point pair to the thalweg of the target river to obtain a mapping point pair of the farthest key point pair on the thalweg of the target river.

[0022] In an optional implementation, the method further includes:

[0023] matching the start point and the end point of the river segment with the mapping point pair in a spatial position to obtain a matching result;

[0024] if the matching result does not exceed a matching threshold, determining that the attribute of the river segment is water;

[0025] if the matching result exceeds the matching threshold, determining that the attribute of the river segment is no water.

[0026] In an optional implementation, the method further includes:

[0027] obtaining a plurality of water river segments according to the updated attribute of the river segment;

[0028] obtaining lengths of the water river segments based on the start points and the end points of the water river segments;

[0029] determining a water length of the target river based on the lengths of the water river segments.

[0030] In an optional implementation, the method further includes:

[0031] According to the attribute of the updated river section, a plurality of dry river sections are obtained;

[0032] The attribute of the first dry river section is updated to be water; the first dry river section is a dry river section adjacent to two water river sections.

[0033] The water river length extraction method provided by the application can change the attribute of the dry river section to be water if the left and right end river sections of the dry river section satisfying the threshold condition are water river sections, so that the continuity of the water river section in the spatial position can be ensured.

[0034] The water river length extraction method provided by the application has the following advantages.

[0035] The application provides a water river length extraction method, which comprises two steps of water surface spot key point extraction and median line truncation and attribute updating. First, a water surface interpretation result of a target river is obtained, which can be obtained by remote sensing image data and corresponding image processing technology. The water surface interpretation result is usually a vector data, which contains polygons of different water surface regions, that is, water surface spots. The vector water surface spots are converted into raster data, and the resolution of the raster data should be consistent with the resolution of the remote sensing image used in the interpretation, so that the accuracy loss caused by the resolution mismatch in the extraction process can be avoided. Then, the raster image is binarized to obtain a gray image of the water surface spot, so that the clear water surface region and background can be extracted from the complex water surface interpretation image, and the noise interference in the subsequent processing can be reduced. Since the shape of the water surface spot can be very complex, the shape is simplified by skeletonization after binarization to extract the skeleton structure line of the gray image. The skeletonized image is a line structure containing only the main shape characteristics of the spot, which is convenient for subsequent key point extraction. On the basis of the skeleton line, the key point information is further extracted. After the key point information is extracted, the median line is truncated. For each water surface spot, the two key points farthest from the median line direction of the target river are analyzed to obtain the farthest key point pair, and the mapping point pair of the farthest key point pair on the median line of the target river is determined. The mapping point pair of the farthest key point pair can be determined by calculating the foot (that is, the shortest vertical distance) of the farthest key point pair to the median line of the target river. According to the mapping point pair, the median line of the target river is truncated to obtain several river segments, and the attributes of each river segment, that is, the water or non-water attributes, are updated according to the comparison between the two end points of the truncated river segment and the mapping point pair. In particular, if the adjacent two river segments of a river segment meeting a threshold length are both water segments, but the river segment itself is a non-water segment, the attribute of the river segment is updated to "water" to ensure the spatial continuity of the water river segment. The length of all water river segments is calculated to obtain the water river length of the target river. Through the water river length extraction method, the irregularity of the water surface spot and the spatial characteristics of the river are considered, the length of the water river segment can be accurately extracted, the spatial continuity between different river segments can be ensured, and the complex shape of the water surface spot can be effectively processed. The limitations of the traditional method in processing irregular water surfaces are solved, and the efficiency is improved and the human error is reduced.

[0036] In a second aspect, the application provides a water river length extraction device, which comprises:

[0037] The acquisition module is configured to acquire a gray image of a water surface spot of a target river.

[0038] The key point extraction module is configured to extract key points from the gray image to obtain key point information.

[0039] The farthest key point pair extraction module is configured to extract a farthest key point pair from the key point information, the farthest key point pair being two key points of the water surface patch farthest apart in a thalweg direction of the target river;

[0040] The mapping point pair determination module is configured to determine a mapping point pair of the farthest key point pair on the thalweg of the target river;

[0041] The truncation module is configured to truncate the thalweg of the target river according to the mapping point pair, to obtain a plurality of river segments of the target river;

[0042] The updating module is configured to match the start point and the end point of the river segment with the mapping point pair, and update attributes of the river segments according to a matching result; the attributes of the river segments are used to indicate whether the river segments have water;

[0043] The calculation module is configured to obtain a water-bearing length of the target river according to the attributes of the updated river segments.

[0044] In an optional implementation, the acquisition module is specifically configured to:

[0045] acquire a water surface patch of the target river;

[0046] perform rasterization processing on the water surface patch, to obtain a raster image of the water surface patch;

[0047] perform binaryzation processing on the raster image of the water surface patch, to obtain a grayscale image of the water surface patch.

[0048] In an optional implementation, the key point extraction module is specifically configured to:

[0049] extract skeleton line information from the grayscale image;

[0050] perform key point extraction on the skeleton line information, to obtain key point information.

[0051] In an optional implementation, the mapping point pair determination module is specifically configured to:

[0052] calculate a foot point of the farthest key point pair to the thalweg of the target river, to obtain a mapping point pair of the farthest key point pair on the thalweg of the target river.

[0053] In an optional implementation, the updating module is specifically configured to:

[0054] match the start point and the end point of the river segment with the mapping point pair in a spatial position, to obtain a matching result;

[0055] if the matching result does not exceed a matching threshold, determine that the attributes of the river segment are water-bearing;

[0056] If the matching result exceeds the matching threshold, it is determined that the attribute of the river section is no water.

[0057] In an optional implementation, the computing module is specifically configured to:

[0058] According to the updated attribute of the river section, a plurality of water river sections are obtained.

[0059] Based on the start point and the end point of each water river section, a length of each water river section is obtained.

[0060] Based on the length of each water river section, a water length of the target river is determined.

[0061] In an optional implementation, the updating module is further configured to:

[0062] According to the updated attribute of the river section, a plurality of no water river sections are obtained.

[0063] The attribute of a first no water river section is updated to water, and the first no water river section is a no water river section adjacent to two water river sections in the plurality of no water river sections.

[0064] In a third aspect, the present application provides a computer device, comprising a memory and a processor, the memory and the processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the water length extraction method of the first aspect or any of the corresponding embodiments thereof.

[0065] In a fourth aspect, the present application provides a computer readable storage medium, the computer readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the water length extraction method of the first aspect or any of the corresponding embodiments thereof.

[0066] In a fifth aspect, the present application provides a computer program product, comprising computer instructions, and the computer instructions are used to make the computer execute the water length extraction method of the first aspect or any of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS

[0067] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0068] Figure 1 is a method flow diagram of a water length extraction method according to an exemplary embodiment.

[0069] Figure 2 is a key point distribution structure diagram according to an exemplary embodiment.

[0070] Figure 3 is a water surface graph skeleton line key point calculation diagram according to an exemplary embodiment.

[0071] Figure 4 is a thalweg and water surface diagram in a simulation test river according to an exemplary embodiment.

[0072] Figure 5 is a water surface key point extraction diagram in a simulation test river according to an exemplary embodiment.

[0073] Figure 6 is a water surface key point mapping and river length extraction diagram in a simulation test river according to an exemplary embodiment.

[0074] Figure 7 is an actual test area range diagram according to an exemplary embodiment.

[0075] Figure 8 is a water river length extraction diagram in an actual test area according to an exemplary embodiment.

[0076] Figure 9 is a structure diagram of a water river length extraction device provided by an embodiment of the application.

[0077] Figure 10 is a structure diagram of a computer device provided by an optional embodiment of the application. DETAILED DESCRIPTION

[0078] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0079] It should be understood that the "indication" mentioned in the embodiments of the present application can be direct indication, indirect indication, or can be an indication that has a correlation relationship. For example, A indicates B, which can mean that B can be obtained by A; or A indirectly indicates B, for example, A indicates C, and B can be obtained by C; or A and B have a correlation relationship.

[0080] In the description of the embodiments of the present application, the term "corresponding" can represent a direct or indirect corresponding relationship between the two, can also represent an associated relationship between the two, and can also indicate a relationship such as being indicated, configured, and the like.

[0081] In the embodiments of the present application, "predefined" can be realized by pre-saving corresponding codes, tables or other means for indicating related information in devices (such as terminal devices and network devices), and the specific implementation manner is not limited in the present application.

[0082] First, the terms involved in the present application are introduced.

[0083] OpenCV: Open Source Computer Vision Library, is an open source computer vision and machine learning software library, which aims to provide efficient and simple tools to help developers perform computer vision, image processing, machine learning, video analysis, artificial intelligence and other related tasks.

[0084] THRESH_BINARY_INV: a threshold processing method in the OpenCV library, used to binarize the image and reverse the background and foreground after threshold processing.

[0085] ximgproc.thinning: is an image processing function in OpenCV, which is used for image skeletonization (Thinning), that is, to simplify the structure of objects in the image to a single-pixel-wide skeleton line.

[0086] Arcpy: is a Python library in the ArcGIS platform, which provides rich functions and tools for processing spatial data, performing geographic processing tasks and automating geographic information system (GIS) workflows.

[0087] The length of the water river is a key indicator for evaluating the connectivity of the water system, and is often used as a key indicator for evaluating the ecological water supplement benefit. However, due to the irregular shape of the water surface, poor spatial connectivity, and the fact that most water surface polygons do not intersect with the centerline of the river, direct use of spatial intersection analysis and buffer analysis cannot obtain accurate water river length data.

[0088] In actual work, in order to ensure the effective development of related work, the length of the water river is generally completed by manually visually breaking the centerline of the river. The manual breaking method is to manually identify and intervene to delineate the water part of the river. Although this method can be applied in some small areas, it also has obvious shortcomings.

[0089] Specifically, on the one hand, manual interruption needs to check the intersection and mapping relationship between the river centerline and the water surface piece by piece and point by point, especially in a large area, this process is very tedious and time-consuming. For a wide area, the speed of manual operation cannot meet the efficient work demand. When repeated checking, correction and cross verification are needed, the manual workload increases dramatically, and it cannot quickly adapt to the changes in data volume and workload. On the other hand, manual interruption is highly dependent on the energy and attention of the operator, and long-time work will cause fatigue, resulting in missed judgment, misjudgment or repeated interruption and other errors. These errors are usually difficult to be found in time, which may affect the overall accuracy of the data. Different operators may make different judgments when performing interruption according to personal experience, interpretation habits or standards, which may lead to differences in results and affect the consistency and accuracy of the data. The accuracy of interruption is highly dependent on the experience and judgment standard of the operator, and the lack of unified standards and specifications may lead to different results when different personnel interrupt in the same area, thereby affecting the data quality. In complex terrain, complicated water system or irregular water surface, manual interruption is especially prone to errors, and more time and effort are needed for correction. For the area with complex and interlaced water flow, the accuracy of manual identification is greatly reduced.

[0090] Therefore, in order to solve the limitations of the traditional method, the embodiment of the present application provides a water river length extraction method, which considers the irregularity of the water surface patch and the spatial characteristics of the river, can accurately extract the length of the water river section, and ensure the spatial continuity between different river sections, and can effectively process the complex morphology of the water surface patch. The limitations of the traditional method in processing irregular water surface are solved, and the efficiency is improved and the human error is reduced.

[0091] The method flow of the water river length extraction method provided by the embodiment is as shown in Figure 1 The method flow of the water river length extraction method provided by the embodiment is as shown in

[0092] S101, acquiring a gray image of a water surface patch of a target river.

[0093] Specifically, first, a water surface interpretation result is obtained, the water surface interpretation result includes a plurality of water surface patches, which are usually obtained by remote sensing image processing, and the patches represent the spatial area of a water area (such as a river, a lake, a reservoir, etc.), and are usually in the form of a vectorized polygon. The vector water surface patches are converted into raster data, and the raster resolution should be consistent with the resolution of the remote sensing image used in the interpretation, so that the accuracy loss caused by the resolution mismatch in the extraction process can be avoided. Subsequently, the raster image is binarized, that is, the water surface area is marked as 255 (white, representing water area pixels), and the background area is marked as 0 (black, representing non-water area pixels), so that a gray image of the water surface patch is obtained. The purpose of this is to simplify the image, convert the processing problem into a clear binary classification problem, extract the clear water surface area and background from the complex water surface interpretation result, and reduce the interference of noise in the subsequent processing.

[0094] S102, key point extraction is performed on the gray image to obtain key point information.

[0095] Specifically, the core of this step is to extract the skeleton line and key points of the water surface patch after binarization. The shape of the water surface patch can be very complex, so a skeletonization (or thinning) method is needed to simplify the shape, and finally the skeleton structure line of the patch is extracted. The skeletonized image is a line structure that only contains the main shape characteristics of the patch, and the key points can be extracted according to the skeletonized image.

[0096] S103, the farthest key point pair is extracted in the key point information.

[0097] Specifically, the shape of the water surface patch is usually irregular, so multiple shape key points are generated for each water surface patch. In order to accurately intercept the water section, the two farthest key points in the patch need to be determined, and the length of the two key points in the river direction is calculated. For each water surface patch, select the two farthest key point pairs in the thalweg direction (the main direction or flow direction of the river flow).

[0098] S104, the mapping point pair of the farthest key point pair on the thalweg of the target river is determined.

[0099] Specifically, by calculating the foot of the farthest key point pair to the thalweg of the target river, that is, the shortest vertical distance, the mapping point pair of the farthest key point pair can be obtained.

[0100] S105, the thalweg of the target river is truncated according to the mapping point pair, and a plurality of river sections of the target river are obtained.

[0101] Specifically, according to the obtained mapping point pair information, the thalweg of the target river is truncated, and the target river is divided into a plurality of river sections.

[0102] S106. Match the starting point and ending point of the river segment with the mapping point pair, and update the attributes of each river segment according to the matching results.

[0103] Specifically, the attributes of a river segment indicate whether or not water is present in that segment. By comparing the two ends of the truncated river segment with their corresponding mapping point pairs, the attributes of each river segment—whether it has water or not—are updated. Based on the updated attributes, it can be determined whether each river segment has water.

[0104] S107. Based on the updated attributes of the river segment, obtain the length of the target river with water.

[0105] Specifically, after determining whether each river segment has water, the length of each segment with water is calculated to obtain the length of the target river with water.

[0106] Optionally, in step S101, a rasterization tool (such as those provided in QGIS and ArcGIS) can be used to convert the water surface patch vector data into raster data. Then, the THRESH_BINARY_INV method in the OpenCV library is used to first convert the image into a grayscale image, and then set the pixel values ​​of the water surface area to 255 (white) and the pixel values ​​of the background area to 0 (black) to obtain a grayscale image of the water surface patch of the target river.

[0107] In step S102, the `ximgproc.thinning` method in OpenCV can be used to iteratively segment edge pixels, transforming the water surface patch into a thin, elongated line shape, thus converting the water surface patch into a thinned skeleton line. Subsequently, using morphological hit-and-miss transform (HMT), specific structuring elements are used on top of the skeleton line to check which pixels meet the criteria for keypoints. Only when some pixels of the structuring element conform to the specified pattern are they identified as keypoints. A schematic diagram of the structuring element is shown below. Figure 2 As shown, for example, a 3×3 window is used to ensure the connectivity of key points with their neighboring cells. At least one direction within the window must be connected to a water surface cell. Cells meeting this condition are detected using the HMT method to extract the key points of the water surface patch. Figure 2 Medium blue represents water surface pixels, white represents background pixels, italic shadows can be either water surface pixels or background pixels, and gray circles represent key points.

[0108] In the above steps, the hit-miss transformation operation method is to find all pixels in the skeleton line of the water surface patch that match the key point distribution structure element. The transformation operation calculation formula is shown in the figure below:

[0109]

[0110] In the formula, I is the image of key point calculation, and B is the structural element of key point extraction.

[0111] Operation diagram Figure 3 are shown, wherein the column a pattern represents the raster organization form of the water surface patch skeleton line, the column b 3*3 size grid is the structural element of key point extraction, and the column c pattern represents the key point extraction result of the water surface patch skeleton line. Blue in the column a and column c patterns represents the water surface patch skeleton line pixel, white represents the background pixel, green represents the monitored key point, and gray is the designed expansion pixel for ensuring the effectiveness of the structural element window sliding calculation.

[0112] Optionally, in the step S105, the thalweg in the target river can be cut off by using the tool in the Arcpy library.

[0113] In particular, in the step S106, if the adjacent two river sections of a river section satisfying the threshold length are both water river sections, but the river section itself is a non-water river section, the attribute of the river section is updated to "water", so as to ensure the spatial continuity of the water river section.

[0114] In order to better illustrate the water river length extraction method provided by the above embodiment, the embodiment of the present application is further described in combination with specific implementation cases. The following implementation cases include simulation test data and actual test data.

[0115] The schematic diagram of the thalweg and the water surface in the test river in the simulation test data is as shown in Figure 4 , taking two pieces of simulation data as an example, the blue curve is the thalweg of the river, and the yellow patch is the water surface patch. The key point extraction of the water surface is as shown in Figure 5 . First, the key points of the water surface patch are calculated through the operations such as vector to raster, binarization processing, skeleton line extraction, and the green and red points are the key points of the test 1 river and the test 2 river respectively. The key point mapping of the water surface and the river length extraction are as shown in Figure 6 . The mapping point pair of the farthest key point pair on the thalweg of the river is obtained, and finally the water river length is calculated.

[0116] In order to verify the effectiveness of the water river length extraction method of the above embodiment, the actual test data is used for verification below. A test area including both plain and mountainous terrain in a certain region is selected, and the test area range is as shown in Figure 7 . The area of the region is 744km 2 , including 21 rivers with a total length of 256.63km.

[0117] The schematic diagram of the water river length extraction of the actual test area is as shown in Figure 8 . Figure 8-a is the original input element of the water river length extraction method provided by the above embodiment, including water surface patch interpretation results and the thalweg of the river. The water surface and background pixels are separated by grid conversion and binary processing, represented by blue and white respectively, as shown in Figure 8 -b. On the basis of binary processing, the morphological processing method is adopted to extract the main morphological lines of the water surface patch interpretation results, as shown in Figure 8 -c. Then the key point distribution structure element and hit-miss change operation are used to obtain the morphological key points, as shown in Figure 8 -d. Thus the water surface patch key points are obtained.

[0118] Due to the complex morphology of the water surface patch, the key point extraction result often contains multiple points. In order to reduce the number of key points and improve the calculation efficiency of the subsequent process, it is necessary to compare the water surface patch key points point by point to obtain the farthest key point pair, as shown in Figure 8 -e. And calculate the mapping point pair of the point pair on the thalweg, as shown in Figure 8 -f. Finally, the mapping point pair position is used to truncate the thalweg of the river, and the coordinates of the obtained line segment and the mapping point pair are valued according to the coordinate relationship, as shown in Figure 8 -g.

[0119] By comparing the extraction results of the water river length of the test area by the above method with the extraction results by the artificial truncation method, it can be found that most of the errors can be controlled within 5%, and the overall error of the area is 1.17%.

[0120] In summary, the water river length extraction method provided by the embodiment of the present application includes two steps of water surface spot key point extraction and median line truncation and attribute updating. Firstly, the water surface interpretation result of the target river is obtained, which can be obtained through remote sensing image data and corresponding image processing technology. The water surface interpretation result is usually a vector data, which contains polygons of different water surface regions, i.e. water surface spots. The vector water surface spots are converted into raster data, and the resolution of rasterization should be consistent with the resolution of the remote sensing image used in interpretation, so that the accuracy loss caused by resolution mismatch in the extraction process can be avoided. Then, the raster image is binarized to obtain a gray image of the water surface spot, which can extract the clear water surface region and background from the complex water surface interpretation image, and reduce the interference of noise in the subsequent processing. Since the shape of the water surface spot can be very complex, after binarization, the skeletonization method is used to simplify the shape and extract the skeleton structure line of the gray image. The skeletonized image is a line structure containing only the main shape characteristics of the spot, which is convenient for subsequent key point extraction. On the basis of the skeleton line, the key point information is further extracted. After the key points are extracted, the median line truncation is performed. For each water surface spot, the two farthest key points in the direction of the median line of the target river are analyzed to obtain the farthest key point pair, and the mapping point pair of the farthest key point pair on the median line of the target river is determined. The mapping point pair of the farthest key point pair can be determined by calculating the foot of the perpendicular (i.e. the shortest perpendicular distance) from the farthest key point pair to the median line of the target river. According to the mapping point pair, the median line of the target river is truncated to obtain several river segments, and the attributes of each river segment, i.e. water or no water attributes, are updated according to the comparison between the two end points of the truncated river segment and the mapping point pair. In particular, if the adjacent two river segments of a river segment satisfying the threshold length are both water segments, but the river segment itself is a no water segment, the attribute of the river segment is updated to "water", so as to ensure the spatial continuity of the water river segment. The length of all water river segments is calculated to obtain the water river length of the target river. Through the water river length extraction method of the present application, the irregularity of the water surface spot and the spatial characteristics of the river are considered, the length of the water river segment can be accurately extracted, the spatial continuity between different river segments is ensured, and the complex shape of the water surface spot can be effectively processed. The limitations of the traditional method in processing irregular water surface are solved, and the efficiency is improved and the human error is reduced.

[0121] In the embodiments of the present application, a water river length extraction device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and contemplated.

[0122] An embodiment of the present application provides a water river length extraction device, Figure 9 is a structural schematic diagram of a water river length extraction device provided by an embodiment of the present application, and the device comprises:

[0123] An acquisition module 901 is configured to acquire a gray image of a water surface patch of a target river;

[0124] A key point extraction module 902 is configured to perform key point extraction on the gray image to obtain key point information;

[0125] A farthest key point pair extraction module 903 is configured to extract a farthest key point pair from the key point information; the farthest key point pair is two key points farthest apart in a thalweg direction of the target river in the water surface patch;

[0126] A mapping point pair determination module 904 is configured to determine a mapping point pair of the farthest key point pair on the thalweg of the target river;

[0127] A truncation module 905 is configured to truncate the thalweg of the target river according to the mapping point pair to obtain a plurality of river sections of the target river;

[0128] An updating module 906 is configured to match a start point and an end point of the river section with the mapping point pair, and update attributes of the river sections according to a matching result; the attributes of the river section are used to indicate whether the river section has water;

[0129] A calculation module 907 is configured to obtain a water river length of the target river according to the attributes of the updated river sections.

[0130] In an optional implementation, the acquisition module 901 is specifically configured to:

[0131] acquire a water surface patch of a target river;

[0132] perform rasterization processing on the water surface patch to obtain a raster image of the water surface patch;

[0133] perform binaryzation processing on the raster image of the water surface patch to obtain a gray image of the water surface patch.

[0134] In an optional implementation, the key point extraction module 902 is specifically configured to:

[0135] extract skeleton line information in the gray image;

[0136] perform key point extraction on the skeleton line information to obtain key point information.

[0137] In an optional implementation, the mapping point pair determination module 904 is specifically configured to:

[0138] The foot of the farthest key point pair to the thalweg in the target river is calculated to obtain a mapping point pair of the farthest key point pair on the thalweg in the target river.

[0139] In an optional implementation, the updating module 906 is specifically configured to:

[0140] The starting point and the ending point of the river section are matched with the mapping point pair in a spatial position to obtain a matching result;

[0141] If the matching result does not exceed a matching threshold, it is determined that the attribute of the river section is water;

[0142] If the matching result exceeds the matching threshold, it is determined that the attribute of the river section is no water.

[0143] In an optional implementation, the calculating module 907 is specifically configured to:

[0144] According to the attribute of the updated river section, a plurality of water river sections are obtained;

[0145] Based on the starting point and the ending point of each water river section, the length of each water river section is obtained;

[0146] Based on the length of each water river section, the water length of the target river is determined.

[0147] In an optional implementation, the updating module 906 is further configured to:

[0148] According to the attribute of the updated river section, a plurality of no water river sections are obtained;

[0149] The attribute of a first no water river section is updated to water; the first no water river section is a no water river section in which two adjacent river sections in the plurality of no water river sections are water river sections.

[0150] Further function descriptions of the above modules and units are the same as those of the corresponding embodiments, and will not be repeated here.

[0151] The water length extraction device in the embodiment is in the form of a functional unit. The unit herein refers to an ASIC (Application Specific Integrated Circuit, Application Specific Integrated Circuit) circuit, a processor and a memory executing one or more software or fixed programs, and / or other devices that can provide the above functions.

[0152] The embodiment of the application further provides a computer device with the above Figure 9 water length extraction device shown in the figure.

[0153] Please refer to Figure 10 , Figure 10This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 10 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information in a graphical user interface on an external input / output device (such as a display device coupled to the interface). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 10 Take a processor 10 as an example.

[0154] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0155] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0156] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0157] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0158] The computer device further comprises an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 can be connected through a bus or other means, Figure 10 The bus connection is taken as an example.

[0159] The embodiments of the present application further provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware or recorded in a storage medium, or be implemented as computer code stored in a remote storage medium or a non-transitory machine readable storage medium and stored in a local storage medium through network downloading, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor or programmable or special purpose hardware. The storage medium can be a magnetic disc, an optical disc, a read-only memory, a random access memory, a flash memory, a hard disc or a solid state disc, etc. Further, the storage medium can also include a combination of the above-mentioned memories. It can be understood that the computer, the processor, the microprocessor controller or the programmable hardware include a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor or the hardware, the method shown in the above embodiments is implemented.

[0160] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, the operation of the computer can call or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source file, executable file, installation package file, etc. Correspondingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer executes the corresponding compiled program after compiling the instructions, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0161] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A method for extracting a length of a watercourse, characterized in that, The method comprises: obtaining a gray image of a water surface patch of a target river; extracting key points from the gray image to obtain key point information; extracting a farthest key point pair of each water surface patch from the key point information; the farthest key point pair is two key points farthest apart in a thalweg direction of the water surface patch in the target river; determining a mapping point pair of the farthest key point pair on the thalweg of the target river; cutting the thalweg of the target river according to the mapping point pair to obtain a plurality of river segments of the target river; matching the start point and the end point of the river segment with the mapping point pair, and updating the attribute of each river segment according to the matching result; the attribute of the river segment is used to indicate whether the river segment has water; obtaining the water length of the target river according to the updated attribute of the river segment; wherein the key point extraction from the gray image to obtain the key point information comprises: extracting skeleton line information from the gray image; extracting key points from the skeleton line information to obtain key point information; the key point extraction from the skeleton line information to obtain the key point information comprises: determining the key point information according to a preset structure element on the basis of the skeleton line information through a morphological hit-miss transformation; the matching of the start point and the end point of the river segment with the mapping point pair and the updating of the attribute of each river segment according to the matching result comprises: matching the start point and the end point of the river segment with the mapping point pair in spatial position to obtain a matching result; if the matching result does not exceed a matching threshold, determining that the attribute of the river segment is water; if the matching result exceeds the matching threshold, determining that the attribute of the river segment is no water.

2. The method of claim 1, wherein, the obtaining of the gray image of the water surface patch of the target river comprises: obtaining a water surface patch of a target river; performing rasterization processing on the water surface patch to obtain a raster image of the water surface patch; performing binaryzation processing on the raster image of the water surface patch to obtain a gray image of the water surface patch.

3. The method of claim 1, wherein, the determination of the mapping point pair of the farthest key point pair on the thalweg of the target river comprises: calculating the foot of the farthest key point pair to the thalweg of the target river to obtain the mapping point pair of the farthest key point pair on the thalweg of the target river.

4. The method of claim 1, wherein, the obtaining of the water length of the target river according to the updated attribute of the river segment comprises: obtaining a plurality of water river segments according to the updated attribute of the river segment; obtaining the length of each water river segment based on the start point and the end point of each water river segment; determining the water length of the target river based on the length of each water river segment.

5. The method according to any one of claims 1 to 4, characterized in that, the method further comprises: obtaining a plurality of no-water river segments according to the updated attribute of the river segment; updating the attribute of a first no-water river segment to water; the first no-water river segment is a no-water river segment in which both adjacent river segments in the plurality of no-water river segments are water river segments.

6. A water course length extraction apparatus characterized by comprising: the device comprises: an obtaining module configured to obtain a gray image of a water surface patch of a target river; a key point extraction module configured to extract key points from the gray image to obtain key point information; The farthest key point pair extraction module is configured to extract a farthest key point pair of each water surface map patch from the key point information, the farthest key point pair being two key points of the water surface map patch that are farthest apart in a thalweg direction of the target river; The mapping point pair determination module is configured to determine a mapping point pair of the farthest key point pair on the thalweg of the target river; The truncation module is configured to truncate the thalweg of the target river according to the mapping point pair, to obtain a plurality of river segments of the target river; The updating module is configured to match the start point and the end point of the river segment with the mapping point pair, and to update the attribute of each river segment according to the matching result; the attribute of the river segment is used to indicate whether the river segment has water; The calculation module is configured to obtain the water-bearing river length of the target river according to the attribute of the updated river segment; The key point extraction module is specifically configured to: extract skeleton line information from the grayscale image; extract key points from the skeleton line information to obtain key point information; The key point extraction module is further configured to: determine the key point information from the skeleton line information according to a preset structure element through a morphological hit-miss transform; The updating module is specifically configured to: match the start point and the end point of the river segment with the mapping point pair in a spatial position to obtain a matching result; if the matching result does not exceed a matching threshold, determine that the attribute of the river segment is water-bearing; if the matching result exceeds the matching threshold, determine that the attribute of the river segment is water-free.

7. A computer device, comprising: The system comprises: a memory and a processor, which are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the water-bearing river length extraction method of any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a computer to perform the water-bearing river length extraction method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Automatic meander extraction method

    CN108319902A

  • Vector surface river center line extraction method and system

    CN118941622A