Multi-flow-path river channel main channel center line identification method based on Euclidean distance conversion algorithm
The Euclidean distance transformation algorithm is used to automatically identify the centerline of the main channel of a multi-flow-path river, which solves the problems of large identification error and uncertainty in the existing technology and achieves high-precision, repeatable and consistent river centerline identification.
Patent Information
- Application Number
- CN202511023564.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-11-11
AI Technical Summary
Existing technologies struggle to automatically identify the centerline of the main channel in multi-flow channels, and existing methods are highly susceptible to subjective factors, resulting in errors and uncertainties that cannot guarantee spatial consistency and repeatability.
A method based on Euclidean distance transformation algorithm is adopted. By preprocessing remote sensing images, the Normalized Difference Water Index (MNDWI) is calculated. Water areas are identified using the threshold method, generating binary images of river water. A morphological algorithm is used to extract skeleton paths, construct an undirected graph and assign edge weights. The Dijkstra algorithm is used to identify the minimum cost path and generate the centerline of the main channel of a multi-flow-path river.
It achieves high-precision, automated identification of the main channel centerline, reduces human identification errors, ensures spatial consistency and repeatability of identification results, saves manpower and resources, and is simple and fast to operate.
Smart Images

Figure CN120932091A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of water conservancy engineering technology, and relates to a method for identifying the centerline of the main channel, and in particular to a method for identifying the centerline of the main channel of a multi-flow-path river based on the Euclidean distance transformation algorithm. Background Technology
[0002] In riverbed evolution studies, the main channel line, as the core pathline representing the strongest hydrodynamic forces, fastest flow velocity, and typically greatest water depth in the river channel, best reflects the longitudinal evolution of the river channel. However, obtaining the main channel line has significant limitations. Specifically, measurements are easily affected by environmental factors, require substantial human and material resources, and suffer from poor timeliness, making it difficult to guarantee the acquisition of maximum river channel migration. Furthermore, the accuracy of main channel line measurements is affected by the interval between measurement sections; unmeasured areas between sections require interpolation, and the larger the interval, the lower the accuracy. In contrast, the centerline of the main channel, as the primary area for water and sediment transport in the river channel, can largely replace the main channel line in reflecting channel changes and is easier to obtain, making the identification of the main channel centerline particularly important.
[0003] Identifying the centerline of the main channel only requires knowledge of the water surface width. Satellite remote sensing technology, with its advantages of short revisit cycles and wide coverage, provides a key approach for efficiently acquiring river water information (especially water surface width data), overcoming the shortcomings of traditional manual measurement methods. Currently, methods for identifying water bodies based on remote sensing images include visual translation, water index methods, and deep learning methods. Among these, visual translation is easily affected by subjective factors and involves a large workload, while deep learning methods require a large number of samples for training and have high computational requirements. Therefore, the water index method has become a mainstream approach for extracting river water bodies. For single-flow-path rivers, the centerline of the main channel can be directly obtained by applying the "skeleton method" to the extracted water body and optimizing it. However, for complex multi-flow-path river sections, the "skeleton method" can only generate a river network skeleton containing all main and tributary channels and cannot automatically distinguish the main and tributary channels to identify the true centerline of the main channel.
[0004] Although water bodies identified based on satellite imagery contain information about the centerline of the main channel, the mixing of main and tributary branches in multi-channel rivers is complex. Current methods for distinguishing these channels rely heavily on manual judgment in multi-channel scenarios. This results in extraction results that are greatly affected by subjective factors, with significant errors and uncertainties, and a lack of spatial consistency and repeatability. Summary of the Invention
[0005] Purpose of the invention: The purpose of this invention is to provide a method for identifying the centerline of the main channel of a multi-flow-path river based on the Euclidean distance transformation algorithm, which can obtain the centerline of the main channel of a multi-flow-path river.
[0006] Technical solution: The method for identifying the centerline of the main channel of a multi-flow-path river as described in this invention includes the following steps:
[0007] Preprocessing was performed on the green band and shortwave infrared band data of remote sensing images of multi-flow-path rivers, and the normalized differential water index MNDWI was calculated.
[0008] By creating a mask to remove the influence of water-related structures, using a thresholding method to identify water areas, and based on the connectivity characteristics of the river water, removing non-river areas, and retaining and generating a binary image of the river water;
[0009] Using morphological algorithms, the skeleton path of the river water body is extracted from the binary image of the river water body, and the skeleton path is transformed into an undirected graph containing node, edge and edge weight attributes.
[0010] This paper presents a data transformation of a binary image of a river channel based on squared Euclidean distance, and then re-assigns edge weights to an undirected graph using the transformed result. The process includes: generating a set of water pixels and a set of non-water pixels from the binary image of the river channel; setting the water pixel set as the set to be transformed and the non-water pixel set as the target pixel set; calculating the minimum squared Euclidean distance from each pixel in the set to be transformed to all pixels in the target pixel set; and performing squared Euclidean distance transformation on the binary image of the river channel based on the formula for squared Euclidean distance transformation. For any edge in the undirected graph, the edge weights are re-assigned based on the squared Euclidean distance at the corresponding node coordinates in the binary image of the river channel.
[0011] Dijkstra's algorithm is used to identify the minimum cost path in an undirected graph and generate the centerline of the main channel of a multi-flow-path river.
[0012] Furthermore, preprocessing is performed on the green band and shortwave infrared band data of the multi-channel river remote sensing imagery, including:
[0013] Radiation calibration and geometric calibration;
[0014] Resampling: When the green band and the shortwave infrared band have different resolutions, linear interpolation is used to resample the bands with different resolutions to unify the resolution.
[0015] Band merging is used when the river section under study spans multiple remote sensing images. Areas that overlap between different images are merged according to the principle of band averaging.
[0016] Band cropping involves cropping the bands based on the study area as the boundary to obtain the study area and discarding areas outside the study area in the remote sensing image.
[0017] The specific preprocessing steps are selected based on the remote sensing image data source and the characteristics of the study area.
[0018] Furthermore, the formula for calculating the Normalized Difference Water Index (MNDWI) is as follows:
[0019]
[0020] Green represents the green band, and SWIR represents the shortwave infrared band or infrared band.
[0021] Furthermore, by establishing a mask to remove the influence of water-related structures, a thresholding method is used to identify water areas. Based on the connectivity characteristics of the river water, non-river areas are removed, and a binary image of the river water is retained and generated; including:
[0022] When studying river sections with water-related structures, a water-related structure mask is created. For the calculated MNDWI, the original MNDWI value of the mask area is removed, and the influence of water-related structures is removed by linear interpolation using nearby MNDWI values. A threshold discrimination method is used to distinguish water bodies, with areas where MNDWI>0 are water bodies and other areas being non-water bodies. Based on the connectivity of the river water, only the maximum portion of the extracted water body is saved to remove non-river areas. The extracted river water body is saved and a binary image of the river water body is generated.
[0023] Furthermore, morphological algorithms are used to extract the river channel's water skeleton path and generate an undirected graph containing node, edge, and edge weight attributes; including:
[0024] Morphological algorithms were used to extract the water body skeleton path, which included centerline path data.
[0025] Generate a corresponding pixel set based on the pixel coordinates of the water body skeleton path, and map the pixels in the pixel set to nodes to generate a node set;
[0026] Adjacent nodes are determined based on the 8-neighborhood connections between nodes in the node set. All adjacent nodes are connected to generate an edge set. The weight of all edges in the edge set is determined based on the Euclidean distance between nodes.
[0027] Construct an undirected graph dataset containing node, edge, and edge weight attributes.
[0028] Furthermore, the formula for transforming the binary image of the river channel using the squared Euclidean distance is expressed as:
[0029]
[0030] Where EDT(I) is the squared Euclidean distance of the water body after conversion, I is the set of pixels in the binary image of the river water body, P is the set of pixels in the water body, i.e. the set of pixels to be converted, Q is the set of pixels in the non-water body, i.e. the target set of pixels, (x,y) is the coordinates of any point in set P, and (x′,y′) is the coordinates of any point in set Q.
[0031] For any edge (v) of an undirected graph i ,v j Based on the squared Euclidean distance between corresponding nodes in the binary image of the river channel, the edge weights are reassigned:
[0032]
[0033] in, and These are nodes v in the binary image of the river water body. i and v j The squared Euclidean distance at the pixel location. The edge weights after reassignment;
[0034] After reassigning edge weights, the undirected graph dataset G′ is represented as:
[0035]
[0036] Furthermore, Dijkstra's algorithm is used to identify the minimum-cost path in the undirected graph, generating the centerline of the main channel of a multi-flow-path river; including:
[0037] The minimum cost path from source node a to a known node u is expressed as:
[0038]
[0039] Where, d (a→u) and P (a→u) Representing the minimum path cost from node a to node u and the set of all paths respectively, π represents the path sequence, and each path consists of several graph edges (v... i ,v j )composition;
[0040] Update the minimum cost path to node v adjacent to u using relaxation operations:
[0041] d (a→v) =min[d (a→v) ,d (a→u) +w′ (u,v) ]
[0042] Where, d (a→v) w′ represents the minimum path cost from node a to node v. (u,v) Represents the weight of the edge (u,v);
[0043] Iteratively expand the nodes of the current minimum-cost path until the current node is the target node b, and finally determine the minimum-cost path between the source node a and the target node b:
[0044] Path (a→b) ={a=v0→v1→…→v k =b}
[0045] Where, Path (a→b)This represents the minimum cost path between source node a and target node b, which is the centerline of the main channel of the multi-flow river.
[0046] The multi-channel river main channel centerline identification system of the present invention includes:
[0047] The data processing unit is used to preprocess the green band and shortwave infrared band data of multi-channel river remote sensing images and calculate the Normalized Difference Water Index (MNDWI).
[0048] The binary image generation unit is used to remove the influence of water-related buildings by establishing a mask, identify water areas by using a threshold method, remove non-river areas according to the connectivity characteristics of the river water, and retain and generate a binary image of the river water.
[0049] An undirected graph generation unit is used to extract the skeleton path of the river water body from the binary image of the river water body using morphological algorithms, and to transform the skeleton path into an undirected graph containing nodes, edges and edge weight attributes.
[0050] The edge weight reassignment unit is used to perform data transformation on the binary image of river water based on squared Euclidean distance, and to reassign the edge weights of the undirected graph using the transformation result. This includes: generating a water pixel set and a non-water pixel set from the binary image of river water; setting the water pixel set as the pixel set to be transformed and the non-water pixel set as the target pixel set; calculating the minimum squared Euclidean distance from each pixel in the pixel set to be transformed to all pixels in the target pixel set; and performing squared Euclidean distance transformation on the binary image of river water based on the squared Euclidean distance transformation formula; and reassigning the edge weights for any edge of the undirected graph based on the squared Euclidean distance at the corresponding node coordinates in the binary image of river water.
[0051] The main channel centerline generation unit is used to identify the minimum cost path in an undirected graph using Dijkstra's algorithm and generate the main channel centerline of a multi-flow-path river.
[0052] An electronic device for storing and executing the method includes a memory, a processor, and a computer program / instructions stored in the memory and executable on the processor. When the computer program / instructions are executed by the processor, they implement the steps of the method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm.
[0053] A computer-readable storage medium for storing and executing the method, the computer-readable storage medium storing computer instructions, which, when invoked, are used to execute the steps of the method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm.
[0054] Beneficial effects: Compared with the prior art, the significant technical effects of the present invention are as follows: (1) The method has high accuracy. On the one hand, the algorithm-driven automated processing flow significantly reduces the errors and uncertainties caused by subjective factors in the manual identification process. On the other hand, the quantization mechanism based on morphology and square Euclidean distance transformation ensures that the centerline positioning of the complex area of river width variation has spatial consistency and repeatability. (2) The data source of the method is easy to obtain. Compared with traditional field surveys and measurements, the identification based on remote sensing images can save a lot of manpower, material resources and financial resources. At the same time, remote sensing images have the advantages of low cost, high timeliness and large span. Many institutions have provided free remote sensing image download platforms, such as the Landsat satellite series and the Sentinel-2 satellite series. (3) The method is simple to operate. Only green band and shortwave infrared band data are needed to identify the river water body and the centerline of the main channel. No other parameter settings are required during the operation. The identification speed is fast and batch operation is possible, providing a large amount of reliable data support for exploring the swing of the main channel. Attached Figure Description
[0055] Figure 1 This is a flowchart illustrating the method of the present invention;
[0056] Figure 2 This is a schematic diagram of binary image transformation based on squared Euclidean distance in this invention, where (a) is the binary image before transformation and (b) is the binary image after transformation;
[0057] Figure 3 These are the identification results of the embodiments of the present invention, wherein (a) is a satellite image, (b) is the calculated MNDWI, (c) is the identified binary image of the river water body, (d) is the identified skeleton line, (e) is the river water body after transformation using square Euclidean distance, (f) is the undirected graph after reassignment, and (g) is the identified main channel centerline. Detailed Implementation
[0058] The present invention will be clearly and completely described below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments described below are only a part of the examples of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are also part of the present invention.
[0059] Identifying river water bodies and generating river network skeletons based on remote sensing image data is currently an important method for exploring changes in river morphology. The river network skeleton includes information about the main channel centerline; therefore, extracting the main channel centerline from the river network skeleton is the focus of this invention. For multi-channel rivers, the main channel width is greater than that of the tributaries. This invention innovatively proposes a method to construct a negative correlation between path edge weights and river width. Then, using Dijkstra's algorithm, which can identify the minimum-cost path, the centerline of the main channel of a multi-channel river can be obtained.
[0060] This invention selects braided channels as a typical representative of multi-channel rivers for implementation examples. Braided channels are generally composed of multiple dynamically interwoven waterways and mid-channel bars or sandbars, resembling braids in appearance. Taking a typical braided section A to B in the lower reaches of the Yellow River as an example, this section is approximately 96 km long and located about 126 km downstream of a reservoir. This section has numerous sandbars and frequent main channel shifts. Sentinel-2 dual-satellite imagery (Sentinel-2A / 2B) was selected. This satellite, from the European Space Agency, has a revisit period of 5 days and can be downloaded free of charge from the Copernicus Data Space Ecosystem platform. The imagery was captured on November 27, 2024.
[0061] The following examples, combined with Figure 1 , Figure 2 and Figure 3 The present invention will be further described in detail below. The entire automated recognition process runs in a Python environment.
[0062] like Figure 1 As shown, the method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm of the present invention includes the following steps:
[0063] S1. Acquisition and preprocessing of band data: Preprocess the green band and shortwave infrared band data of multi-channel river remote sensing images and calculate the Normalized Difference Water Index (MNDWI).
[0064] The purpose of this step is to calculate the Normalized Difference Water Index (MNDWI) based on the green band and shortwave infrared band data from multi-path river remote sensing images. Remote sensing images of the study area without cloud cover are selected. Before calculating the MNDWI, the remote sensing image data needs to be preprocessed. Depending on the specific remote sensing image data source and the characteristics of the study area, the preprocessing may include the following operations: First, radiometric calibration (eliminating sensor inherent errors) and geometric calibration (eliminating image distortion errors); second, resampling, as the shortwave bands used for MNDWI calculation need to have the same resolution. When the green band and shortwave infrared band resolutions differ in the remote sensing image data source, the resolution needs to be unified, and linear interpolation is used to resample bands with different resolutions; third, band merging, when the study river segment spans multiple remote sensing images, band merging is required, with overlapping areas from different images merged according to the principle of band averaging; fourth, band clipping, to improve the calculation speed, the bands are clipped along the study area boundary to obtain the study area, discarding areas outside the study area in the remote sensing image. The specific preprocessing steps are selected based on the remote sensing image data source and the characteristics of the study area.
[0065] In this embodiment, firstly, the Sentinel-2 series satellites provide radiometrically and geometrically calibrated band data, therefore, no data calibration operation is required during preprocessing. Secondly, the Sentinel-2 series satellites provide 10m resolution green bands and 20m resolution shortwave infrared bands. Before MNDWI calculation, linear interpolation is required to resample the 20m resolution shortwave infrared bands to 10m resolution. Thirdly, in this embodiment, the river section spans two satellite images, requiring the merging of identical bands between the two images, with overlapping areas calculated using an averaging principle. Finally, this embodiment uses the Yellow River dike as the boundary for regional band cropping, with specific satellite images as shown below. Figure 3 As shown in (a); finally, the Normalized Difference Water Index (MNDWI) was calculated based on the preprocessed band data (see [reference]). Figure 3 (b)
[0066]
[0067] Green represents the green band, and SWIR represents the shortwave infrared band, which can also be replaced by the infrared band.
[0068] S2. Identify river water bodies and generate binary images: Remove the influence of water-related structures by establishing a mask, identify water areas using the threshold method, remove non-river areas based on the connectivity characteristics of river water bodies, and retain and generate binary images of river water bodies.
[0069] The purpose of this step is to identify river water bodies and generate a binary image of the river water body based on the MNDWI index data. In the MNDWI results, the MNDWI value of water body areas is greater than 0, so a threshold discrimination method can be used to distinguish water bodies. Areas with MNDWI > 0 are considered water bodies, while other areas are considered non-water bodies. Furthermore, when the studied river section has water-related structures (such as bridges), considering the fixed location of these structures, a water-related structure mask can be created. For the calculated MNDWI, the original MNDWI value of the masked area is removed, and linear interpolation is performed using nearby MNDWI values to remove the influence of the water-related structures. Finally, considering the connectivity of the river water body, only the largest portion of the extracted water body is saved to remove non-river areas. The extracted river water body is then saved and a binary image of the river water body is generated (1 represents water body, 0 represents non-water body).
[0070] In this embodiment, there are multiple bridge structures above the river. Therefore, it is necessary to create a bridge mask, remove the original MNDWI values of the bridge area, and use linear interpolation of the MNDWI values near the mask to complete the image. Then, water areas are identified based on the threshold of MNDWI>0. The area of all water bodies is counted, and the water body area with the largest area is retained, which is the river water area. Water body pixels are set to 1 and represented by blue, and non-water body pixels are set to 0 and represented by white, generating a binary image of the river water (see...). Figure 3 (c)
[0071] S3. Use morphological algorithms to extract the skeleton path of the river water body and generate an undirected graph containing node, edge and edge weight attributes.
[0072] A morphological algorithm is used to extract the skeleton path of the river water body. This path contains the centerline attributes of all the main branches of the river, but cannot distinguish the centerline of the main channel. Therefore, it is necessary to construct an undirected graph dataset containing node, edge and edge weight attributes based on the pixel set of the skeleton path to facilitate the subsequent search of the centerline path of the main channel.
[0073] The purpose of this step is to extract the skeleton path from the binary image of the river water body, and then convert the skeleton path into an undirected graph dataset containing node, edge, and edge weight attributes. The undirected graph dataset is used to facilitate subsequent path extraction. The specific generation method is as follows:
[0074] In this embodiment, firstly, a morphological algorithm is used to extract the water body skeleton path (see...). Figure 3 In the middle (d), the pixel set S corresponding to the skeleton path can be represented as:
[0075] S = {s1, s2, ..., s} n}
[0076] Among them, s i =(xi ,y i Let represent the spatial coordinates of each pixel in the image, i = 1, 2, ..., n, where n is the total number of pixels. Mapping the skeleton pixels to undirected graph nodes yields the graph node set V:
[0077] V = {v} i |v i =s i ,i=1,2,…,n}
[0078] Among them, v i This is the i-th graph node, which corresponds one-to-one with the skeleton pixel.
[0079] Secondly, based on the 8-neighborhood connections between graph nodes, adjacent nodes are connected to form edges, thus constructing the undirected graph edge set E:
[0080] E = {(v i ,v j )|v j ∈N8(v i )∩V,i≠j}
[0081] Among them, (v i ,v j ) represents node v i and node v j The edge between; N8(v) i ) represents node v i The 8-neighborhood of can be represented as:
[0082] N8(v i )={v j =(x j ,y j )∈V|max(|x i -x j |,|y i -y j |)=1}
[0083] Then, the edge weights are determined. The Euclidean distance between nodes can be used to assign weights to the edges of the undirected graph. Here, the Euclidean distance refers to the straight-line distance between two points in multidimensional space, i.e., for any edge (v... i ,v j )∈E, its edge weight It can be represented as:
[0084]
[0085] Among them, (x i ,y i ) and (x j ,y j ) represent nodes v respectivelyi and v j The coordinates when |x i -x j |+|y i -y j When |=1, When |x i -x j |=|y i -y j When |=1, It's important to note that the Euclidean distance corresponding to the edge weights refers to the geometric distance between pixels, which can be converted into the actual river channel distance by scaling the pixel resolution. Therefore, the undirected graph dataset can be represented as:
[0086]
[0087] Where G is an undirected graph dataset of the river channel's water body skeleton path, v i and v j It refers to two adjacent nodes.
[0088] In this embodiment, firstly, a morphological algorithm is used to extract the water body skeleton path. The skimage library in Python can be used for this extraction. This skeleton path includes centerline path data and unnecessary "pseudo-branches" caused by pixel protrusions in local river channels (see...). Figure 3 In step (d), the removal of "pseudo-branch" parts can be ignored in the operation of extracting only the center line of the main slot; secondly, a pixel set S is generated according to the pixel coordinates of the skeleton path, and the pixels in the pixel set are mapped to nodes to generate a node set V; thirdly, adjacent nodes are determined according to the 8-neighborhood connection relationship between nodes in the node set, and all adjacent nodes are connected to generate an edge set E. The weight of all edges in the edge set is determined according to the Euclidean distance between nodes; finally, an undirected graph dataset containing node, edge, and edge weight attributes is constructed.
[0089] S4. Perform data transformation on the binary image of the river water body based on the squared Euclidean distance, and use the transformed result to reassign the edge weights of the undirected graph.
[0090] The purpose of this step is to establish a negative correlation between edge weights and local river width. The specific operation is as follows:
[0091] First, the squared Euclidean distance transformation algorithm is used to transform the binary image of the river water body. The results before and after the transformation are as follows: Figure 2As shown in (a) and (b), Euclidean distance refers to the straight-line distance between two points in n-dimensional space. Euclidean distance transformation is an image processing algorithm used to calculate the Euclidean distance or related parameters (such as the square of the Euclidean distance) between the pixels (or sets) to be transformed in a binary image and the nearest target pixels (or sets). If we set the pixels in the water area of a river binary image as the set of pixels to be transformed and the pixels in the non-water area as the target pixel set, then the squared Euclidean distance transformation of the river binary image can be expressed as:
[0092]
[0093] Where EDT(I) is the squared Euclidean distance of the water body after conversion, I is the set of pixels in the binary image of the river water body, P is the set of pixels in the water body (the set of pixels to be converted), Q is the set of pixels in the non-water body (the set of target pixels), (x,y) is the coordinate of any point in set P, and (x′,y′) is the coordinate of any point in set Q. It should be noted that the Euclidean distance corresponding to each pixel position on the centerline path is the half width of the main channel corresponding to that point.
[0094] Secondly, the edge weights of the undirected graph are reassigned, and for any edge (v) in the undirected graph... i ,v j Based on the squared Euclidean distance between corresponding nodes in the binary image of the river channel, the edge weights are reassigned:
[0095]
[0096] in, and These represent the pixel positions v in the binary image of the river water body. i and v j The square Euclidean distance at that location. The scaled edge weights are negatively correlated with the local river width; that is, the smaller the scaled edge weights, the larger the corresponding river width.
[0097] Therefore, the undirected graph dataset G′ after reassigning edge weights can be represented as:
[0098]
[0099] In this embodiment, firstly, a set of water pixels P and a set of non-water pixels Q are generated based on the binary image of the river water body; secondly, the set of water pixels is set as the pixel set to be converted, and the set of non-water pixels is set as the target pixel set. The least square Euclidean distance from each pixel in the pixel set to be converted to all pixels in the target pixel set is calculated, and the square Euclidean distance conversion of the binary image of the river water body is performed according to the formula for converting the binary image of the river water body (see...). Figure 3 (e)). Finally, for any edge (v) in the undirected graph.i ,v j Based on the squared Euclidean distance at the corresponding node coordinates in the binary image of the river water body, the edge weights are reassigned (see...). Figure 3 (f)
[0100] S5. Use Dijkstra's algorithm to identify the minimum cost path in the undirected graph and generate the centerline of the main channel of the multi-flow-path river.
[0101] Dijkstra's algorithm is a graph algorithm that identifies the shortest path based on non-negative edge weights. Its essence lies in finding the path with the minimum total cost from the source node to the target node, i.e., the path with the minimum sum of accumulated edge weights. For the reassigned undirected graph, the minimum cost path is the river path corresponding to the maximum river width, which is the centerline of the main channel of a multi-path river. Guided by a greedy strategy, the minimum cost path from the source node a to a known node u can be represented as:
[0102]
[0103] Where, d (a→u) and P (a→u) Representing the minimum path cost from node a to node u and the set of all paths respectively, π represents the path sequence, and each path consists of several graph edges (v... i ,v j The process consists of several steps. Then, a relaxation operation is used to update the minimum-cost path to node v adjacent to u.
[0104] d (a→v) =min[d (a→v) ,d (a→u) +w′ (u,v) ]
[0105] Where, d (a→v) w′ represents the minimum path cost from node a to node v. (u,v) This represents the weight of the edge (u,v).
[0106] Iteratively expand the nodes of the current minimum-cost path until the current node is the target node b, and finally determine the minimum-cost path between the source node a and the target node b:
[0107] Path (a→b) ={a=v0→v1→…→v k =b}
[0108] Where, Path (a→b)This represents the minimum cost path between source node a and target node b. The nodes corresponding to the inflow and outflow of the studied river segment are taken as the source and target nodes. Since the path cost is negatively correlated with the local river width, the extracted path tends to cross the widest area of the river channel, which is the centerline of the main channel of the multi-flow path river.
[0109] In this embodiment, Dijkstra's algorithm from Python's networkx library can be used to identify paths by inputting source and target nodes and combining them with a reassigned undirected graph dataset. The specific identification process is as follows: First, taking the nodes corresponding to the inflow and outflow of the studied river segment as source node a and target node b, starting from node a in the undirected graph dataset, Dijkstra's algorithm is used to calculate the minimum cost path from node a to the next node. Then, the minimum cost path with adjacent nodes is updated through relaxation operations. The relaxation operations are iterated to expand the current minimum cost path nodes until the current node is the target node b, thus determining the minimum cost path Path between source node a and target node b. (a→b) Since path cost is negatively correlated with local river width, therefore, Path (a→b) The line tends to cross the widest part of the river channel, which is the centerline of the main channel in the embodiment (see...). Figure 3 (g)
[0110] In summary, the multi-channel main channel centerline identification method provided by this invention can accurately identify the centerline of the multi-channel river main channel using only green band and shortwave infrared band satellite image data, providing data support for exploring the main channel swing. It is simple to operate and easy to implement, with fast identification speed, and has strong practicality and good practical effect, making it worthy of promotion in the industry.
[0111] In one embodiment of the present invention, a multi-path river main channel centerline identification system based on the Euclidean distance transformation algorithm includes:
[0112] The data processing unit is used to preprocess the green band and shortwave infrared band data of multi-channel river remote sensing images and calculate the Normalized Difference Water Index (MNDWI).
[0113] The binary image generation unit is used to remove the influence of water-related buildings by establishing a mask, identify water areas by using a threshold method, remove non-river areas according to the connectivity characteristics of the river water, and retain and generate a binary image of the river water.
[0114] An undirected graph generation unit is used to extract the skeleton path of the river water body from the binary image of the river water body using morphological algorithms, and to transform the skeleton path into an undirected graph containing nodes, edges and edge weight attributes.
[0115] The edge weight reassignment unit is used to perform data transformation on the binary image of river water based on squared Euclidean distance, and to reassign the edge weights of the undirected graph using the transformation result. This includes: generating a water pixel set and a non-water pixel set from the binary image of river water; setting the water pixel set as the pixel set to be transformed and the non-water pixel set as the target pixel set; calculating the minimum squared Euclidean distance from each pixel in the pixel set to be transformed to all pixels in the target pixel set; and performing squared Euclidean distance transformation on the binary image of river water based on the squared Euclidean distance transformation formula; and reassigning the edge weights for any edge of the undirected graph based on the squared Euclidean distance at the corresponding node coordinates in the binary image of river water.
[0116] The main channel centerline generation unit is used to identify the minimum cost path in an undirected graph using Dijkstra's algorithm and generate the main channel centerline of a multi-flow-path river.
[0117] In one embodiment of the present invention, an electronic device includes a memory, a processor, and a computer program / instructions stored in the memory and executable on the processor. When the computer program / instructions are executed by the processor, they implement the steps of the multi-path river main channel centerline identification method based on the Euclidean distance transformation algorithm.
[0118] In one embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, which, when invoked, are used to execute the steps of the multi-path river main channel centerline identification method based on the Euclidean distance transformation algorithm.
[0119] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.
Claims
1. A method for identifying the centerline of the main channel of a multi-path river based on an Euclidean distance transformation algorithm, characterized in that, Includes the following steps: Preprocessing was performed on the green band and shortwave infrared band data of remote sensing images of multi-flow-path rivers, and the normalized differential water index MNDWI was calculated. By creating a mask to remove the influence of water-related structures, using a thresholding method to identify water areas, and based on the connectivity characteristics of the river water, removing non-river areas, and retaining and generating a binary image of the river water; Using morphological algorithms, the skeleton path of the river water body is extracted from the binary image of the river water body, and the skeleton path is transformed into an undirected graph containing node, edge and edge weight attributes. This paper presents a data transformation of a binary image of a river channel based on squared Euclidean distance, and then re-assigns edge weights to an undirected graph using the transformed result. The process includes: generating a set of water pixels and a set of non-water pixels from the binary image of the river channel; setting the water pixel set as the set to be transformed and the non-water pixel set as the target pixel set; calculating the minimum squared Euclidean distance from each pixel in the set to be transformed to all pixels in the target pixel set; and performing squared Euclidean distance transformation on the binary image of the river channel based on the formula for squared Euclidean distance transformation. For any edge in the undirected graph, the edge weights are re-assigned based on the squared Euclidean distance at the corresponding node coordinates in the binary image of the river channel. Dijkstra's algorithm is used to identify the minimum cost path in an undirected graph and generate the centerline of the main channel of a multi-flow-path river.
2. The method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm according to claim 1, characterized in that, Preprocessing of remote sensing imagery data in the green band and shortwave infrared band includes: Radiation calibration and geometric calibration; Resampling: When the green band and the shortwave infrared band have different resolutions, linear interpolation is used to resample the bands with different resolutions to unify the resolution. Band merging is used when the river section under study spans multiple remote sensing images. Areas that overlap between different images are merged according to the principle of band averaging. Band cropping involves cropping the bands based on the study area as the boundary to obtain the study area and discarding areas outside the study area in the remote sensing image. The specific preprocessing steps are selected based on the remote sensing image data source and the characteristics of the study area.
3. The method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm according to claim 1, characterized in that, The formula for calculating the Normalized Difference Water Index (MNDWI) is: Green represents the green band, and SWIR represents the shortwave infrared band or infrared band.
4. The method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm according to claim 1, characterized in that, By creating a mask to remove the influence of water-related structures, using a thresholding method to identify water areas, and based on the connectivity characteristics of the river water, removing non-river areas, and retaining and generating a binary image of the river water; include: When studying river sections with water-related structures, a water-related structure mask is created. For the calculated MNDWI, the original MNDWI value of the mask area is removed, and the influence of water-related structures is removed by linear interpolation using nearby MNDWI values. A threshold discrimination method is used to distinguish water bodies, with areas where MNDWI>0 are water bodies and other areas being non-water bodies. Based on the connectivity of the river water, only the maximum portion of the extracted water body is saved to remove non-river areas. The extracted river water body is saved and a binary image of the river water body is generated.
5. The method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm according to claim 1, characterized in that, Morphological algorithms are used to extract the river channel water skeleton path and generate an undirected graph containing node, edge, and edge weight attributes; including: Morphological algorithms were used to extract the water body skeleton path, which included centerline path data. Generate a corresponding pixel set based on the pixel coordinates of the water body skeleton path, and map the pixels in the pixel set to nodes to generate a node set; Adjacent nodes are determined based on the 8-neighborhood connections between nodes in the node set. All adjacent nodes are connected to generate an edge set. The weight of all edges in the edge set is determined based on the Euclidean distance between nodes. Construct an undirected graph dataset containing node, edge, and edge weight attributes.
6. The method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm according to claim 1, characterized in that, The formula for transforming a binary image of a river channel using the squared Euclidean distance is as follows: Where EDT(I) is the squared Euclidean distance of the water body after conversion, I is the set of pixels in the binary image of the river water body, P is the set of pixels in the water body, i.e. the set of pixels to be converted, Q is the set of pixels in the non-water body, i.e. the target set of pixels, (x,y) is the coordinates of any point in set P, and (x′,y′) is the coordinates of any point in set Q. For any edge (v) of an undirected graph i ,v j Based on the squared Euclidean distance between corresponding nodes in the binary image of the river channel, the edge weights are reassigned: in, and These are nodes v in the binary image of the river water body. i and v j The squared Euclidean distance at the pixel location. This refers to the edge weights after reassignment; After reassigning edge weights, the undirected graph dataset G′ is represented as:
7. The method for identifying the centerline of the main channel of a multi-path river based on the Euclidean distance transformation algorithm according to claim 1, characterized in that, Dijkstra's algorithm is used to identify the minimum-cost path in an undirected graph and generate the centerline of the main channel of a multi-flow-path river; including: The minimum cost path from source node a to a known node u is expressed as: Where, d (a→u) and P (a→u) Represent the minimum path cost from node a to node u and the set of all paths, respectively. π represents the path sequence, and each path consists of several graph edges (v...). i ,v j )composition; Update the minimum cost path to node v adjacent to u using relaxation operations: d (a→v) =min[d (a→v) ,d (a→u) +w′ (u,v) ] Where, d (a→v) w′ represents the minimum path cost from node a to node v. (u,v) Represents the weight of the edge (u,v); Iteratively expand the nodes of the current minimum-cost path until the current node is the target node b, and finally determine the minimum-cost path between the source node a and the target node b: Path (a→b) ={a=v0→v1→…→v k =b} Where, Path (a→b) This represents the minimum cost path between source node a and target node b, which is the centerline of the main channel of the multi-flow river.
8. A system for identifying the centerline of the main channel of a multi-path river based on an Euclidean distance transformation algorithm, characterized in that, include: The data processing unit is used to preprocess the green band and shortwave infrared band data of multi-channel river remote sensing images and calculate the Normalized Difference Water Index (MNDWI). The binary image generation unit is used to remove the influence of water-related buildings by establishing a mask, identify water areas by using a threshold method, remove non-river areas according to the connectivity characteristics of the river water, and retain and generate a binary image of the river water. An undirected graph generation unit is used to extract the skeleton path of the river water body from the binary image of the river water body using morphological algorithms, and to transform the skeleton path into an undirected graph containing nodes, edges and edge weight attributes. The edge weight reassignment unit is used to perform data transformation on the binary image of river water based on squared Euclidean distance, and to reassign the edge weights of the undirected graph using the transformation result. This includes: generating a water pixel set and a non-water pixel set from the binary image of river water; setting the water pixel set as the pixel set to be transformed and the non-water pixel set as the target pixel set; calculating the minimum squared Euclidean distance from each pixel in the pixel set to be transformed to all pixels in the target pixel set; and performing squared Euclidean distance transformation on the binary image of river water based on the squared Euclidean distance transformation formula; and reassigning the edge weights for any edge of the undirected graph based on the squared Euclidean distance at the corresponding node coordinates in the binary image of river water. The main channel centerline generation unit is used to identify the minimum cost path in an undirected graph using Dijkstra's algorithm and generate the main channel centerline of a multi-flow-path river.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein when the computer program / instruction is executed by the processor, it implements the steps of the method for identifying the centerline of the main channel of a multi-flow-path river based on the Euclidean distance transformation algorithm according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, which, when invoked, are used to perform the steps of the multi-path river main channel centerline identification method based on the Euclidean distance transformation algorithm as described in any one of claims 1-7.