Low-altitude photography method for judging width of water surface of river channel
By identifying geometric features in river and canal images using neural networks, the flexibility and applicability issues of river and canal width detection in low-altitude drone photography have been resolved, enabling accurate prediction and monitoring of river and canal width under uncertain flight paths.
Patent Information
- Application Number
- CN202411124036.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-08-12
AI Technical Summary
Existing technologies for detecting the width of river and canal surfaces in low-altitude drone photography are limited by the fixed-angle image ratio, which restricts their flexibility and applicability, making it difficult to accurately measure the width of river and canal surfaces under uncertain flight paths.
A neural network-based method is used to establish a model for predicting the width of a canal by identifying the geometric features of two parallel lines relative to the center of the image. The model is then used to automatically identify and calculate the width of the canal using low-altitude UAV photography images, including steps such as sample set training, ROI region determination, color space feature extraction, edge detection, and Hough line transform.
It enables accurate prediction of river and canal width under uncertain navigation, improves the generalization performance and applicability of river and canal width detection, and is suitable for automatic extraction and width monitoring of river and canal water objects.
Smart Images

Figure CN119027841B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of UAV detection application technology, specifically involving a method for identifying the width of river and canal water surfaces in low-altitude photography and a flight control method. Background Technology
[0002] In recent years, drone technology has been widely used in many fields, especially in various detection and measurement, and has shown significant advantages and potential.
[0003] Drones can fly along high-voltage power lines, using high-definition cameras or thermal imaging equipment to detect damage, corrosion, and other potential problems. Drones can quickly acquire image data of roads and railways, identify risks such as cracks and landslides, and perform regular maintenance.
[0004] Drones are also widely used in terrain surveying and hydrological monitoring. Equipped with high-resolution cameras or LiDAR, drones can acquire high-precision terrain data and generate digital terrain models and digital elevation models. Low-altitude drone photography provides an efficient, flexible, and accurate technical means for terrain surveying, especially in river and hydrological fields, offering crucial support for environmental protection, water resource management, and natural disaster prevention.
[0005] Low-altitude drone photography can conveniently acquire high-resolution images of rivers and their surrounding areas, helping scientists and engineers monitor real-time changes in river morphology, such as siltation, erosion, riverbed uplift, or downcutting. This data is crucial for understanding river dynamics and their environmental impact. Using low-altitude drone photography, current images of flood-affected areas can be quickly obtained, helping to assess the extent of flood impact, changes in flood levels, and their threat to surrounding infrastructure. By comparing pre- and post-flood topographic data, the long-term impacts of floods on river channels and terrain can also be analyzed.
[0006] In hydrological data, river width is one of the most fundamental data points. Currently, river width is either measured in the field using instruments or calculated directly from the pixel ratio in an image.
[0007] For example, Chinese invention patent application No. 202310722121.6 discloses a floating river width measuring instrument. It acquires a first and a second distance from a set of radars to the riverbank, and calculates a first vertical distance from the measuring instrument to the riverbank based on a known first angle between the two radars. It then acquires a third and a fourth distance from another set of radars to the riverbank, and calculates a second vertical distance from the measuring instrument to the riverbank based on a known second angle between the two radars. Finally, it sums the first and second distances to obtain the river width. Similarly, Chinese invention patent application No. 202111392791.3 discloses a method for extracting river width using a river gauge. The river gauge is first placed on the ground on one side of the riverbank, and the position of the boundary point is obtained by detecting the river surface and the ground on the opposite bank using an antenna. The distance element at the boundary point is then determined based on the amplitude difference between the river echo and the ground echo, serving as the distance between the river gauge and the opposite bank. Finally, the distance between the river gauge and the riverbank closest to the river gauge is measured, and the river width is calculated by combining these two distances.
[0008] Besides using radar waves for detection, there are also computational schemes for river width detection based on images. For example, Chinese invention patent application number 202311290498.5 discloses a flood early warning method and system for rivers in arid regions. This method involves placing water gauges near fixed reference points in the river, using a fixed camera to capture real-time images of the river surface, identifying the water depth and width from the water gauge information within the images, and specifically, using prior proportional data to binarize the extracted images and directly reading the river width from the binary image. Meanwhile, Chinese invention patent application number 202311564794.X discloses a method for real-time monitoring of natural river ecological flow based on tower-based video. This method combines video images to locate monitoring sections in digital orthophoto data, obtaining the actual distance of the monitoring section in the digital orthophoto data. It then calibrates the conversion coefficient f = W / N between the water surface width and the number of water pixels at the monitoring section, where W is the actual river width of the monitoring section obtained from the digital orthophoto data, and N is the number of water pixels at the monitoring section. Based on this conversion coefficient, the river width can be measured from the image.
[0009] Image-based measurement schemes rely on a precise proportional relationship, requiring the pixel width of the measured line segment to correspond to a predetermined proportion. Clearly, this scheme requires the video footage to be from a fixed angle for comparability, which significantly limits the flexibility of low-altitude drone photography for river and canal measurements.
[0010] Therefore, there is a need for a method and system for automatic river and canal identification and width detection based on low-altitude photography that has strong generalization performance and wide applicability. Summary of the Invention
[0011] As river water flows, it erodes the riverbanks, forming the shoreline. Observations show that in many sections of a river, there are two nearly parallel shorelines. In particular, there is a type of artificial or natural waterway within rivers, constructed or naturally formed, used for specific functions—canals. Currently, canal systems are highly developed worldwide, widely distributed in plains and hilly areas, used to guide river water for large-scale agricultural irrigation and to drain excess water. The cross-section of canals is usually trapezoidal because trapezoidal cross-sections have better slope stability, reducing the risk of slope collapse on both sides of the canal. At the same time, the selection of the bottom width and slope angle of the trapezoidal cross-section also helps to control the flow velocity and reduce sediment deposition, and the trapezoidal shape is easier to excavate and shape using mechanized equipment.
[0012] To address the aforementioned technical problems and achieve automatic identification of river and canal water surface width based on low-altitude photography, this invention provides a method for identifying river and canal water surface width using low-altitude photography, along with a flight controller method. This method identifies river and canal features and calculates water surface width based on images taken by a UAV at low altitude, without requiring the UAV to maintain a precise, specific orientation during sampling.
[0013] This invention provides a method for determining the width of river and canal water surfaces using low-altitude photography, comprising the following steps:
[0014] S1. Initialization: Establish a neural network-based prediction model for the width of river and canal water surfaces. The input of the neural network is the geometric features of two parallel lines relative to the center of the image, and the output is the actual distance between the two parallel lines.
[0015] S2. Construct a thin-sheet river / canal surface model with two parallel edges. In offline mode, use low-altitude oblique photography to collect images of river / canal surface models of different widths to form a sample set. Use the sample set to train the neural network.
[0016] S3. Acquire river and canal images online at a certain height and pitch angle using low-altitude photography, and determine the ROI region containing the river and canal in the river and canal images;
[0017] S4. Based on the color space characteristics of the central part of the ROI region, pixels in the river image with similar color space characteristics are taken as foreground objects, and non-foreground object regions are taken as background objects.
[0018] S5. In the foreground object, based on pixel connectivity, find the largest connected region as the river / canal water body region, take the river / canal water body region as the foreground object, and set all non-foreground objects to zero to form the river / canal target image.
[0019] S6. Obtain the river / canal edge image by edge detection of the target image of the river / canal;
[0020] S7. After performing Hough line transform on the river edge image, the straight lines along the two sides of the river wall on the surface of the river water are obtained through heuristic search.
[0021] S8. Obtain the geometric features of the straight lines on both sides of the river surface relative to the image center;
[0022] S9. Input the geometric features into the trained river / canal water surface width prediction model to obtain the predicted value of the river / canal water surface width;
[0023] S10. Output the predicted width value;
[0024] S11. Check if there is an exit command. If there is, proceed to step S13; otherwise, proceed to step S12.
[0025] S12. Proceed to step S3 after the width recognition command is triggered;
[0026] S13, End of river width determination.
[0027] Preferably, step S2 further includes the following steps when forming a sample: after filtering and grayscale processing, the collected image of the river and canal surface model is binarized to form a target image of the river and canal, and then the edge image of the river and canal is obtained by edge detection.
[0028] The Hough transform is performed on the edge image of the canal, and the edge image containing the two straight sides of the canal surface model is obtained through heuristic search. The geometric features of the two edges relative to the image center are obtained from the edge image, and the width of the current canal surface model is recorded. The obtained geometric features and the recorded model width are combined into a training sample.
[0029] Preferably, the geometric features in steps S1 and S8 also include two input quantities: flight altitude and overhead angle during data acquisition.
[0030] Preferably, the geometric features in step S1 include four input quantities: the slopes k1 and k2 of the two straight lines and the perpendicular distances D1 and D2 from the center point of the image to the two straight lines; the geometric features in step S8 include four input quantities: the slopes k1 and k2 of the two straight lines on the river surface and the perpendicular distances D1 and D2 from the center point of the image to the two straight lines.
[0031] Preferably, after the Hough line transformation in step S7, a set of straight lines along the edge of the canal is obtained. In the heuristic search, two straight line segments with similar directions and angles, the largest mutual distance, and the longest length are selected from the obtained set of straight lines along the edge of the canal according to heuristic rules as the two straight lines on both sides of the canal surface. The mutual distance is the minimum value of the actual distance between each point on one of the two straight line segments and each point on the other line segment. The method for calculating the actual distance d between a point and each point on a target line segment is as follows: if the line connecting the point to any endpoint of the target line segment forms an obtuse angle with the target line segment, then the actual distance d is the distance from the point to the endpoint; otherwise, the actual distance d is the perpendicular distance from the point to the target line segment, i.e., the vertical distance.
[0032] Preferably, step S1 further includes: establishing a target classification model based on a YOLOv5s network; acquiring river and canal scene images using a low-altitude camera in the image acquisition unit; training the network offline using an image sample set composed of river and canal scene images labeled with river and canal regions; and in step S3, obtaining river and canal region anchor frames by recognizing and processing the acquired river and canal images using the river and canal scene target classification model.
[0033] Preferably, in step S4, a color threshold is determined based on the value ranges of the three color channels extracted from the center of the ROI region. Pixels whose colors conform to the color threshold range are used as foreground objects, and non-foreground object regions are used as background objects. After setting all background objects in the river image to zero, a binary image of the river is formed. In step S5, based on the connectivity of the foreground object pixels, all connected components are detected, and the largest connected component is selected as the river water body region. Only the river water body region is used as the foreground object to form the river target image.
[0034] Preferably, in step S4, the color thresholds are determined based on the value ranges of the three color channels extracted from the central part of the ROI region, corresponding to the threshold ranges of the three primary colors. Specifically, after calculating the upper and lower limits of the grayscale values of each color channel for all pixels in the seed region of the central part, the upper and lower limits can be extended by a certain distance, such as increasing or decreasing by a certain value of 5 to 20, or increasing or decreasing by 5 to 10% of the midpoint of the grayscale value range of this channel.
[0035] Preferably, in step S4, a sub-point is set at the intersection of the two diagonals corresponding to the rectangle of the ROI region. After the water is filled, the river water area is obtained as the foreground object. After the pixels outside the obtained river water area are set to zero, a binary image of the river is formed.
[0036] Preferably, in step S5, a morphological closing operation of first dilation and then erosion is performed on the binarized river water image, i.e., the river binary image, to remove interference points in the connected domain of the water body. In step S7, any one of the two straight lines on both sides of the river water surface is described using the coordinates of its two endpoints; and in step S8, the slope of the line and the perpendicular distance from the image center point to the line are calculated based on the two endpoints respectively; the slope of the two straight lines on both sides of the river water surface and the perpendicular distance from the image center point to the line are used as the geometric features of the river in the river image.
[0037] Preferably, the BP neural network used in the river / canal water surface width prediction model has a three-layer structure including one hidden layer.
[0038] The output of the j-th node in the hidden layer is
[0039] The output of the first node in the output layer is
[0040] Where f() is taken as the tansig function, w ij and v j These are the connection weights from the input layer to the hidden layer and the connection weights from the hidden layer to the output layer, respectively. j b and are the thresholds for the hidden layer and output layer, respectively. m = 4 is the number of input variables, and k is the number of hidden layer nodes. Gradient descent is used for network training.
[0041] Preferably, the geometric features of the straight line are calculated as follows: assuming the coordinates of the two endpoints of the straight line are (x1, y1) and (x2, y2) respectively, then its slope is k = y1 - y2 / x1 - x2;
[0042] The perpendicular distance from the image center to the line is
[0043] In the formula, (x0, y0) represents the coordinates of the center of the image, A and B are the coefficients of the general form of the equation of a straight line, and C is a constant term and: A = y2 - y1, B = x1 - x2, C = -x1(y2 - y1) + y1(x2 - x1);
[0044] Based on the formulas for k and d, the slopes k1 and k2 of the two lines, as well as the perpendicular distances D1 and D2 from the center point of the image to the two lines, are calculated as four quantities as geometric features.
[0045] Preferably, step S2, training the neural network used as the prediction model for the width of the river channel, includes: T1, initializing the weights and biases of the network; T2, reading the network parameters and the training sample set recorded in the document; T3, normalizing the sample data; T4, calculating the error between the predicted output value and the expected value for each sample; T5, recalculating and correcting the network weights and biases based on the error; T6, ending the training if the conditions for ending the network training are met, otherwise proceeding to T4 to continue training; T7, analyzing and outputting the results.
[0046] Preferably, step S2 further includes: arranging the river and canal surface models in different areas of the ground under the oblique photography field of view, so that the river and canal surface models in the sample set are distributed in each grid of the nine-square grid formed by the top, middle, bottom, left, middle, and right sides of the image plane.
[0047] Preferably, multiple neural networks are used as the river / canal width prediction models, each corresponding to a flight altitude and an overhead view angle when acquiring river / canal images via low-altitude photography. The river / canal width prediction model applied in step S9 corresponds to the river / canal width prediction model neural network corresponding to the flight altitude and overhead view angle when acquiring river / canal images via low-altitude photography in step S3.
[0048] Preferably, in step S10, the coordinate and orientation information of the current canal segment is also obtained. After determining the width of the canal surface, the predicted width value and corresponding coordinate and orientation information are output. After detecting the width of the canal segment, the width information of each segment is marked at the corresponding position in the canal image, indicated by an arrow between the two banks of that segment. The obtained coordinate and position information, as well as the width information of the canal segment, are stored in the list of the storage module or in the cloud server.
[0049] Preferably, in step S10, it is also determined whether the width of the current segment exceeds the preset threshold range of the width of the river channel. If so, an over-limit alarm is issued.
[0050] In another embodiment of the present invention, a flight control method for determining the width of river / canal surface during low-altitude photography is also provided, comprising the following steps:
[0051] R1. Initialize and establish a river and canal water surface width prediction neural network to map the geometric features of the straight line edge of the river and canal water surface in the low-altitude photography image to the river and canal water surface width. After collecting training samples, train the river and canal water surface width prediction neural network to obtain the trained river and canal water surface width prediction model.
[0052] R2. In flight, responding to the command to identify the width of the river or canal surface, perform low-altitude oblique photography of the field river or canal scene to obtain river or canal images;
[0053] R3. In the river and canal image, determine the ROI region containing the river and canal. Extract the three color channels from the center of the ROI region to determine the color threshold. Use the pixels whose colors match the color threshold range as the foreground objects. Set all non-foreground object regions in the river and canal image to zero to form a binary image of the river and canal.
[0054] R4. Based on the connectivity of the foreground object pixels, detect all connected regions and select the largest connected region as the river / canal water body region, and form the river / canal target image using only the river / canal water body region as the foreground object.
[0055] R5. For the target image of the river channel, after obtaining the edge of the river channel through edge detection, Hough transform is performed, and the image of the water edge line containing the two straight edges of the water surface of the river channel is obtained through heuristic search.
[0056] R6. Based on the two edges obtained from the canal edge image, calculate the geometric feature quantities of each edge relative to the image center.
[0057] R7. Input the obtained geometric feature quantities into the river / canal water surface width prediction model to obtain the predicted value of the river / canal water surface width, and output the predicted width value.
[0058] R8. Determine whether the current water surface width exceeds the preset threshold range of the water surface width of the segment. If so, issue an over-limit alarm.
[0059] R9. Determine whether the task of determining the width of the river / canal surface has been exited. If yes, proceed to step R11; otherwise, proceed to step R10.
[0060] R10. Fly along the two side lines of the river and canal surface. When the overlap between the current image and the previous frame of the river and canal image is less than a certain proportion, issue a river and canal surface width recognition command and proceed to step R2.
[0061] R11, End low-altitude photography, river and canal water surface width identification, flight control.
[0062] Preferably, in step R2, an inverse perspective transformation matrix is obtained based on the sampling height and pitch angle during low-altitude oblique photography of the river scene; in step R4, the binarized river target image is converted into a real-world binary image of the river based on the inverse perspective transformation matrix; in step R5, edge detection and Hough line transformation are performed on the real-world binary image of the river, and a canal water edge image containing the two straight edges of the river surface is obtained through heuristic search; then, the angle or slope of the two edges of the river surface is calculated to see if they are close. If they are, proceed to step R6; otherwise, mark the river surface edges as not parallel and proceed to step R10; in step R10, it is first determined whether the river surface edges are parallel. If not, continue flying along the river in the direction parallel to the angle bisector of the two edges of the river surface; otherwise, fly along the direction of the two edges of the river surface.
[0063] Preferably, in step R2, multiple images can be stitched together by aligning feature points, and the stitched image can be used as the current river canal image.
[0064] Preferably, in step R8, the width of the current segment of the canal is calculated as a ratio to a preset width threshold. When the ratio is greater than a set high threshold, an alarm is issued, indicating that the width of the canal exceeds the warning level and flood prevention is required. When the ratio is less than a set low threshold, an alarm is issued, indicating that the width of the canal is too small and drought prevention is required or water leakage may occur.
[0065] Compared with existing technologies, the present invention has the following advantages: It analyzes the imaging characteristics of rivers and canals under low-altitude UAV photography. Addressing the unpredictable relative orientation between the UAV's attitude and the river / canal's orientation during image acquisition, the invention analyzes the feature representation of the river / canal surface width in the image space. It proposes using four geometric features—the slope of the straight lines on both sides of the river / canal surface and the perpendicular distance from the image center point to these lines—as constraints to establish a neural network for predicting the river / canal surface width. The collected samples are used to identify and train the nonlinear mapping relationship between the river / canal surface width and the proposed four geometric features. Based on low-altitude river / canal images, a target classification model is used to locate the ROI (Region of Interest) region of the river / canal target using anchor boxes. The river / canal water body targets are obtained based on the color value range within the ROI region, and the river / canal water body objects are further selected through maximum connected component filtering. Edge detection is performed on the water body area of the river channel. The straight lines on both sides of the water surface of the river channel are obtained by Hough transform. The four geometric features of the extracted two edges are extracted. The results are input into the trained river channel width prediction model to predict the width of the river channel online.
[0066] This invention enables the automatic extraction of water bodies and shorelines in rivers and canals. The established neural network-based river and canal width prediction model has good generalization performance and can accurately predict the width of rivers and canals during different periods of low and high water based on river and canal images collected from uncertain navigation directions. At the same time, it can also be applied to the monitoring of the width of water surfaces in sections with approximately parallel banks, which are common in most rivers.
[0067] It should be understood that all combinations of the foregoing concepts and the additional concepts discussed in more detail below (provided that such concepts are not inconsistent with each other) can be contemplated as part of the inventive subject matter disclosed herein. In particular, all combinations of the claimed subject matter appearing in this disclosure can be contemplated as part of the inventive subject matter disclosed herein. Attached Figure Description
[0068] Figure 1 A schematic diagram illustrating the processing flow of methods for identifying the width of river and canal surfaces in low-altitude photography.
[0069] Figure 2 A schematic diagram of a device and system for determining the width of river and canal surfaces in low-altitude photography.
[0070] Figure 3A This is a structural diagram of the main unit / controller in a low-altitude photography device for determining the width of river and canal surfaces. Figure 3B Here is a structural diagram of the water body area extraction module. Figure 3C Here is a structural diagram of the geometric feature extraction module;
[0071] Figure 4A This is a schematic diagram of the neural network model structure for the river / canal water surface width prediction module. Figure 4B A partial structural diagram of the main unit / controller in a low-altitude photography device for determining the width of river and canal surfaces.
[0072] Figure 5 A schematic diagram of the drone's shooting posture when collecting samples for low-altitude photography;
[0073] Figure 6A This is a schematic diagram comparing water surface models of rivers and canals of different widths. Figure 6B A schematic diagram of the river / canal surface model taken from different angles during sample collection;
[0074] Figure 6C This is a schematic diagram showing the outline processing of a river / canal water surface model. Figure 6D This is a schematic diagram of the detection results after Hough line transformation;
[0075] Figure 7 A schematic diagram showing the width constraints and geometric features of the proposed river / canal water surface model.
[0076] Figure 8A , Figure 8BA schematic diagram illustrating the selection of straight lines along the water surface edges of rivers and canals from different directions and the extraction of geometric features;
[0077] Figure 9A , Figure 9B To test the fitting curve between the actual and predicted values of the water surface model of the collection channel;
[0078] Figure 10 Schematic diagram of anchor frame for target identification in river channels;
[0079] Figure 11A , Figure 11B These are schematic diagrams of direct binarization and contour extraction, respectively.
[0080] Figure 12A , Figure 12B These are schematic diagrams illustrating binarization based on each color grayscale value range, and contour extraction after binarization. Figure 12C This is a schematic diagram of the morphological processing results. Figure 12D This is a schematic diagram for filtering the largest connected components.
[0081] Figure 13A , Figure 13B , Figure 13C These are, respectively, the binary image after maximum connectivity filtering, morphological processing, and the corresponding water region extraction schematic diagram;
[0082] Figure 14A Image of the edge of a river or canal. Figure 14B A schematic diagram of the straight lines extracted by the Hough line transform;
[0083] Figure 15A This is a comparison chart showing the results of straight line detection at the edge of the river / canal water surface. Figure 15B A schematic diagram showing the width of the water surface in a river or canal;
[0084] Figure 16 A schematic diagram showing the segmentation for determining the width of the river channel;
[0085] Figure 17A , Figure 17B This is a schematic diagram of a river canal scene taken from a low-altitude perspective.
[0086] The system includes: a 1000-unit low-altitude photography river / canal water surface width identification system, a 900-unit low-altitude photography river / canal water surface width identification device, a 100-unit main unit / controller, a 200-unit user interface unit, a 300-unit handheld terminal, a 400-unit server, a 500-unit image acquisition unit, a 600-unit flight control platform, a 700-unit positioning unit, and an 800-unit field environment / river / canal scene system.
[0087] 110 processors, 120 memory modules, 130 input / output modules.
[0088] 111 General Processing Module, 112 Water Region Extraction Module, 113 Geometric Feature Extraction Module, 114 Iterative Learning Module, 115 River / Canal Water Surface Width Prediction Module.
[0089] 1121 Image Acquisition Unit, 1122 Target Detection Unit, 1123 Water Region Extraction Unit
[0090] 1131 Edge Detection Unit, 1132 Line Extraction (Filtering) Unit, 1133 Water Edge Extraction Unit, 1134 Slope Feature Extraction Unit, 1135 Distance Feature Extraction Unit.
[0091] 1141 First connecting array, 1142 Second connecting array,
[0092] 1101 Neural Network Model, 131 Input Section, 132 Output Section
[0093] 210 Display screen, 220 Operation panel. Detailed Implementation
[0094] The preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings, but the present invention is not limited to these embodiments. The present invention covers any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of the present invention.
[0095] To provide the public with a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the invention, while those skilled in the art can fully understand the invention without these details.
[0096] The invention is described in more detail below by way of example with reference to the accompanying drawings. It should be noted that the drawings are in a simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of the invention.
[0097] Example 1:
[0098] In my country, rivers and canals are widely distributed. Besides traditional methods like satellite aerial photography to collect topographical images of rivers and canals, other methods include... Figure 17A , Figure 17B As shown, with the development of UAV technology, it is now very convenient to use low-altitude UAVs to perform oblique photographic sampling of rivers and canals. Identifying the width of these rivers and canals is of great significance. Therefore, this invention discloses a method for identifying the width of river and canal surface through low-altitude photography that does not rely on prior width measurements and does not require a preset specific flight direction when acquiring images of rivers and canals in real time.
[0099] like Figure 1 As shown, the present invention provides a method for determining the width of river / canal water surface using low-altitude photography, which includes the following steps:
[0100] S1. Initialization: Establish a neural network-based prediction model for the width of river and canal water surfaces. The input of the neural network is the geometric features of two parallel lines relative to the center of the image, and the output is the actual distance between the two parallel lines.
[0101] S2. Construct a thin-sheet river / canal surface model with two parallel edges. In offline mode, use low-altitude oblique photography to collect images of river / canal surface models of different widths to form a sample set. Use the sample set to train the neural network.
[0102] S3. Acquire river and canal images online at a certain height and pitch angle using low-altitude photography, and determine the ROI region containing the river and canal in the river and canal images;
[0103] S4. Based on the color space characteristics of the central part of the ROI region, pixels in the river image with similar color space characteristics are taken as foreground objects, and non-foreground object regions are taken as background objects.
[0104] S5. In the foreground object, based on pixel connectivity, find the largest connected region as the river / canal water body region, take the river / canal water body region as the foreground object, and set all non-foreground objects to zero to form the river / canal target image.
[0105] S6. Obtain the river / canal edge image by edge detection of the target image of the river / canal;
[0106] S7. After performing Hough line transform on the river edge image, the straight lines along the two sides of the river wall, i.e. the river water surface, are obtained through heuristic search, and a river water edge image is formed.
[0107] S8. Obtain the geometric features of the straight lines on both sides of the canal surface relative to the image center from the image of the canal water edge line;
[0108] S9. Input the geometric features into the trained river / canal water surface width prediction model to obtain the predicted value of the river / canal water surface width;
[0109] S10. Output the predicted width value;
[0110] S11. Check if there is an exit command. If there is, proceed to step S13; otherwise, proceed to step S12.
[0111] S12. Proceed to step S3 after the width recognition command is triggered;
[0112] S13, End of river width determination.
[0113] like Figure 2As shown, the low-altitude photography river / canal water surface width identification device 900 using the method of the present invention includes a host unit 100 and a user interface unit 200. The host unit 100 includes a processor 110, a storage module 120, and an input / output module 130. The user interface unit 200 includes a display screen 210 and an operation panel 220. The host unit 110 is configured to: acquire low-altitude photography images of the river / canal; determine the Region of Interest (ROI) containing the river / canal in the river / canal image; determine a color threshold based on the value ranges of the three color channels extracted from the center of the ROI region; use pixels whose colors conform to the color threshold range as foreground objects; use non-foreground object regions as background objects; set all background objects in the river / canal image to zero to form a binary image of the river / canal; detect all connected components based on the connectivity of the foreground object pixels and select the largest connected component as the river / canal water body region; and use only the river / canal... The water body area is used as the foreground object to form the target image of the canal; the canal edge image is obtained by edge detection of the target image of the canal; after performing Hough line transform on the canal edge image, the canal water edge image containing the two straight sides of the canal water is obtained by heuristic search; the geometric features of the two straight sides of the canal water surface relative to the image center are obtained from the canal water edge image, and the geometric features are input into the trained neural network-based canal water surface width prediction model to obtain the canal water surface width prediction value, and the width prediction value is output by the output unit 132 in the input-output module 130.
[0114] like Figure 17A As shown, the cross-section of a canal is usually trapezoidal. The water flow in the canal varies greatly during different periods, such as the wet season and the dry season. As can be seen from low-altitude photographs, the water level in the canal moves due to the change in flow rate, and the distance between the two sides of the waterline, i.e., the width of the water surface, also changes accordingly.
[0115] like Figure 17B As shown, the water flow in the canal is relatively evenly distributed. Although its course occasionally bends, it has two nearly parallel shorelines in most areas. See also Figure 17A , Figure 17B As shown, in images of rivers and canals collected in outdoor scenes, the water surface appears wider at one end and narrower at the other. Furthermore, the parallel shorelines on both sides of the actual river surface in the image approximately converge at a disappearing point at infinity. To obtain the river width, on the one hand, it's clear that calculating the distance from pixels on both sides of the river in the image and then converting it back to the actual width using a proportional relationship is difficult to determine precisely, and this proportional relationship is directly related to the sampling position of the side pixels. On the other hand, in practical applications, it's not feasible to force the drone to face a fixed direction towards the river, such as directly towards the center, for the purpose of proportional calculations; otherwise, the applicability of the identification method would be greatly limited.
[0116] Although the width of the canal surface is fixed in the field of view, its pixel width and orientation are uncertain in the image space when sampling from a constantly rotating drone downwards. This definite actual width and uncertain image features present a contradictory relationship that is difficult to reconcile. Therefore, it is necessary to decouple and model this contradiction. The drone's flight path is not fixed, and the canal's orientation varies greatly; therefore, the relative relationship between the drone's flight path and the canal's orientation is unpredictable and cannot be predetermined. To improve the universality and applicability of canal surface width identification, it is necessary to study how to represent the relationship between the two under various relative orientations in the image space—that is, what features in the image can determine the canal surface width?
[0117] Observations of various low-altitude photographs of canals from different vantage points revealed that the key lies in the two edge lines of the water surface, i.e., the shoreline. The direction of the canal's water surface edge does not uniquely determine its width; the angle of the straight line only reflects its relative angle to the flight direction. Extensive experiments and tests further showed that the width of the canal's water surface affects the imaging effect of the two parallel sides in the image. How can these two sides be characterized? Through further research, hypotheses, and reasoning, four input quantities are proposed: the slopes k1 and k2 of the two parallel lines at different intervals, and the perpendicular distances D1 and D2 from the image center point to the two sides of the lines. These are used as constraints on the width of different canal water surfaces in image space. Figure 7 As shown. Further, how can this constraint be mapped to the width of the canal surface? Since the relationship between the two is nonlinear and coupled, inspired by the fitting application of neural networks in nonlinear system modeling, this invention proposes using neural networks to establish a canal surface width prediction model, referencing... Figure 4A As shown.
[0118] A neural network is a machine learning model that mimics the biological nervous system, and it excels at modeling nonlinear mappings. It learns and represents complex functional relationships through a multi-layered structure of artificial neurons. A neural network consists of an input layer, hidden layers, and an output layer; each layer contains several neurons, and each neuron is connected to neurons in the previous layer via weights. The input layer receives the input data, the hidden layers perform nonlinear transformations and feature extraction (and can have multiple layers), and the output layer outputs the final prediction result.
[0119] like Figure 4A As shown, the river and canal water surface width prediction model of the present invention adopts a three-layer BP neural network with one hidden layer. Its input layer receives four input quantities from the general processing module: the slope k1 and k2 of the straight lines on both sides of the river and canal water surface, and the perpendicular distances D1 and D2 from the center point of the image to the straight lines on both sides of the river and canal water surface. The output quantity of the output layer is the width of the river and canal water surface.
[0120] To extract the four input quantities or geometric features of the canal in the image space, it is necessary to first locate the water body area of the canal in the image, and then extract the straight lines on both sides of the water surface.
[0121] by Figure 17B Taking the river scene in the middle left image as an example, the acquired color image is directly converted to grayscale and then binarized using the Otsu thresholding method. The processing result is as follows: Figure 11A As shown. According to Figure 11A After extracting the contours from the obtained binary image, they are marked on the original image to obtain the following result: Figure 11B The outline diagram shown. Figure 11B In the displayed results, the outlines enclose the scenery between the sky and the riverbank; the river water is submerged within the entire river system. Therefore, it is difficult to obtain effective information for locating the river water using only ordinary binarization processing.
[0122] Observation of numerous low-altitude photographs of various rivers and canals revealed distinct color space and location characteristics in the water body compared to land and riverbanks. Therefore, different modules were incorporated into the processor to sequentially extract the water body and geometric features of the rivers and canals.
[0123] See Figure 2 , Figure 3A As shown, the processor 110 of the host unit or controller 100 is equipped with multiple processing modules, namely a general processing module 111, a water area extraction module 112, a geometric feature extraction module 113, an iterative learning module 114, and a river / canal water surface width prediction module 115. The general processing module 111 responds to messages and user interface unit operations, initiates the identification of rivers / canals in the acquired river / canal images, schedules the identification processing flow, inputs the real-time acquired river / canal images into the water area extraction module 112, and outputs the width data identified and predicted by the river / canal water surface width prediction module 115.
[0124] like Figure 3B As shown, the water region extraction module 112 also includes an image acquisition unit 1121, a target detection unit 1122, and a water region extraction unit 1123. The image acquisition unit 1121 acquires low-altitude photographic images captured by the image acquisition unit 500, or acquires pre-stored river and canal images from the storage module 120 in an offline state; high-frequency noise is removed by filtering; then, the target detection unit 1122 identifies the location of the river in the image as a Region of Interest (ROI) based on deep learning features using a trained target classification model; the water region extraction unit 1123 selects a seed region from the center of the ROI region to obtain a color threshold, and extracts the river and canal water region from the low-altitude image based on the obtained color threshold to form a binarized river and canal water image.
[0125] In the target detection unit 1122, a target classification model based on a deep network such as YOLOv5s is established. After acquiring images of a river / canal scene using an overhead camera in the image acquisition unit, the network is trained offline using an image sample set consisting of these scene images labeled with various target regions such as the river / canal, to obtain the scene target classification model. For online operation, see [link to documentation]. Figure 10 As shown, the water body region extraction unit 1123 uses the scene target classification model to identify and process the scene image to be tested, which includes the river and canal, to obtain the anchor frame of the river and canal region, and takes the region within the anchor frame as the ROI region of the river and canal.
[0126] By observing river and canal images, it was found that the pixel values of the color components in the areas where the water bodies are located are very similar. Therefore, the river region extraction unit 1123 of this invention determines a threshold range for the color space, such as the three primary colors, from the central portion of the ROI region. See also Figure 10 As shown, a sub-region is defined in a rectangular or circular block near the intersection of the two diagonals of the ROI region rectangle. The value ranges of the three color channels are extracted from the seed region, and the color thresholds are determined to correspond to the threshold ranges of the three primary colors. After calculating the upper and lower limits of the grayscale values of each color channel for all pixels in the central seed region, these limits can be extended by a certain distance, such as increasing or decreasing by a certain value of 5 to 20, or increasing or decreasing by 5 to 10% of the midpoint of the grayscale value range of this channel.
[0127] In the acquired low-altitude photographic images, pixels that conform to the determined three-primary-color threshold range are designated as foreground objects, and non-foreground object areas are designated as background objects. The background objects in the oblique photographic image are all set to zero, while the foreground objects are all set to 1 (i.e., binarized to 255), forming a binarized river image. The result is as follows: Figure 12A As shown. According to Figure 12A After extracting the contours from the obtained binary image, they are marked on the original image to obtain the following result: Figure 12B The outline diagram shown. Compare. Figure 12B and Figure 11B As can be seen, in the contours obtained by the former, in addition to the complete contours of the river and canal, there are also many small contours formed in the slope and land areas due to the gray values of individual pixels being close to those of the water body.
[0128] Therefore, feature analysis of the image revealed that the water body in the binarized canal image appears as a large, continuous region. Thus, based on the connectivity of the foreground object pixels, all connected components were detected in the obtained canal image, and the largest connected component was selected as the canal water body region; simultaneously, as... Figure 12CAs shown, morphological opening and closing operations can be performed on the binary image to remove fragmented target regions, thus reducing the computation required for connected component search. The obtained largest connected component is marked in the original canal image as a contour line, as shown in the figure. Figure 12D As shown.
[0129] Based on the binarized river and canal image, a binarized river and canal water image is formed by using only the foreground pixels in the water body region of the river and canal as the foreground object. The result is as follows. Figure 13A As shown.
[0130] exist Figure 13A In the binarized image of the river channel shown, the boundaries of the water area are affected by shadows or water seepage, resulting in some non-foreground pixels within the water and fragmented edges extending into the slope of the right bank. Such images can be further processed through morphological operations. Figure 13A Performing a morphological closing operation involving first dilation and then erosion yields the following result: Figure 13B The binary image shown has had some interference points removed. Accordingly, based on... Figure 13B After extracting the contour from the binary image, it is marked on the original image, resulting in the following: Figure 13C The outline diagram is shown. Thus, a binary image with the river / canal water body as the single target is obtained, forming the target image of the river / canal.
[0131] See Figure 3C As shown, the geometric feature extraction module 113 includes an edge detection unit 1131, a line extraction and filtering unit 1132, a water edge extraction unit 1133, a slope feature extraction unit 1134, and a distance feature extraction unit 1135.
[0132] After the image content focuses on the water body area of the canal, the edge detection unit 1131 performs edge extraction on the binarized canal target image. Edge information in an image is often contained in areas where the grayscale values of adjacent pixels change drastically. In digital image processing technology, there are many edge detection methods, such as using Sobel, Canny, and LOG edge detection operators. For binarized canal target images, edge extraction can be performed directly. For color or grayscale canal target images, the color image is first converted to a single-channel image, and then edge detection operators are used to detect the edges.
[0133] The Canny operator is a second-order derivative edge detection operator that employs Gaussian smoothing filtering, gradient magnitude and direction calculation, non-maximum suppression, and hysteresis thresholding in its series of operations. Compared to first-order derivative edge detection operators, the Canny operator can find an optimal edge, filter out most noisy edges, and significantly improve the accuracy of edge detection and edge localization. This invention uses edge detection operators such as Canny to detect the edges of water bodies, forming river and canal edge images, as shown in the figure. Figure 14A As shown.
[0134] In images of river and canal edges, the most noteworthy elements are the straight lines representing the boundaries of the canal. The Hough line transform maps points in image space to curves in parameter space, then finds the intersection points of these curves in parameter space to detect the straight lines. In image space, the equation of a straight line can be expressed as: y = kx + b; using polar coordinates, it can be expressed as: ρ = xcosθ + ysinθ, where ρ is the perpendicular distance from the line to the origin, and θ is the angle between the perpendicular line and the positive x-axis. The essence of the Hough line transform is to establish a mapping relationship between image space and parameter space. By fully utilizing the global characteristics of the image and leveraging the point-line duality, it maps pixel coordinates to the straight lines represented by elements in parameter space. Analysis is then performed in parameter space, and the detection task is completed through cumulative statistical analysis.
[0135] The straight line extraction and filtering unit 1132 extracts the straight line boundaries of the canal water surface from the canal edge image. It performs a Hough transform on the canal edge image to obtain a set of canal edge straight lines. From the obtained set of canal edge straight lines, the water edge extraction unit 1133 uses heuristic rules to filter out two straight line segments with similar directional angles, maximum mutual distance, and longest length as the two straight lines on either side of the canal water surface. The result is as follows: Figure 14B As shown.
[0136] See Figure 14B As shown, the mutual distance between two line segments is the minimum actual distance from any point on one line segment to any point on the other line segment. The mutual distance can be calculated by iterating through the distances between points on the two line segments; however, analysis reveals that this search process can be simplified. Specifically, the mutual distance is further defined as the minimum of four actual distances formed by the actual distances from the endpoints of one line segment to points on the other line segment. Further, the actual distance d from a point to a target line segment is calculated as follows: if the line connecting the point to any endpoint of the target line segment forms an obtuse angle with the target line segment, then the actual distance d is the distance from the point to that endpoint; otherwise, the actual distance d is the perpendicular distance from the point to the target line segment.
[0137] like Figure 14B As shown, the waterside extraction unit 1133 found two straight lines labeled 2 and 1 on the left and right sides of the river / canal water edge, respectively. These two found straight line segments were used as the two straight lines on either side of the river / canal water surface and marked on the river / canal image. The result is as follows. Figure 15A As shown in the figure, it can be seen that through the above processing, the water surface boundary line on both sides of the river or canal can be accurately located, i.e., the shoreline.
[0138] For the extracted water surface edges of the two canals, the slope feature extraction unit 1134 and the distance feature extraction unit 1135 respectively calculate the slope of the straight line and the perpendicular distance from the image center point to the straight line. See [link / reference] Figure 7 This diagram illustrates the width constraints of a river / canal surface model. The diagram shows two sides of a river / canal surface on the left and right sides of the image plane, respectively. For the two sides of the left river / canal surface, the angles and slopes of the lines they form are α(k1) and β(k2), respectively, and the perpendicular distances from the image center point to these two sides are D1 and D2, respectively. Similarly, for the two sides of the right river / canal surface, the angles and slopes of the lines they form are α′(k1′) and β′(k2′), respectively, and the perpendicular distances from the image center point to these two sides are D1′ and D2′, respectively. In the oblique photographic image plane, the two parallel lines will intersect at a point O at their far ends; point O is called the hidden line disappearance point.
[0139] The algebraic equation of a straight line can commonly be expressed in three forms: the general form, the two-point form, and the slope-intercept form. The general form is: Ax + By + C = 0, where A and B are not simultaneously zero, and the slope of the line is k = -A / B. In a Cartesian coordinate system, the y-intercept of the line is b = -C / B. The general form applies to all linear equations.
[0140] Two-point form is: The two-point form equation is the equation of a straight line passing through two points given their coordinates. The slope of this line is k = (y2 - y1) / (x2 - x1). As can be seen from the two-point form equation, this equation is applicable to describing straight lines that are not perpendicular to the x-axis or y-axis.
[0141] The slope-intercept form is: y = kx + b. The slope-intercept form explicitly expresses the slope k and intercept b of the line and is suitable for representing lines that are not perpendicular to the x-axis.
[0142] In the image, the straight line detected by the Hough transform is described by the coordinates of its two endpoints, denoted as (x1, y1) and (x2, y2). Substituting these coordinates into the two-point equation and transforming it into slope-intercept form, we obtain: Its corresponding slope k = y1-y2 / x1-x2. The only difference is that the slope of the line is calculated in the image coordinate system (the y-axis is downward as the positive direction). Therefore, the slope of the line in the image is equal in magnitude but opposite in sign to that in the Cartesian coordinate system.
[0143] By combining the equation of the straight line, the perpendicular distance from the center of the image to the edge of the river / canal surface, i.e., the river / canal waterline or shoreline, can be calculated as follows: In the formula, (x0, y0) represents the coordinates of the image center, A and B are the coefficients of the general form of the straight line equation, and C is a constant term with the following conditions: A = y2 - y1, B = x1 - x2, C = -x1(y2 - y1) + y1(x2 - x1). Based on the calculation formulas for k and d, the slopes k1 and k2 of the straight lines on both sides of the river / canal surface, as well as the perpendicular distances D1 and D2 from the image center point to the two straight lines, are calculated respectively, forming four quantities that are used as the geometric features of the river / canal surface in the river / canal image.
[0144] like Figure 8A , Figure 8B A schematic diagram is provided illustrating the selection of straight lines along the river / canal edges and the extraction of geometric features from a model image of the river / canal surface. The center point of the image is indicated by the intersection of diagonals. Among the detected straight lines, two line segments are significantly longer than the others and are therefore selected as the two edge lines of the river / canal. It can also be seen that the angles of the two river / canal surface edge lines are similar. (In 8A,...) Figure 8B In the image, after excluding shorter straight lines, for the two selected edges, a perpendicular line is drawn from the center point of the image to the edge, represented by a dashed line. In this context, ... Figure 8B Since the foot of the perpendicular is outside the range of the sideline, the sideline is extended to the left to the foot of the perpendicular.
[0145] To reveal the nonlinear mapping construction of the river / canal water surface width prediction model of this invention, training image samples are obtained by performing oblique photography on the model after establishing a river / canal water surface ratio model. (Reference) Figure 5 As shown, when a drone takes low-altitude photos of the ground, the angle between the optical axis of the airborne lens and the horizontal plane is α, which can be a commonly used angle such as 45 degrees. Because the width of actual rivers and canals varies greatly, it is difficult to obtain standardized template sections of canal with uniform spacing. To facilitate modeling, this invention uses rectangular thin sheets to create river and canal surface models of various specifications, such as... Figure 6A As shown.
[0146] In offline mode, a drone is used to collect images of the constructed river / canal surface model and form a sample set. This sample set is then used to train the river / canal surface width prediction model. The river / canal surface model uses rectangular slices. The width of the rectangular slices is a first preset multiple S1 of the actual river / canal surface width, and the length of the rectangular slices is a second preset multiple S2 of its width, to form a model that conforms to a segment of the actual river / canal. The multiples S1 and S2 are set according to the drone's cruising flight altitude and camera resolution. The width range of different rectangular slices used in the river / canal surface model corresponds to S1 times the common width range of the river / canal, and the width difference (spacing) between different rectangular slices corresponds to S1 times the preset river / canal surface width difference SD. For example, when the flight altitude is 100 meters, the sampling altitude for the model is 2 meters, thus ensuring that the river / canal surface model occupies a significant portion of the image space during imaging. This coordinates the image resolution with the recognition accuracy of the river / canal surface width prediction model and eliminates the need for the drone to specifically lower its altitude to predict the river / canal surface width, thereby improving the applicability of the prediction.
[0147] Preferably, the first preset multiple S1 is between 1 / 50 and 1 / 30, and the minimum value of the second preset multiple S2 is between 3 and 7. Preferably, the preset difference in the width of the canal surface SD is between 0.2 and 0.7 meters, and the widths of the rectangular sheets used in the canal model can form an arithmetic sequence with a common difference of multiple S1 of SD.
[0148] A model of the river surface was built under laboratory conditions, and the actual aerial photography altitude h was used. real and actual water surface width w real The aerial photography altitude h under laboratory conditions was obtained by scaling up the scale. model and water surface width W model To find the relationship between the water surface features of the canal and the width of the canal in the image, this embodiment selects the actual aerial photography altitude h of the UAV. real The corresponding aerial photography altitude h under laboratory conditions at 30m, 40m, and 50m respectively. model The corresponding sizes are 667mm, 889mm, and 1111mm, with the following scaling ratios:
[0149]
[0150] When constructing a river surface model in the laboratory, the majority of riverbeds are considered to be flat, meaning the natural slope of the river is less than 3 degrees. Because h model with h real The scaling ratio is 1:45. Because it is a proportional scaling, the width w of the river / canal water surface model is... model The actual width of the canal w realThe ratio is also 1:45. Then, models of river and canal surfaces of different widths are created with a step size of 10.5mm. The step size corresponding to the actual width of the river and canal surface is 0.5m. The created river and canal surface models are as follows: Figure 6A As shown. The width w of the river / canal water surface model. model The 105mm and 210mm models of the river and canal water surfaces were marked.
[0151] Because the images of the river / canal surface model were sampled from low-altitude oblique images, to ensure the diversity of features representing the river / canal surface model in the images and improve the generalization ability of the river / canal surface width prediction model network, the river / canal surface model was photographed from 0 degrees to 180 degrees. Simultaneously, to highlight the distance relationship between the UAV and the actual location of the river / canal, the river / canal surface model was arranged in different areas of the ground view, so that the river / canal surface models in the sample set were distributed within each grid cell of the nine-square grid formed by the top, middle, bottom, left, middle, and right sides of the image plane. (The last sentence appears to be incomplete and possibly refers to a different image.) model For example, at a focal length of 136.5mm, some of the captured datasets are as follows: Figure 6B As shown, to improve the accuracy of the model, a black ground was used as the background for the photo. For ease of display, the image has been inverted.
[0152] This invention subdivides the dimensions of a river / canal surface model to form a width sequence, and takes pictures from various relative angles during the sampling process of the river / canal surface model image, ensuring sufficient samples, thereby improving the generalization ability of the neural network and reducing the prediction error of the river / canal surface width.
[0153] For river and canal images captured based on a river and canal surface model, the acquired images are filtered and converted to grayscale, then binarized to form the target image of the river and canal. Edge detection is then used to obtain the river and canal edge image. Taking a river and canal surface model image taken at a certain location from a laboratory sampling height h = 667 mm as an example, the preprocessing results at each stage are as follows: Figure 6C As shown, the left and right sides correspond to the binarization and edge detection results, respectively. A Hough line transform is applied to the river edge image after Canny edge detection; the transformed image is shown below. Figure 6D As shown, the left and right images are the Hough line transformation results for river surface models with widths of 105mm and 136.5mm, respectively. Then, a heuristic search is performed on the transformed lines to select the two longest line segments as the two straight sides of the river channel, i.e., the two straight sides of the river surface. Figure 6D In the middle, there are two long straight lines after excluding the short lines that are close to the horizontal direction.
[0154] See Figure 7As shown, for each model image, four geometric features are calculated for the two edges: their slopes k1 and k2, and the perpendicular distances D1 and D2 from the image center point to the two edges. The corresponding actual width of the canal surface is recorded as the true value of the canal surface width. These geometric features and the true values of the canal surface width are used to form samples. After collecting and recording these samples to form a sample set, they are input into a neural network-based canal surface width prediction model for offline training. Preferably, the sample set can be stored by using the true values of the input and output quantities as records, forming a data table.
[0155] The BP neural network used in the river and canal water surface width prediction model in this invention is, for example... Figure 4A As shown, its model is a three-layer structure including one hidden layer, wherein,
[0156] The output of the j-th node in the hidden layer is
[0157] The output of the first node in the output layer is
[0158] In the formula, f() is taken as the tansig function, w ij and v j These are the connection weights from the input layer to the hidden layer and the connection weights from the hidden layer to the output layer, respectively. j b and are the thresholds for the hidden layer and output layer, respectively. m = 4 is the number of input variables, and k is the number of hidden layer nodes. Gradient descent is used for network training.
[0159] When predicting the width of a river or canal surface online, the width of the river or canal surface is predicted based on four geometric features obtained from the river or canal surface model image. The prediction model then maps the width of the river or canal surface back to the actual width of the river or canal surface based on the ratio of the model height to the actual shooting height, which is then used as the actual output value.
[0160] Preferably, multiple neural network-based river / canal width prediction models are created in the host unit, each corresponding to a flight altitude and an overhead view angle of the image acquisition unit. When predicting the river / canal width online, the geometric features obtained after current acquisition and processing are input into the river / canal width prediction model corresponding to the flight altitude and overhead view angle at the time of acquisition, and the model output value is used as the predicted river / canal width value. In this embodiment, the shooting altitude h of the river / canal model is selected as 667mm, 889mm, and 1111mm, and the shooting angle is 45 degrees.
[0161] Sample datasets with heights of 667mm, 889mm, and 1111mm were randomly divided into training and test sets. Both sets included 17 different canal surface models. The geometric features of the test set were used as input to the trained network model to obtain predicted values. The fitting curves comparing the predicted and actual widths of the canal surface models at different heights are shown below. Figure 9A , Figure 9B As shown, their h values are 889 mm and 1111 mm, respectively, and the performance of the test set is shown in Table 1.
[0162] Table 1 Performance test results of the river / canal water surface width prediction model
[0163]
[0164] The regression results were analyzed at three different laboratory heights, and the coefficients of determination R0 were calculated for each of the three different heights. 2 The coefficients of determination were 0.99709, 0.99821, and 0.99912, respectively. The closer the coefficient of determination is to 1, the better the regression performance, indicating that the model width prediction model has high reliability at all three heights. The root mean square errors (RMSE) at the three different heights were 2.2156, 2.0322, and 1.8352, respectively, indicating that the predicted values are close to the actual values, and the network model has good generalization ability.
[0165] Example 2
[0166] Based on the previous embodiment, such as Figure 2 As shown, this embodiment provides a low-altitude photography river / canal width identification system 1000 using the method of the present invention, which includes: an image acquisition unit 500 for image sensing and acquisition of river / canal scenes, a user interface unit 200 for parameter input and operation and display of river / canal width information, a server 400 for data management and information transmission, a handheld terminal 300 for remote operation and interaction of river / canal width information, and a host unit 100 connected to the user interface unit 200, the server 400, and the image acquisition unit 500.
[0167] The host unit 100 includes an input / output module 130, a processor 110, and a storage module 120, and is configured to: acquire low-altitude photographic images of a river canal; determine a region of interest (ROI) containing the river canal in the river canal image; determine a color threshold based on the value ranges of the three color channels extracted from the center of the ROI region; use pixels whose colors conform to the color threshold range as foreground objects and non-foreground object regions as background objects; set all background objects in the river canal image to zero to form a binary image of the river canal; and detect all connected components based on the connectivity of the foreground object pixels. The largest connected component is selected as the river / canal water body region, and the river / canal target image is formed using only the river / canal water body region as the foreground object. The river / canal target image is then processed by edge detection to obtain the river / canal edge image. After performing Hough line transform on the river / canal edge image, a heuristic search is used to obtain the canal water edge image containing the two straight sides of the canal water. The geometric features of the straight sides of the river / canal water surface relative to the image center are obtained from the canal water edge image. The geometric features are then input into a trained neural network-based river / canal water surface width prediction model to obtain the predicted value of the river / canal water surface width, and the predicted width value is then output.
[0168] Preferably, the low-altitude photography river / canal width identification system 1000 may not include the server 400 and handheld terminal 300, but instead connects the low-altitude photography river / canal width identification system to the server 400 and handheld terminal 300 via a network during application. The low-altitude photography river / canal width identification system 1000 may also include a positioning unit 700 for coordinate acquisition.
[0169] Preferably, the low-altitude photography river and canal width identification system 1000 further includes a flight control platform 600. In response to user operations on the operation panel 220 or instructions from the host unit 100, the flight control platform 600 executes instructions to fly and turn toward a specified location or river / canal point.
[0170] The system continuously captures low-altitude photographs of river scenes using drones, and the low-altitude river width identification system 1000 iteratively acquires images and detects the river width based on the acquired images. Preferably, the overlapping range of successively processed river scene images is not less than a set ratio, according to the flight speed and frame rate. Preferably, multiple images can also be stitched together using feature point alignment, and the river width is identified based on the stitched image.
[0171] Preferably, after acquiring oblique photographic images of the river scene in segments, the width of each segment is calculated as a ratio to a preset width threshold. When the ratio is greater than a set high threshold, an alarm is issued, indicating that the river width at that point exceeds the warning level and flood prevention is needed. When the ratio is less than a set low threshold, an alarm is issued, indicating that the water surface width at that point is too small and drought prevention is needed or water leakage may occur.
[0172] Preferably, after detecting the width of the canal segment by segment, the width information of each segment of the canal is marked at the corresponding position in the canal image, such as by using an arrow to mark the straight line between the two banks of the canal segment; preferably, the obtained coordinate and position information, as well as the water surface width information of the canal segment, are stored in a list in the storage module, and the list information can be stored in the cloud server.
[0173] Preferably, when drones are used in a multi-drone, multi-terminal group system, the system can have multiple handheld terminals and drone platforms. Through a server, the host unit can send messages about the width of the river channel to remote clients deployed on handheld terminals, etc. Preferably, an MQTT server can be deployed to push messages to clients subscribed to the topic. Multiple devices can subscribe to multiple topics simultaneously, and when a message is published, all devices subscribed to the same topic will receive the same message. The publish-subscribe pattern is a messaging pattern that decouples the client sending the message (publisher) from the client receiving the message (subscriber), so that they do not need to establish direct contact or be aware of each other's existence.
[0174] The server provides subscription and publish services. The host unit is also configured to: subscribe to the topic of obtaining river and canal water surface information from the handheld terminal, and in response to the topic message, transmit the detected river and canal water surface width and corresponding coordinates and location information to the handheld terminal through the server; or when the width of the river and canal water surface is detected to reach a set width threshold, transmit the river and canal water surface width and corresponding coordinates and location information to the server in the form of a width event topic message.
[0175] Preferably, the user interface unit is equipped with an operation panel for parameter input and a display screen for assisting parameter input and displaying the river / canal water surface width recognition results in a list format; the host unit also displays the recognized river / canal water surface width in segments on the display screen in the form of curves, and marks the coordinates and positions corresponding to the recognized widths on the curves.
[0176] Preferably, the positioning unit in the system also acquires heading information, and records and identifies the orientation identified based on the heading, such as due north, and the orientation corresponding to the centerline of the canal between the two sides of the canal in the output location information.
[0177] Preferably, the host unit can also communicate directly with the handheld terminal. The host unit can be a local control unit deployed separately on the ground, or it can be a control unit deployed on a drone platform. When deployed on a drone platform, the host unit on the drone platform performs edge calculations for online river and canal width prediction.
[0178] In Example 1, to locate the actual river / canal water body within the ROI rectangular area, this example also employs a flood filling method for extraction. The water body extraction module's water body extraction unit selects a seed point from the center of the obtained ROI area and extracts the river / canal water body area from the oblique photographic image through flood filling processing.
[0179] The flood fill method segments images by finding matching regions based on the differences in pixel grayscale values. Imagine the grayscale values of an image as the height of a pixel; an image can be viewed as a rugged terrain or mountainous area. Pouring water onto a lower point will cover areas below a certain height. The flood fill method utilizes this principle; it's a seed-point-based image processing method. It starts from a seed point and spreads outwards to neighboring pixels, marking matching pixels with a specified color or value.
[0180] Observation of the river and canal images revealed that the pixel values of the areas containing the water body were very similar. Therefore, seed points were established in the regions representing the river and canals, and the river and canal regions were selected using a flood filling method. Specifically, refer to... Figure 10 As shown, a target classification model based on a deep learning network locates the ROI region of the river channel using anchor boxes, i.e., rectangular boxes. Then, a sub-point is set at the intersection of the two diagonals corresponding to the rectangular box. After flooding, the water body region of the river channel is obtained. After setting the pixels outside the obtained water body region to zero, a binarized image of the river channel water body is formed.
[0181] In the same region as Example 1, this example also establishes another model for predicting the width of a canal surface. In the BP neural network, the input layer receives six input quantities from the general processing module: the slopes k1 and k2 of the straight lines on both sides of the canal surface, the perpendicular distances D1 and D2 from the image center point to the straight lines on both sides of the canal surface, and the flight altitude and overhead angle during acquisition. The output of the output layer is the width of the canal surface. After establishing this neural network structure, the input quantities of each sample in the training set are supplemented. After supplementing a sufficient number of samples from different heights and overhead angles, the new training sample set is used to train the model. In online applications, the new model can further simplify the image sampling requirements for canal prediction; it utilizes the generalization performance of neural networks to reduce the number of models required for canal surface width prediction and also simplifies the system structure, enabling one model to cover different flight sampling scenarios, further improving the applicability of the system.
[0182] Example 3
[0183] Based on the above embodiments, this embodiment provides a flight control method for determining the width of river / canal surface during low-altitude photography, including the following steps:
[0184] R1. Initialize and establish a river and canal water surface width prediction neural network to map the geometric features of the straight line edge of the river and canal water surface in the low-altitude photography image to the river and canal water surface width. After collecting training samples, train the river and canal water surface width prediction neural network to obtain the trained river and canal water surface width prediction model.
[0185] R2. In flight, responding to the command to identify the width of the river or canal surface, perform low-altitude oblique photography of the field river or canal scene to obtain river or canal images;
[0186] R3. In the river and canal image, determine the ROI region containing the river and canal. Extract the three color channels from the center of the ROI region to determine the color threshold. Use the pixels whose colors match the color threshold range as the foreground objects. Set all non-foreground object regions in the river and canal image to zero to form a binary image of the river and canal.
[0187] R4. Based on the connectivity of the foreground object pixels, detect all connected regions and select the largest connected region as the river / canal water body region, and form the river / canal target image using only the river / canal water body region as the foreground object.
[0188] R5. For the target image of the river channel, after obtaining the edge of the river channel through edge detection, Hough transform is performed, and the image of the water edge line containing the two straight edges of the water surface of the river channel is obtained through heuristic search.
[0189] R6. Based on the two edges obtained from the canal edge image, calculate the geometric feature quantities of each edge relative to the image center.
[0190] R7. Input the obtained geometric feature quantities into the river / canal water surface width prediction model to obtain the predicted value of the river / canal water surface width, and output the predicted width value.
[0191] R8. Determine whether the current water surface width exceeds the preset threshold range of the water surface width of the segment. If so, issue an over-limit alarm.
[0192] R9. Determine whether the task of determining the width of the river / canal surface has been exited. If yes, proceed to step R11; otherwise, proceed to step R10.
[0193] R10. Fly along the two side lines of the river and canal surface. When the overlap between the current image and the previous frame of the river and canal image is less than a certain proportion, issue a river and canal surface width recognition command and proceed to step R2.
[0194] R11, End low-altitude photography, river and canal water surface width identification, flight control.
[0195] Combination Figure 2 , Figure 3A , Figure 4B As shown, a low-altitude photography river / canal water surface width identification flight controller 100, employing the low-altitude photography river / canal water surface width identification flight control method of the present invention, includes a processor 110, a storage module 120, and an input / output module 130. The processor 110 includes a general processing module 111, a water area extraction module 112, a geometric feature extraction module 113, an iterative learning module 114, and a river / canal water surface width prediction module 115. The general processing module 111 responds to messages and user interface unit operations, initiates the identification of the river / canal in the acquired river / canal images, schedules the identification processing flow, inputs the real-time acquired river / canal images into the water area extraction module 112, outputs the width data identified and predicted by the river / canal water surface width prediction module 115, and sends flight direction commands to the flight control platform through the output unit.
[0196] Combination Figure 3A , Figure 4B As shown, the river and canal image is input to the controller via the input unit 131 in the input / output module 130; the river and canal water surface width prediction model established in the river and canal water surface width prediction module 115 has its input layer receiving the geometric features of the river and canal extracted from the river and canal image by the geometric feature extraction module 113 from the general processing module 111, and its output layer transmitting the data to the iterative learning module 114 and the general processing module 111 via the first connection array 1141 and the second connection array 1142, respectively.
[0197] When training the river / canal water surface width prediction model offline, the iterative learning module 114 adjusts the connection weights of the network based on the actual value of the river / canal water surface width input by the general processing module 111 and the river / canal water surface width prediction model through the first connection array 1141 and the output value of the neural network in the model, respectively. In the field environment, the first connection array 1141 is disconnected, and the neural network of the river / canal water surface width prediction model predicts the water surface width in the current river / canal image and outputs it to the general processing module 111 through the second connection array 1142. After being processed and analyzed by the general processing module 111, it is output through the output unit 132 in the input / output module 130.
[0198] The iterative training steps include: STEP1, initializing the network weights and biases; STEP2, reading the network parameters and the training sample set previously written to the document; STEP3, normalizing the sample data; STEP4, calculating the error between the predicted output value and the expected value for each sample; STEP5, back-calculating and correcting the network weights and biases; STEP6, ending training if the conditions for ending network training are met, otherwise returning to STEP4 to continue training; STEP7, result analysis and output.
[0199] The general processing module 111 in the controller also obtains the coordinate and orientation information of the current location of the canal through the positioning unit. After identifying the width of the canal, it outputs the width of the canal and the corresponding coordinate and orientation information through the output unit 132.
[0200] like Figure 15B As shown, after identifying the width of the canal surface, the width is also marked in the corresponding area of the canal image, with arrows indicating the width direction. Preferably, the acquired coordinates and location information, as well as the width of the canal surface, are stored in a list in the storage module 120, and the list information can be stored in the cloud server 400.
[0201] When the width of the water surface exceeds the preset upper and lower limits of the canal water surface width threshold, an alarm is issued, indicating that the canal water surface width has exceeded the limit. During the drone's flight, iterative low-altitude image acquisition is continuously performed, and width prediction processing is conducted based on the acquired images in preset sections. When the width in any preset section exceeds its corresponding preset width threshold, a water surface width exceeding the limit warning is issued. Preferably, the overlap range of successively processed canal images is not less than a set ratio, based on the flight speed and frame rate.
[0202] This invention provides a low-altitude photography method for determining the width of river and canal surfaces, which is also applied to monitoring the width of water surfaces in sections with approximately parallel banks, common in most rivers. To this end, step R2 involves obtaining an inverse perspective transformation matrix based on the sampling height and pitch angle during low-altitude oblique photography of the river and canal scene. In step R4, the binarized river and canal target image is converted into a real-world binary image of the river and canal based on the inverse perspective transformation matrix. In step R5, edge detection and Hough line transformation are performed on the real-world binary image of the river and canal, and a heuristic search is used to obtain an image of the canal water edge lines containing the two straight edges of the river and canal surface. Then, the angle or slope of the two edges of the river and canal surface is calculated. If they are close, the process proceeds to step R6; otherwise, the river and canal water surface edges are marked as not parallel and the process proceeds to step R10. In step R10, it is first determined whether the river and canal water surface edges are parallel. If not, the flight continues along the river and canal in the direction parallel to the angle bisectors of the obtained two edges of the river and canal surface; otherwise, the flight continues along the direction of the two edges of the river and canal surface.
[0203] Preferably, in step R2, multiple images can be stitched together by aligning feature points, and the stitched image can be used as the current river canal image.
[0204] Preferably, in step R8, the width of the current segment of the canal is calculated as a ratio to a preset width threshold. When the ratio is greater than a set high threshold, an alarm is issued, indicating that the width of the canal exceeds the warning level and flood prevention is required. When the ratio is less than a set low threshold, an alarm is issued, indicating that the width of the canal is too small and drought prevention is required or water leakage may occur.
[0205] This invention is applied to identify the width of river and canal surfaces in low-altitude UAV photography images. Through automatic identification of river and canal targets, seed points or regions of water targets are extracted, and the river and canal water bodies are automatically extracted. After region segmentation, river and canal edge detection, and shoreline extraction, the slope of the straight lines on both sides of the river and canal surface and the perpendicular distance from the image center point to the straight lines on both sides of the river and canal surface are used as geometric features and input into the established neural network-based river and canal surface width prediction model. The model can accurately predict the actual width of the river and canal surface, which serves as basic hydrological data and provides a basis for river and canal flow monitoring and drought and flood early warning.
[0206] The foregoing has described several embodiments of the present invention, but these embodiments are merely illustrative examples and do not limit the scope of the invention. These embodiments can be implemented in various other ways, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments or their variations are included within the scope or spirit of the invention, and are similarly included within the scope of the invention as described in the claims and its equivalents.
Claims
1. A method for determining the width of river and canal surfaces using low-altitude photography, comprising the following steps: S1. Initialization: Establish a neural network-based prediction model for the width of the river / canal surface. The input of the neural network is the geometric features of two parallel lines relative to the image center, and the output is the actual distance between the two parallel lines. The geometric features include four input quantities: the slopes k1 and k2 of the two lines, and the perpendicular distances D1 and D2 from the image center point to the two lines. S2. Construct a thin-sheet river / canal surface model with two parallel edges. In offline mode, use low-altitude oblique photography to collect images of river / canal surface models of different widths to form a sample set. Use the sample set to train the neural network. S3. Acquire river and canal images online at a certain height and pitch angle using low-altitude photography, and determine the ROI region containing the river and canal in the river and canal images; S4. Based on the color space characteristics of the central part of the ROI region, pixels in the river image with similar color space characteristics are taken as foreground objects, and non-foreground object regions are taken as background objects. S5. In the foreground object, based on pixel connectivity, find the largest connected region as the river / canal water body region, take the river / canal water body region as the foreground object, and set all non-foreground objects to zero to form the river / canal target image. S6. Obtain the river / canal edge image by edge detection of the target image of the river / canal; S7. After performing Hough line transform on the river edge image, the straight lines on both sides of the river water surface are obtained through heuristic search. S8. Obtain the geometric features of the straight lines on both sides of the river surface relative to the image center; S9. Input the geometric features into the trained river / canal water surface width prediction model to obtain the predicted value of the river / canal water surface width; S10. Output the predicted width value; S11. Check if there is an exit command. If there is, proceed to step S13; otherwise, proceed to step S12. S12. Proceed to step S3 after the width recognition command is triggered; S13, End of river width determination.
2. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, Step S2, when forming a sample, also includes: The collected images of the river and canal surface models are filtered and grayscaled, then binarized to form the target image of the river and canal, and then edge detection is performed to obtain the edge image of the river and canal. The Hough transform is applied to the river edge image, and the edge image containing the two straight lines of the river surface model is obtained through heuristic search. Geometric features of two edges relative to the image center are obtained from the edge image. The width of the current river / canal water surface model is recorded. The obtained geometric features and the recorded model width are combined to form a training sample.
3. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, After the Hough line transformation in step S7, a set of straight lines along the riverbank is obtained. In the heuristic search, two straight line segments with similar directions and angles, the largest mutual distance, and the longest length are selected from the obtained set of straight lines along the riverbank according to heuristic rules as the two straight lines on both sides of the river surface. The mutual distance is the minimum actual distance between points on one of the two line segments and points on the other line segment. The method for calculating the actual distance d between a point and points on a target line segment is as follows: if the line connecting the point to any endpoint of the target line segment forms an obtuse angle with the target line segment, then the actual distance d is the distance from the point to that endpoint; otherwise, the actual distance d is the perpendicular distance from the point to the target line segment, i.e., the vertical distance.
4. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, Step S1 further includes: establishing a target classification model based on the YOLOv5s network; after acquiring river and canal scene images by low-altitude photography using the overhead camera in the image acquisition unit, the network is trained offline using an image sample set composed of the river and canal scene images labeled with river and canal areas to obtain a target classification model for the river and canal scene. In step S3, the collected river and canal images are processed by the river and canal scene target classification model to obtain the anchor frame of the river and canal area, and the area within the anchor frame is taken as the ROI area of the river and canal.
5. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, The BP neural network used in the river / canal water surface width prediction model has a three-layer structure including one hidden layer. The output of the j-th node in the hidden layer is The output of the first node in the output layer is Where f() is taken as the tansig function, w ij and v j These are the connection weights from the input layer to the hidden layer and the connection weights from the hidden layer to the output layer, respectively. j b and are the thresholds for the hidden layer and output layer, respectively. m = 4 is the number of input variables, and k is the number of hidden layer nodes. Gradient descent is used for network training.
6. The method for identifying the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, The geometric characteristics of a straight line are calculated as follows: Assuming the coordinates of the two endpoints of the line are (x1, y1) and (x2, y2), then its slope is k = y1 - y2 / x1 - x2; The perpendicular distance from the image center to the line is In the formula, (x0, y0) represents the coordinates of the center of the image, A and B are the coefficients of the general form of the equation of a straight line, and C is a constant term and: A = y2 - y1, B = x1 - x2, C = -x1(y2 - y1) + y1(x2 - x1); Based on the formulas for k and d, the slopes k1 and k2 of the two lines, as well as the perpendicular distances D1 and D2 from the center point of the image to the two lines, are calculated as four quantities as geometric features.
7. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, In step S2, training the neural network used as the prediction model for the width of the river channel includes: T1, initializing the weights and biases of the network; T2, reading the network parameters and the training sample set recorded in the document; T3, normalizing the sample data; T4, calculating the error between the predicted output value and the expected value for each sample; T5, recalculating and correcting the network weights and biases based on the error; T6, if the conditions for ending network training are met, ending the training; otherwise, proceeding to T4 to continue training; T7, analyzing and outputting the results.
8. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, Step S2 further includes: arranging the river and canal surface models in different areas of the ground under the oblique photography field of view, so that the river and canal surface models in the sample set are distributed in each grid of the nine-square grid formed by the top, middle, bottom, left, middle, and right sides of the image plane.
9. The method for determining the width of river / canal surface using low-altitude photography according to claim 1, characterized in that, Multiple neural networks are used as the prediction model for the width of the river and canal, and each prediction model corresponds to a flight altitude and an overhead angle when the river and canal image is obtained by low-altitude photography. The river and canal width prediction model used in step S9 corresponds to the river and canal width prediction model neural network corresponding to the flight altitude and overhead angle when acquiring river and canal images in low-altitude photography in step S3.
Citation Information
Patent Citations
River width extraction method by utilizing rivermeter
CN114167412A
Floating type river width measuring instrument, river width measuring method and measured data transmission method
CN116697992A
Natural river ecological flow real-time monitoring method based on tower footing video
CN117723119A
Flood early warning method and system for field rivers in arid region
CN117935486A
River water level intelligent identification algorithm based on deep learning
CN114677594A
