A method for calculating river ice surface area and flow velocity based on shore-based fixed camera
By constructing a monocular camera field-of-view model adapted to river scenarios and semantic segmentation of ice condition images, the problems of low accuracy and high cost in river ice area monitoring were solved, and accurate quantitative calculation and real-time monitoring of river ice area and flow velocity were realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU NANSHUI WATER AFFAIRS TECH CO LTD
- Filing Date
- 2026-04-14
- Publication Date
- 2026-07-24
AI Technical Summary
Existing river ice area monitoring technologies suffer from high costs, difficult deployment, low measurement accuracy, and inability to accurately convert pixels into physical distances, thus failing to meet the quantitative measurement needs of water conservancy monitoring.
A monocular camera field-of-view model adapted to river scenarios is constructed. Combined with an ice condition image semantic segmentation model, accurate mapping between pixel coordinates and physical coordinates is achieved. Distance transformation is performed using the principle of triangle similarity and trigonometric function calculation formulas. The river ice flow velocity is calculated using a Gaussian mixture model.
It enables precise quantitative calculation of river ice area and flow velocity, reduces equipment costs and deployment difficulty, and achieves long-term, real-time, and accurate monitoring of river ice conditions.
Smart Images

Figure CN122454499A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to hydrological and meteorological monitoring and image recognition processing technology, specifically to a method for calculating the ice surface area and flow velocity of a river based on a shore-based fixed camera. Background Technology
[0002] Due to the influence of high-latitude climate, northern my country, especially the Ningxia-Inner Mongolia section and downstream section of the Yellow River, the middle and lower reaches of the Ergun River (a tributary of the Heilongjiang River), and the Jiamusi section of the lower reaches of the Songhua River, is prone to ice jam disasters every spring when temperatures rise during the river thawing season. These ice jams occur when the ice melts in the upper reaches of the river before the riverbed thaws in the lower reaches. This leads to rising water levels and triggers the risk of dike breaches [Tian Fuchang, Wang Yanpeng, Wang Xiujie. Risk classification and distribution characteristics of ice jam floods in the Ningxia-Inner Mongolia section of the Yellow River [J]. People's Yellow River, 2021, 43(2): 49-52. Chen Jin. Flood control situation, characteristics and strategies in China [J]. Science, 2020, 72(5): 27-31.], posing a great threat to the lives and property of the people.
[0003] River ice monitoring is a crucial link in water conservancy projects for disaster prevention and mitigation, navigation safety, and hydrological data collection. Core parameters such as river ice coverage area, ice floe velocity, and ice surface coverage rate are important bases for judging the degree of river freezing, ice jam risk, and ice floe drift. River ice monitoring can be carried out from three dimensions: "sky, air, and ground." "Sky" sensing involves acquiring large-scale watershed ice remote sensing images via satellite to extract ice information. Its advantage lies in analyzing ice change patterns over a large spatiotemporal scale. However, its disadvantages include the high cost and complex deployment of radar monitoring equipment, as well as cumbersome post-processing of data, making it difficult to widely promote in small and medium-sized rivers and remote water areas. "Air" sensing utilizes drones to capture high-altitude river ice images. In patrol or emergency special measurement missions, it can perform ice information extraction tasks at any time and place within a small spatiotemporal scale.
[0004] Chinese patent application CN 119228871 A proposes a method for calculating the proportion of ice-covered river area based on unmanned aerial vehicles (UAVs). This method divides ice surface video into several video segments, then uses a segmentation model to extract all frames from each video segment, obtaining the floating ice mask and river mask in the image. Based on the pixel areas of the floating ice mask and the river mask corresponding to each frame, an estimated range for the proportion of ice-covered area is calculated. However, UAV aerial photography is limited by factors such as weather, flight endurance, and airspace control, making long-term stable operation difficult. Furthermore, it can only roughly estimate the proportion of ice surface area on the river channel, failing to accurately obtain the actual ice surface area and floating ice flow velocity. Ground-based sensing, by setting up corresponding hydrological data acquisition equipment at fixed locations along the river cross-section, can collect real-time hydrological data such as water level, flow rate, wind force, wind direction, water temperature, precipitation, and evaporation. It can also collect ice condition elements such as surface ice density, area, ice velocity, ice pressure, ice thickness, ice type, and ice distribution through precision measuring instruments or monitoring cameras.
[0005] Ground-based fixed camera monitoring is an effective means of real-time river ice condition monitoring. Fixed cameras have advantages in real-time performance and stable viewing angles. For large-scale viewing, a network of fixed cameras deployed at multiple different river cross-sections within a watershed can achieve large-scale river ice condition monitoring. However, current ground-based fixed camera monitoring can mostly only achieve pixel-level segmentation of the ice surface and water body, failing to accurately convert pixel distance to actual physical distance. This results in significant errors in the calculation of river ice area, allowing only qualitative analysis and failing to meet the actual needs of quantitative calculation in water conservancy monitoring. Furthermore, it has poor adaptability to special scenarios such as irregular river views, dynamic changes in water flow, and camera pitch angle offsets. There is a lack of a complete system for constructing a field-of-view model and converting physical distances suitable for river ice condition monitoring. The calculation of actual river ice area lacks reliable mathematical support, severely restricting the application of visual monitoring technology in the field of quantitative river ice monitoring.
[0006] Therefore, developing a low-cost, easy-to-deploy, and accurate method that can accurately map pixel coordinates to actual physical coordinates using a monocular camera, thereby enabling real-time quantitative calculation of river ice area, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] Purpose of the invention: To address the shortcomings of existing river ice area monitoring technologies, such as high cost, difficult deployment, low measurement accuracy, and inability to accurately convert pixels to physical distance, this invention provides a method for calculating river ice surface area and flow velocity based on a shore-based fixed camera. By constructing a monocular camera field-of-view model adapted to the river scene, a mapping relationship between image pixel coordinates and actual physical coordinates of the river is established. Combined with the semantic segmentation results of ice condition images, the method achieves accurate quantitative calculation of the actual area of river ice and ice surface coverage, solving the technical problem that traditional visual monitoring cannot quantitatively measure ice conditions. At the same time, it reduces equipment costs and deployment difficulty, enabling long-term, real-time, and accurate monitoring of river ice conditions.
[0008] Technical solution: The present invention provides a method for calculating the ice surface area and flow velocity of a river channel based on a shore-based fixed camera, comprising the following steps:
[0009] Step 1: Install a monocular surveillance camera on the riverbank. First, determine the camera's installation height h, vertical field of view α0, and horizontal field of view. The camera's tilt angle γ0, the height H of the camera's monitoring area, and the width W of the camera's monitoring area are defined. Then, a spatial coordinate system and an image plane coordinate system are defined, and a river channel field of view model is constructed based on the camera's projection geometry.
[0010] Step 2: Based on the principle of triangle similarity and the calculation formula of trigonometric functions, calculate the imaging formula of the monocular camera in the X and Y axis directions, construct the mapping relationship between any physical field coordinate point in the river channel and the image pixel field coordinate point, and realize the conversion between pixel distance and physical distance;
[0011] Step 3: Employ a deep learning-based ice condition image semantic segmentation model to automatically perform target detection and recognition, pixel-by-pixel semantic extraction and segmentation on the images captured by the camera. The ice condition image semantic segmentation model uses the TS-MaskFormer network model to segment real-time river images captured by a monocular camera, accurately identifying ice surface areas, water areas, and background in the image and performing image semantic segmentation. The TS-MaskFormer network model here can accurately identify ice surface areas, water areas, and background in the image.
[0012] Step 4: Count the number of pixels on the ice surface of the river channel in the image. Number of pixels in the water body and the number of pixels in the background The proportion of ice surface in the river channel, C, is calculated. Combined with the actual physical size of the river channel field of view calculated by the river channel field of view model, the actual physical area of ice surface in the river channel, S, is obtained by the relationship between ice surface coverage and actual river channel area.
[0013] Step 5: Construct a Gaussian mixture model to achieve multi-target dynamic tracking of river ice, and calculate the centroid based on the detected river ice contours to obtain the flow velocity of each detected target river ice. Finally, the average flow velocity of all ice surfaces was calculated.
[0014] Furthermore, the method for constructing the river channel field-of-view model in step 1 includes:
[0015] Step 11: Define the visible area of the camera device with the optical center of the camera lens as the center point, and mark the optical axis direction with the line connecting the optical center of the camera and the intersection of the river surface; construct the three-dimensional coordinate system of the camera with the intersection as the origin of the spatial coordinate system, the direction of water flow as the X-axis, the direction perpendicular to the horizontal direction of water flow as the Y-axis, and the direction of the camera column as the Z-axis.
[0016] Step 12: Construct a physical river channel plane coordinate system with the mapping point of the intersection of the camera's optical center and the river surface as the origin, the direction of water flow as the x-axis, and the direction perpendicular to the horizontal direction of water flow as the y-axis; mark the corresponding areas of the camera's visible range in the river channel plane coordinate system; define the coordinates of any point P in the camera's three-dimensional coordinate system. Mark its corresponding point in the river channel plane coordinate system. ;
[0017] Step 13: Perform projection transformation calibration on the camera's three-dimensional coordinate system to achieve the conversion between its coordinate system and the river channel's planar coordinate system. The conversion formula is as follows:
[0018] ;
[0019] ;
[0020] ;
[0021] Where Xp, Yp are the coordinates of the pixel in the original image, Xp', Yp' are the coordinates of the pixel in the calibrated image, and T is the homography matrix of the transformation coefficients. 11 ~T 13 Indicates the transformation of the x-coordinate after calibration, T 21 ~T 23 Indicates the transformation of the y-coordinate after calibration, T 31 ~T 33 Nonlinear correction transform coefficients for perspective distortion.
[0022] Furthermore, step 2, the mapping relationship between physical field coordinate points and image pixel field coordinate points, includes:
[0023] Step 21: Calculate the physical coordinates along the Y-axis. The calculation formula is as follows:
[0024] ;
[0025] Where S is the vertical distance from point P to the X-axis in the monitoring image;
[0026] Step 22: Calculate the physical coordinates in the X-axis direction. The calculation formula is as follows: ;
[0027] in, Let P be the perpendicular distance from point P to the Z-axis;
[0028] Step 23: Obtain the coordinates of any point P within the camera's field of view using the following formula:
[0029] Coordinates of any point P: .
[0030] Furthermore, the specific calculation method for the river ice area in step 4 is as follows:
[0031] Step 41: Count the number of ice surface pixels in the image semantic segmentation results of step S3. Number of pixels in water body and the number of background pixels The ice surface coverage rate within the current field of view is calculated based on the pixel ratio. The calculation formula is as follows:
[0032] ;
[0033] Step 42: Combining the actual river length H and actual width W within the camera's field of view calculated by the monocular camera's field-of-view model, and the ice coverage C, calculate the actual ice area S within the field of view at the current moment. The formula is:
[0034] .
[0035] Furthermore, the specific method for calculating the average flow velocity of the river ice surface in step 5 is as follows:
[0036] Step 51: Using a Gaussian mixture model, each frame of the river ice condition video sequence is modeled at the pixel level. Multiple Gaussian distributions are used to represent the probability of gray value change of each pixel. The pixel value of the current frame is matched with the Gaussian distribution of the background model. Pixels with a matching degree lower than a preset threshold are classified as foreground, and pixels with a better matching degree are classified as background, thereby achieving separation of foreground and background in the image.
[0037] Step 52: Construct a synergistic processing method of morphological enhancement and multi-level noise suppression. Opening and closing operations are used to eliminate structural noise and repair topological defects in the ice condition image. Then, median filtering is used to remove residual discrete noise in the ice condition image. Finally, Gaussian smoothing is used to improve the continuity of image edges. This significantly improves the topological integrity of the foreground mask while ensuring the real-time performance of the algorithm.
[0038] Step 53: Calculate the gradient magnitude of the image using convolution operations. With direction information The calculation formula is:
[0039] ;
[0040] ;
[0041] Among them, S x and S y These are the convolution kernels of the Sobel operator in the horizontal and vertical directions, respectively, I x and I y Gx and Gy are the gradient components in the corresponding directions of the image, representing the horizontal and vertical gradients, respectively.
[0042] Step 54: Perform non-maximum suppression based on the gradient magnitude of any pixel e in the ice condition image. If the gradient magnitude of e is not a local maximum in a specific direction, set the gradient magnitude of e to 0. Then set the high threshold values respectively. and low threshold , the gradient value exceeds Pixels with gradient values lower than 0 are identified as strong edge feature points. The pixels are determined to be non-edge region points, and the gradient value is set in [ , Pixels that are within the range of strong edge points and have an eight-neighbor connectivity with strong edge points are identified as weak edge points. Points that do not meet the above characteristics are identified as noise, resulting in the final image edge pixel set E={e1,e2,...,e...}. n (n is the number of edge pixels)};
[0043] Step 55: Using the Suzuki contour tracking algorithm, based on the eight-neighbor clockwise search rule, sequentially access E={e1,e2,...,e...} n The search continues from adjacent edge points until the search originates, thus obtaining a closed ice block outline; a preset minimum effective area threshold A is used. min To avoid affecting area S min The search is performed on the fine outlines to eliminate the effects of noise such as spray and reflections, as well as small ice floes that are not of observation significance.
[0044] Step 56: Calculate the geometric moments of each closed ice floe profile using the following formula:
[0045] ;
[0046] In the formula, I(x,y) is the pixel value of the binarized image at coordinates (x,y), p+q is the order of the moment, and m is the first moment. 10 and m 01 This characterizes the distribution features of the contour on the coordinate axes; after normalization, the coordinates of the contour center are obtained.
[0047] ;
[0048] ;
[0049] The center coordinates represent the position of the centroid of the profile and are translationally invariant.
[0050] The displacement of the contour mass point can be calculated from adjacent consecutive frames; let the centroid coordinates of the t-th frame be P1 (X′). p1 , Y′ p1 The centroid coordinates of frame t+1 are P2 (X′). p2 Y p′2 If the displacement d is such that the displacement d is less than or equal to the displacement d, then the displacement d can be calculated using the Euclidean distance formula:
[0051] ;
[0052] The formula for calculating the velocity of the river ice target for each contour is as follows:
[0053] ;
[0054] fps is the video frame rate, which represents the number of frames played per second.
[0055] Step 57: Calculate the average flow velocity of all ice floe outline targets as the average river ice flow velocity for the current frame.
[0056] Beneficial effects: This invention constructs a monocular camera field-of-view model adapted to river scenarios, establishes a mapping relationship between image pixel coordinates and actual physical coordinates of the river, and combines the semantic segmentation results of ice condition images to achieve accurate quantitative calculation of the actual area of river ice and ice surface coverage. This solves the technical problem that traditional visual monitoring cannot quantitatively measure ice conditions, while reducing equipment costs and deployment difficulty, and enabling long-term real-time accurate monitoring of river ice conditions. Attached Figure Description
[0057] Figure 1 This is a schematic diagram of the overall workflow of the present invention;
[0058] Figure 2 This is a stereoscopic projection diagram of the camera in the embodiment;
[0059] Figure 3 For the example and Figure 2 A schematic diagram of the corresponding camera's projection plane;
[0060] Figure 4 These are the corresponding river parameters collected by the camera in the example;
[0061] Figure 5 This is the imaging model along the Y-axis in the embodiment;
[0062] Figure 6 This is the imaging model along the X-axis in the embodiment;
[0063] Figure 7 This is a schematic diagram of the river ice surface area calculated in the embodiment;
[0064] Figure 8 This is a schematic diagram illustrating the dynamic tracking of multiple ice targets in the river channel detected in the example.
[0065] Figure 9 This is a schematic diagram of the average movement speed of the ice surface in the river channel detected in the example. Detailed Implementation
[0066] The technical solution of the present invention will be described in detail below, but the scope of protection of the present invention is not limited to the embodiments described.
[0067] like Figure 1 As shown, the present invention provides a method for accurately calculating the ice surface area of a river channel based on a shore-based fixed camera, comprising the following steps:
[0068] Step 1: Install a monocular surveillance camera on the riverbank. First, determine the camera's installation height h and the camera's vertical field of view. Horizontal field of view of the camera Camera tilt angle The height H and width W of the camera monitoring area are defined; then, a spatial coordinate system and an image plane coordinate system are defined, and a river channel field of view model is constructed based on the camera projection geometry.
[0069] Step 2: Based on the principle of triangle similarity and the calculation formula of trigonometric functions, calculate the imaging formula of the monocular camera in the X and Y axis directions, construct the mapping relationship between any physical field coordinate point in the river channel and the image pixel field coordinate point, and realize the conversion between pixel distance and physical distance;
[0070] Step 3: Employ a deep learning-based ice condition image semantic segmentation model to automatically perform target detection and recognition, pixel-by-pixel semantic extraction and segmentation on the images captured by the camera. The ice condition image semantic segmentation model uses the TS-MaskFormer network model to segment real-time river images captured by a monocular camera, accurately identifying ice surface areas, water areas, and background in the image and performing image semantic segmentation. Here, the TS-MaskFormer network model can accurately identify ice surface areas, water areas, and background in the image.
[0071] Step 4: Count the number of pixels on the ice surface of the river channel in the image. Number of pixels in the water body and the number of pixels in the background The proportion of ice surface in the river channel, C, is calculated. Combined with the actual physical size of the river channel field of view calculated by the river channel field of view model, the actual physical area of ice surface in the river channel, S, is obtained by the relationship between ice surface coverage and actual river channel area.
[0072] Step 5: Construct a Gaussian mixture model to achieve multi-target dynamic tracking of river ice, and calculate the centroid based on the detected river ice contours to obtain the flow velocity of multi-target river ice; finally, calculate the average flow velocity of the river ice surface based on the ST-LK pyramid optical flow method.
[0073] Furthermore, the method for constructing the river channel field-of-view model in step 1 includes:
[0074] Step 11, as follows Figure 1 As shown, with the optical center O of the camera lens as the center point, the visible range area ABCD of the camera device is defined. The optical axis direction is marked by the line OG connecting the optical center O of the camera and the intersection point G of the river surface. The three-dimensional coordinate system of the camera is constructed with the intersection point G as the origin of the spatial coordinate system, the direction of water flow as the X-axis, the direction perpendicular to the horizontal direction of water flow as the Y-axis, and the direction of the camera column as the Z-axis.
[0075] Step 12, as follows Figure 2 As shown, a physical river plane coordinate system is constructed with the mapping point g, where the optical center of the camera intersects the river surface, as the origin, the direction of water flow as the x-axis, and the direction perpendicular to the horizontal direction of water flow as the y-axis. The visible area of the camera is marked in the river plane coordinate system as regions a, b, c, and d. For any point P in the camera's three-dimensional coordinate system, its coordinates are defined. Mark its corresponding point in the river channel plane coordinate system. ;
[0076] Step 13: Perform projection transformation calibration on the camera's three-dimensional coordinate system to achieve the conversion between its coordinate system and the river channel's planar coordinate system. Figure 3 The conversion formula for the camera image shown is:
[0077] ;
[0078] ;
[0079] ;
[0080] in, These are the coordinates of the pixel in the original image. , These are the pixel coordinates in the calibrated image. T is the homography matrix of the transformation coefficients. [0.7692, 1.8690, 152.0306] represents the transformation of the x-coordinate after calibration, [0.15851 1.7309 -814.4399] represents the transformation of the y-coordinate after calibration, and [0.0008 0.0038 1] represents the nonlinear correction transformation coefficients for perspective distortion. Specific river parameters in this embodiment are as follows: Figure 4 As shown.
[0081] The mapping relationship between the physical field coordinates and the image pixel field coordinates in step 2 above includes:
[0082] Step 21, Y-axis imaging of the camera as follows Figure 5 As shown; based on the similarity of triangles, calculate the physical coordinates in the Y-axis direction using the following formula:
[0083] ;
[0084] Where S is the vertical distance from point P to the X-axis in the monitoring image;
[0085] Step 22, X-axis imaging of the camera as follows Figure 6 As shown; calculate the physical coordinates in the X-axis direction using the following formula: ;
[0086] in, The vertical distance from point P to the Z-axis;
[0087] Step 23: Obtain the coordinates of any point P within the camera's field of view using the following formula:
[0088] Coordinates of any point P: .
[0089] The specific calculation method for the ice area in the river channel in step 4 above is as follows:
[0090] Step 41: Calculate the number of ice surface pixels Pᵢ, water surface pixels Pw, and background pixels P in the image semantic segmentation results from step S3. b The ice surface coverage rate within the current field of view is calculated based on the pixel ratio. The calculation formula is as follows:
[0091] ;
[0092] Step 42: Based on the actual river length H and actual width W within the camera's field of view calculated using the monocular camera's field-of-view model, and the ice coverage C, calculate... Figure 7 The actual area S of the river ice in the field of view at the current moment is given by the formula:
[0093] .
[0094] The specific method for calculating the average flow velocity of the ice surface in step 5 of the river channel is as follows:
[0095] Step 51: Using a Gaussian mixture model, each frame of the river ice condition video sequence is modeled at the pixel level. Multiple Gaussian distributions are used to represent the probability of gray value change of each pixel. The pixel value of the current frame is matched with the Gaussian distribution of the background model. Pixels with a matching degree lower than a preset threshold are classified as foreground, and pixels with a better matching degree are classified as background, thereby achieving separation of foreground and background in the image.
[0096] Step 52: Construct a synergistic processing method of morphological enhancement and multi-level noise suppression. Opening and closing operations are used to eliminate structural noise and repair topological defects in the ice condition image. Then, median filtering is used to remove residual discrete noise in the ice condition image. Finally, Gaussian smoothing is used to improve the continuity of image edges. This significantly improves the topological integrity of the foreground mask while ensuring the real-time performance of the algorithm.
[0097] Step 53: Calculate the gradient magnitude of the image using convolution operations. With direction information The calculation formula is:
[0098] ;
[0099] ;
[0100] Among them, S x and S y These are the convolution kernels of the Sobel operator in the horizontal and vertical directions, respectively, I x and I y Gx and Gy are the gradient components in the corresponding directions of the image, representing the horizontal and vertical gradients, respectively.
[0101] Step 54: Perform non-maximum suppression based on the gradient magnitude of any pixel e in the ice condition image. If the gradient magnitude of e is not a local maximum in a specific direction, set the gradient magnitude of e to 0. Then set the high threshold values respectively. and low threshold , the gradient value exceeds Pixels with gradient values lower than 0 are identified as strong edge feature points. The pixels are determined to be non-edge region points, and the gradient value is set in [ , Pixels that are within the range of strong edge points and have an eight-neighbor connectivity with strong edge points are identified as weak edge points. Points that do not meet the above characteristics are identified as noise, resulting in the final image edge pixel set E={e1,e2,...,e...}. n (n is the number of edge pixels)};
[0102] Step 55: Using the Suzuki contour tracking algorithm, based on the eight-neighbor clockwise search rule, sequentially access E={e1,e2,...,e...} n The search continues until the adjacent edge points are returned to the starting point, thus obtaining the following: Figure 8 The diagram shows a closed ice block outline; the preset minimum effective area threshold A is also shown. min To avoid affecting area S min The search is performed on the fine outlines to eliminate the effects of noise such as spray and reflections, as well as small ice floes that are not of observation significance.
[0103] Step 56: Calculate the geometric moments of each closed ice floe profile using the following formula:
[0104] ;
[0105] In the formula, I(x,y) is the pixel value of the binarized image at coordinates (x,y), p+q is the order of the moment, and m is the first moment. 10 and m 01 This characterizes the distribution features of the contour on the coordinate axes; after normalization, the coordinates of the contour center are obtained.
[0106] ;
[0107] ;
[0108] The center coordinates represent the position of the centroid of the profile and are translationally invariant.
[0109] The displacement of the contour mass point can be calculated from adjacent consecutive frames; let the centroid coordinates of the t-th frame be P1 (X′). p1 , Y′ p1 The centroid coordinates of frame t+1 are P2 (X′). p2 Y p′2 If the displacement d is such that the displacement d is less than or equal to the displacement d, then the displacement d can be calculated using the Euclidean distance formula:
[0110] ;
[0111] The formula for calculating the velocity of the river ice target for each contour is as follows:
[0112] ;
[0113] fps is the video frame rate, which represents the number of frames played per second.
[0114] Step 57: Calculate the average flow velocity of all ice floe outline targets as the average river ice flow velocity for the current frame, such as... Figure 9 As shown.
[0115] As described above, although the invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the invention itself. Various changes in form and detail may be made without departing from the spirit and scope of the invention as defined in the appended claims.
Claims
1. A method for calculating the ice surface area and flow velocity of a river channel based on a shore-based fixed camera, characterized in that: Includes the following steps: Step 1: Install a monocular surveillance camera on the riverbank. First, determine the camera's installation height h and the camera's vertical field of view. Horizontal field of view of the camera Camera tilt angle The height H and width W of the camera monitoring area; Then, a spatial coordinate system and an image plane coordinate system are defined, and a river channel field of view model is constructed based on the camera projection geometry. Step 2: Based on the principle of triangle similarity and the calculation formula of trigonometric functions, calculate the imaging formula of the monocular camera in the X and Y axis directions, construct the mapping relationship between any physical field coordinate point in the river channel and the image pixel field coordinate point, and realize the conversion between pixel distance and physical distance; Step 3: Employ a deep learning-based ice condition image semantic segmentation model to automatically perform target detection and recognition, pixel-by-pixel semantic extraction and segmentation on the images captured by the camera. The ice condition image semantic segmentation model is based on the TS-MaskFormer network model to segment real-time river images captured by a monocular camera, accurately identifying ice surface areas, water areas and background in the images and performing image semantic segmentation. Step 4: Count the number of pixels on the ice surface of the river channel in the image. Number of pixels in the water body and the number of pixels in the background The proportion of ice surface in the river channel, C, was calculated. By combining the actual physical dimensions of the river channel field of view calculated by the river channel field of view model, the actual physical area S of the ice surface in the river channel is obtained through the relationship between the ice surface coverage rate and the actual area of the river channel. Step 5: Construct a Gaussian mixture model to achieve multi-target dynamic tracking of river ice, and calculate the centroid based on the detected river ice contours to obtain the flow velocity of each detected target river ice. Finally, the average flow velocity of all ice surfaces was calculated.
2. The method for calculating river ice surface area and flow velocity based on a shore-based fixed camera according to claim 1, characterized in that, The steps for constructing the river channel field-of-view model in step 1 include: Step 11: Define the visible area of the camera device with the optical center of the camera lens as the center point, and mark the optical axis direction with the line connecting the optical center of the camera and the intersection of the river surface; construct the three-dimensional coordinate system of the camera with the intersection as the origin of the spatial coordinate system, the direction of water flow as the X-axis, the direction perpendicular to the horizontal direction of water flow as the Y-axis, and the direction of the camera column as the Z-axis. Step 12: Construct a physical river channel plane coordinate system with the mapping point of the intersection of the camera's optical center and the river surface as the origin, the direction of water flow as the x-axis, and the direction perpendicular to the horizontal direction of water flow as the y-axis; mark the corresponding areas of the camera's visible range in the river channel plane coordinate system; for any point P in the camera's three-dimensional coordinate system, define its coordinates P(Xp, Yp), and mark its corresponding point P′(xp, Yp) in the river channel plane coordinate system. p ,y p ); Step 13: Perform projection transformation calibration on the camera's three-dimensional coordinate system to achieve the conversion between its coordinate system and the river channel's planar coordinate system. The conversion formula is as follows: ; ; ; Where Xp, Yp are the coordinates of the pixel in the original image, Xp', Yp' are the coordinates of the pixel in the calibrated image, and T is the homography matrix of the transformation coefficients. 11 ~T 13 Indicates the transformation of the x-coordinate after calibration, T 21 ~T 23 Indicates the transformation of the y-coordinate after calibration, T 31 ~T 33 Nonlinear correction transform coefficients for perspective distortion.
3. The method for calculating river ice surface area and flow velocity based on a shore-based fixed camera according to claim 1, characterized in that, The detailed method for constructing the mapping relationship between physical field coordinate points and image pixel field coordinate points in step 2 includes: Step 21: Calculate the physical coordinates along the Y-axis. The calculation formula is as follows: ; Where S is the vertical distance from point P to the X-axis in the monitoring image; Step 22: Calculate the physical coordinates in the X-axis direction. The calculation formula is as follows: ; in, The vertical distance from point P to the Z-axis; Step 23: Obtain the coordinates of any point P within the camera's field of view using the following formula: Coordinates of any point P: .
4. The method for calculating river ice surface area and flow velocity based on a shore-based fixed camera according to claim 1, characterized in that, The specific calculation method for the ice area in step 4 of the river channel is as follows: Step 41: Count the number of ice surface pixels in the image semantic segmentation results of step S3. Number of pixels in water body and the number of background pixels The ice surface coverage rate within the current field of view is calculated based on the pixel ratio. The calculation formula is as follows: ; Step 42: Combining the actual river length H and actual width W within the camera's field of view calculated by the monocular camera's field-of-view model, and the ice coverage C, calculate the actual ice area S within the field of view at the current moment. The formula is: S = C * H * W.
5. The method for calculating river ice surface area and flow velocity based on a shore-based fixed camera according to claim 1, characterized in that, The specific method for calculating the average flow velocity of the ice surface in step 5 of the river channel is as follows: Step 51: Using a Gaussian mixture model, each frame of the river ice condition video sequence is modeled at the pixel level. Multiple Gaussian distributions are used to represent the probability of gray value change of each pixel. The pixel value of the current frame is matched with the Gaussian distribution of the background model. Pixels with a matching degree lower than a preset threshold are classified as foreground, and pixels with a relatively good matching degree are classified as background. Step 52: Construct a synergistic processing method of morphological enhancement and multi-level noise suppression. Opening and closing operations are used to eliminate structural noise and repair topological defects in the ice condition image. Then, median filtering is used to remove residual discrete noise from the ice condition image. Finally, Gaussian smoothing is used to improve the continuity of image edges. Step 53: Calculate the gradient magnitude of the image using convolution operations. With direction information The calculation formula is: ; ; Among them, S x and S y These are the convolution kernels of the Sobel operator in the horizontal and vertical directions, respectively, I x and I y Gx and Gy are the gradient components in the corresponding directions of the image, representing the horizontal and vertical gradients, respectively. Step 54: Perform non-maximum suppression based on the gradient magnitude of any pixel e in the ice condition image. If the gradient magnitude of e is not a local maximum in a specific direction, set the gradient magnitude of e to 0. Then set the high threshold values respectively. and low threshold , the gradient value exceeds Pixels with gradient values lower than 0 are identified as strong edge feature points. The pixels are determined to be non-edge region points, and the gradient value is set in [ , Pixels that are within the range of strong edge points and have an eight-neighbor connectivity with strong edge points are identified as weak edge points. Points that do not meet the above characteristics are identified as noise, resulting in the final image edge pixel set E={e1,e2,...,e...}. n }, where n is the number of edge pixels; Step 55: Using the Suzuki contour tracking algorithm, based on the eight-neighbor clockwise search rule, sequentially access E={e1,e2,...,e...} n The search continues from adjacent edge points until the search originates, thus obtaining a closed ice block outline; a preset minimum effective area threshold A is used. min To avoid affecting area S min Search for tiny outlines; Step 56: Calculate the geometric moments of each closed ice floe profile using the following formula: ; In the formula, I(x,y) is the pixel value of the binarized image at coordinates (x,y), p+q is the order of the moment, and m is the first moment. 10 and m 01 This characterizes the distribution features of the contour on the coordinate axes; after normalization, the coordinates of the contour center are obtained. ; ; The center coordinates represent the position of the centroid of the profile and are translationally invariant. The displacement of the contour mass point can be calculated from adjacent consecutive frames; let the centroid coordinates of the t-th frame be... The centroid coordinates of frame t+1 are The displacement d can then be calculated using the Euclidean distance formula: ; The formula for calculating the target velocity of the river ice for each contour is as follows: ; Where fps is the video frame rate, representing the number of frames played per second; Step 57: Calculate the average flow velocity of all ice floe outline targets as the average river ice flow velocity for the current frame.