River video flow velocity identification method, device, storage medium and program product

Through the river video flow rate recognition method, the feature points of the river surface are screened and tracked through feature point recognition, optical flow tracking and density clustering, and the problem of low accuracy in river flow rate recognition in the existing technology is solved, and the calculation accuracy of flow rate values ​​is improved sex.

CN118823071BActive Publication Date: 2024-11-22CHINA INST OF WATER RESOURCES & HYDROPOWER RES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411306414.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-11-22
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

In the prior art, river flow velocity identification methods cannot effectively identify effective feature points on the river surface under complex detection environment and unstable video quality, resulting in low accuracy of flow velocity value calculation.

Method used

By obtaining river video frames, extracting grayscale images, identifying feature points and tracking of optical flow, forming pixel coordinate matrix, performing density clustering, filtering out target feature points that meet the texture characteristics of river surface, and tracking of feature points, and obtaining actual calculations Flow rate data.

Benefits of technology

The accuracy of river flow velocity value calculation is improved, the efficiency of identifying feature points of river surface texture is enhanced, and the target feature points of the next video frame is directly obtained, which improves the calculation accuracy of flow velocity value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823071B_ABST
    Figure CN118823071B_ABST
Patent Text Reader

Abstract

The present invention proposes a river video flow velocity recognition method, device, storage medium and program product. The river video flow velocity recognition method comprises obtaining key feature points of two adjacent video frames, performing density clustering based on these key feature points to obtain cluster output data, and then screening out target feature points that meet the actual surface texture characteristics of the river based on the cluster output data; then, by performing subsequent feature point tracking on these target feature points, directly obtaining the target feature points of the next video frame, and finally, calculating through these feature points that can reflect the surface texture characteristics of the river, the actual flow velocity data can be obtained, thereby improving the accuracy of the calculation of the flow velocity value of the river.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hydrological flow measurement, and in particular to a method, device, storage medium and program product for identifying river video flow velocity. Background Art

[0002] With the development of science and technology, flow velocity recognition technology has been widely used in various fields. Especially in water conservancy projects, the monitoring of river flow velocity is very important, which can directly affect flood control, water resources scheduling, water quality monitoring and other work. The river flow velocity recognition method in the related technology cannot effectively identify the effective feature points on the river surface during the actual recognition process due to the complex detection environment and unstable video quality, resulting in a low accuracy rate in calculating the river flow velocity value. Summary of the invention

[0003] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art and to provide a river video flow velocity identification method, device, storage medium and program product, which can improve the accuracy of river flow velocity value calculation.

[0004] In a first aspect, an embodiment of the present invention provides a method for identifying flow velocity in a river video, comprising:

[0005] Acquire a river video, and extract each video frame of the river video;

[0006] Acquire a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame;

[0007] Performing feature point recognition processing on the first grayscale image and the second grayscale image to obtain a first pixel coordinate set and a second pixel coordinate set, respectively, wherein the first pixel coordinate set includes pixel coordinates of key feature points of the first grayscale image, and the second pixel coordinate set includes pixel coordinates of key feature points of the second grayscale image;

[0008] The first pixel coordinate set and the second pixel coordinate set are concatenated to obtain a pixel coordinate matrix;

[0009] Performing density clustering post-processing on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames;

[0010] Filtering out a first target feature point set that conforms to actual river surface texture characteristics according to the cluster output data;

[0011] Performing feature point tracking processing according to the first target feature point set and the third video frame to obtain a second target feature point set, wherein the third video frame is a next video frame of the second video frame;

[0012] Actual flow rate data is calculated based on feature points corresponding to the first target feature point set and the second target feature point set.

[0013] The method for identifying the flow velocity of a river video provided by an embodiment of the present invention has at least the following beneficial effects: by acquiring a river video and extracting each video frame of the river video, a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame are acquired, and feature point recognition processing is performed on the first grayscale image and the second grayscale image to respectively obtain a first pixel coordinate set including pixel coordinates of key feature points of the first grayscale image and a second pixel coordinate set including pixel coordinates of key feature points of the second grayscale image, so as to obtain key feature points of two adjacent video frames; and then the pixel coordinate matrix is ​​obtained by splicing the first pixel coordinate set and the second pixel coordinate set, and density clustering is performed on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames, so as to screen out the first target feature points that meet the actual surface texture characteristics of the river according to the clustering output data. a set of feature points; then, by performing feature point tracking processing according to the first target feature point set and the third video frame, a second target feature point set is obtained, and then, according to the feature points corresponding to the first target feature point set and the second target feature point set, the actual flow velocity data can be calculated, that is, by obtaining the key feature points of two adjacent video frames, density clustering is performed based on these key feature points to obtain clustering output data, and then, according to the clustering output data, the target feature points that meet the actual surface texture characteristics of the river can be screened out; then, by performing subsequent feature point tracking on these target feature points, the target feature points of the next video frame can be directly obtained, which improves the efficiency of obtaining target feature points that meet the actual surface texture characteristics of the river; finally, through calculations using these feature points that can reflect the surface texture characteristics of the river, the actual flow velocity data can be obtained, thereby improving the accuracy of calculating the flow velocity value of the river.

[0014] In the above-mentioned river video flow velocity recognition method, the feature point recognition processing is performed on the first grayscale image and the second grayscale image to obtain a first pixel coordinate set and a second pixel coordinate set respectively, including:

[0015] Performing corner point detection on the first grayscale image to obtain a first pixel coordinate set;

[0016] Optical flow tracing is performed based on the first grayscale image and the second grayscale image to obtain a second pixel coordinate set.

[0017] In the above-mentioned river video flow velocity recognition method, the cluster output data includes multiple feature clusters, and the first target feature point set that meets the actual river surface texture characteristics is screened out according to the cluster output data, including:

[0018] Determining the total number of feature points and the number of clusters of all feature clusters according to the cluster output data;

[0019] Calculating a cluster average value according to the total number of feature points and the number of clusters;

[0020] When the number of feature points of the feature cluster is greater than the cluster average, screening out the first target feature point according to a first screening criterion;

[0021] When the number of feature points of the feature cluster is less than or equal to the cluster average, screening out second target feature points according to a second screening criterion;

[0022] A first target feature point set is obtained according to all the first target feature points and the second target feature points.

[0023] In the above-mentioned river video flow velocity recognition method, the step of selecting the first target feature point according to the first screening criterion includes:

[0024] Determine coordinate information of each corresponding feature point in the first video frame and the second video frame according to the clustering output data, and calculate displacement deviation data of two adjacent frames according to the coordinate information;

[0025] When the feature points of the feature cluster meet the first preset condition, the second preset condition or the third preset condition, the feature points in the corresponding feature cluster are removed to obtain the filtered first target feature points;

[0026] Wherein, the first preset condition is that the proportion of abnormal values ​​of the displacement deviation data is greater than a first preset value;

[0027] The second preset condition is that the proportion of negative values ​​in the displacement deviation data is greater than a second preset value;

[0028] The third preset condition is that the distance between the feature points of the current feature cluster and the feature points of the excluded feature cluster is less than a third preset value.

[0029] In the above-mentioned river video flow velocity recognition method, the step of selecting the second target feature point according to the second screening criterion includes:

[0030] Get river direction;

[0031] Determine coordinate information of each corresponding feature point in the first video frame and the second video frame according to the clustering output data, and obtain displacement deviation data and displacement difference direction of two adjacent frames according to the coordinate information;

[0032] When the feature points of the feature cluster meet the fourth preset condition, the feature points in the feature cluster are retained; when the feature points of the feature cluster meet the fifth preset condition, the feature points in the corresponding feature cluster are removed to obtain the filtered second target feature points;

[0033] The fourth preset condition is that the displacement difference direction of the feature points of the feature cluster is the same as the river direction and the displacement difference value in the displacement deviation data is less than a fourth preset value;

[0034] The fifth preset condition is that the proportion of the feature points of the feature cluster whose Manhattan distance is greater than or equal to the preset distance is greater than or equal to a fifth preset value.

[0035] In the above-mentioned river video flow velocity recognition method, the actual flow velocity data is calculated based on the feature points corresponding to the first target feature point set and the second target feature point set, including:

[0036] Calculate pixel displacement differences of feature points corresponding to the first target feature point set and the second target feature point set;

[0037] Obtain the change time interval of the corresponding feature point on the pixel plane;

[0038] Calculate the plane velocity data on the pixel plane according to the pixel displacement difference and the change time interval;

[0039] The actual flow velocity data is obtained according to the plane velocity data and the preset conversion matrix.

[0040] In the above-mentioned river video flow speed recognition method, when performing feature point tracking processing according to the first target feature point set and the third video frame, the river video flow speed recognition method further includes:

[0041] When the feature point tracking disappears, the feature point recognition process is performed again on the first grayscale image and the second grayscale image after a preset number of video frames.

[0042] In a second aspect, an embodiment of the present invention provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the river video flow rate identification method as described in the embodiment of the first aspect is implemented.

[0043] The computer device provided by the embodiment of the present invention has at least the following beneficial effects: by acquiring a river video and extracting each video frame of the river video, a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame are acquired, and feature point recognition processing is performed on the first grayscale image and the second grayscale image to respectively obtain a first pixel coordinate set including pixel coordinates of key feature points of the first grayscale image and a second pixel coordinate set including pixel coordinates of key feature points of the second grayscale image, thereby obtaining key feature points of two adjacent video frames; and then obtaining a pixel coordinate matrix by splicing the first pixel coordinate set and the second pixel coordinate set, and performing density clustering post-processing on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames, thereby screening out a first target feature point set that conforms to the actual surface texture characteristics of the river according to the clustering output data. then, by performing feature point tracking processing according to the first target feature point set and the third video frame, a second target feature point set is obtained, and then, according to the feature points corresponding to the first target feature point set and the second target feature point set, the actual flow velocity data can be calculated, that is, by obtaining the key feature points of two adjacent video frames, density clustering is performed based on these key feature points to obtain clustering output data, and then according to the clustering output data, the target feature points that meet the actual surface texture characteristics of the river can be screened out; then, by performing subsequent feature point tracking on these target feature points, the target feature points of the next video frame can be directly obtained, thereby improving the efficiency of obtaining target feature points that meet the actual surface texture characteristics of the river; finally, through calculations using these feature points that can reflect the surface texture characteristics of the river, the actual flow velocity data can be obtained, thereby improving the accuracy of calculating the flow velocity value of the river.

[0044] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the river video flow velocity identification method as described in the embodiment of the first aspect above.

[0045] The computer-readable storage medium provided by the embodiment of the present invention has at least the following beneficial effects: by acquiring a river video and extracting each video frame of the river video, a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame are acquired, and feature point recognition processing is performed on the first grayscale image and the second grayscale image to respectively obtain a first pixel coordinate set including pixel coordinates of key feature points of the first grayscale image and a second pixel coordinate set including pixel coordinates of key feature points of the second grayscale image, thereby obtaining key feature points of two adjacent video frames; and then obtaining a pixel coordinate matrix by splicing the first pixel coordinate set and the second pixel coordinate set, and performing density clustering post-processing on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames, thereby screening out a first target feature that conforms to the actual surface texture characteristics of the river according to the clustering output data. point set; then, by performing feature point tracking processing according to the first target feature point set and the third video frame, a second target feature point set is obtained, and then, according to the feature points corresponding to the first target feature point set and the second target feature point set, the actual flow velocity data can be calculated, that is, by obtaining the key feature points of two adjacent video frames, density clustering is performed based on these key feature points to obtain clustering output data, and then according to the clustering output data, the target feature points that meet the actual surface texture characteristics of the river can be screened out; then, by performing subsequent feature point tracking on these target feature points, the target feature points of the next video frame can be directly obtained, which improves the efficiency of obtaining target feature points that meet the actual surface texture characteristics of the river; finally, through calculations using these feature points that can reflect the surface texture characteristics of the river, the actual flow velocity data can be obtained, thereby improving the accuracy of calculating the flow velocity value of the river.

[0046] In a fourth aspect, the embodiments of the present application further provide a computer program product, which includes a computer program or a computer instruction, and the computer program or the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device executes the river video flow velocity identification method described in the first aspect of the embodiments of the present application.

[0047] The computer program product provided by the embodiment of the present invention has at least the following beneficial effects: by acquiring a river video and extracting each video frame of the river video, a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame are acquired, and feature point recognition processing is performed on the first grayscale image and the second grayscale image to respectively obtain a first pixel coordinate set including pixel coordinates of key feature points of the first grayscale image and a second pixel coordinate set including pixel coordinates of key feature points of the second grayscale image, thereby obtaining key feature points of two adjacent video frames; and then obtaining a pixel coordinate matrix by splicing the first pixel coordinate set and the second pixel coordinate set, and performing density clustering post-processing on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames, thereby screening out a first target feature that conforms to the actual surface texture characteristics of the river according to the clustering output data. point set; then, by performing feature point tracking processing according to the first target feature point set and the third video frame, a second target feature point set is obtained, and then, according to the feature points corresponding to the first target feature point set and the second target feature point set, the actual flow velocity data can be calculated, that is, by obtaining the key feature points of two adjacent video frames, density clustering is performed based on these key feature points to obtain clustering output data, and then according to the clustering output data, the target feature points that meet the actual surface texture characteristics of the river can be screened out; then, by performing subsequent feature point tracking on these target feature points, the target feature points of the next video frame can be directly obtained, which improves the efficiency of obtaining target feature points that meet the actual surface texture characteristics of the river; finally, through the calculation of these feature points that can reflect the surface texture characteristics of the river, the actual flow velocity data can be obtained, thereby improving the accuracy of the calculation of the flow velocity value of the river.

[0048] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The present invention is further described below in conjunction with the accompanying drawings and embodiments;

[0050] Figure 1 The present invention provides a flow chart of a method for identifying flow velocity of a river through video.

[0051] Figure 2 is a schematic diagram of clustering output data distribution provided by an embodiment of the present invention;

[0052] Figure 3 is a schematic diagram of another clustering output data distribution provided by an embodiment of the present invention;

[0053] Figure 4is a schematic diagram of another clustering output data distribution provided by an embodiment of the present invention;

[0054] Figure 5 is a schematic diagram of another clustering output data distribution provided by an embodiment of the present invention;

[0055] Figure 6 is a schematic diagram of another clustering output data distribution provided by an embodiment of the present invention;

[0056] Figure 7 is a flow chart of another method for identifying flow velocity of a river via video provided by an embodiment of the present invention;

[0057] Figure 8 is a flow chart of performing density clustering post-processing on a pixel coordinate matrix provided by an embodiment of the present invention;

[0058] Fig. 9 It is a structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0060] It should be understood that in the description of the embodiments of the present invention, if there is a description of "first", "second", etc., it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features. "At least one" means one or more, "more than" means more than two, greater than, less than, exceeding, etc. are understood to not include the number itself, above, below, within, etc. are understood to include the number itself, and "several" means one or more, unless otherwise clearly and specifically limited. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. It can be understood that A and / or B can represent the situation where A exists alone, A and B exist at the same time, or B exists alone. Among them, A and B can be singular or plural.

[0061] In addition, unless otherwise clearly specified and limited, the term "connected / connected" should be understood in a broad sense, for example, it can be a fixed connection or a movable connection, a detachable connection or a non-detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or can communicate with each other; it can be directly connected or indirectly connected through an intermediate medium. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order from that in the flowchart. It should be noted that the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0062] It is worth noting that among the relevant technologies, water conservancy and flood control work focuses on using digital twin technology to promote the application of "four predictions", aiming to comprehensively enhance the real-time monitoring, early warning and forecasting, dispatching and control, and intelligent decision-making capabilities in flood and drought disaster prevention. However, it also faces some challenges, including the improvement of monitoring technology and data accuracy for extreme floods and debris flows in hilly areas, and the lack of computational efficiency and refinement of the "preview" simulation in the "four predictions" of digital twins.

[0063] In related technologies, some speed measurement algorithms will first identify key feature points frame by frame to reflect the water flow state when processing video data, and then track these points through the optical flow algorithm. Although the algorithm is designed to be simple and efficient, in actual applications, the complex detection environment and the instability of video quality may affect the accuracy of key feature point identification and optical flow tracking, resulting in a low accuracy rate in identifying effective feature points on the river surface, which in turn leads to a low accuracy rate in calculating the river's flow rate value.

[0064] In view of the complexity of the feature points on the river surface, the accuracy of directly using all the feature points obtained by the feature point detection algorithm for subsequent tracking to obtain the flow velocity value is low. Based on this, the present invention provides a river video flow velocity recognition method, device, storage medium and program product, which obtains all the feature points of two adjacent frames through the feature point detection algorithm and the sparse optical flow tracking algorithm, and then performs density clustering post-processing. Finally, based on the clustering results, the feature points that can truly reflect the surface texture of the river are screened out for subsequent tracking, so as to improve the accuracy of the calculation of the flow velocity value of the river.

[0065] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.

[0066] like Figure 1 As shown, an embodiment of the first aspect of the present invention provides a method for identifying a flow rate of a river through video, and the method for identifying a flow rate of a river through video includes but is not limited to steps S110 to S180:

[0067] Step S110: obtaining a river video and extracting each video frame of the river video;

[0068] The video surveillance equipment may be used to collect the river video. The video frames of the river video may be extracted by performing frame processing on the river video to obtain the video frames of the river video.

[0069] Step S120: acquiring a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame;

[0070] Among them, obtaining a first grayscale image of the first video frame and a second grayscale image of the next adjacent second video frame can be specifically performed by obtaining the first video frame and the next video frame adjacent to the first video frame (i.e., the second video frame) from the video frame of the river video, performing grayscale processing on the first video frame to obtain the first grayscale image, and performing grayscale processing on the second video frame to obtain the second grayscale image.

[0071] Step S130: performing feature point recognition processing on the first grayscale image and the second grayscale image to obtain a first pixel coordinate set and a second pixel coordinate set respectively;

[0072] The first pixel coordinate set includes pixel coordinates of key feature points of the first grayscale image, and the second pixel coordinate set includes pixel coordinates of key feature points of the second grayscale image.

[0073] Step S140: performing splicing processing on the first pixel coordinate set and the second pixel coordinate set to obtain a pixel coordinate matrix;

[0074] The first pixel coordinate set and the second pixel coordinate set may be spliced ​​using a cat function, which is a function used to splice data.

[0075] Step S150: performing density clustering post-processing on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames;

[0076] The pixel coordinate matrix is ​​subjected to density clustering post-processing, and specifically, a density clustering model DBSCAN is used to perform density clustering post-processing on the pixel coordinate matrix. DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a density-based clustering algorithm.

[0077] For example, the density clustering model DBSCAN is initialized, and the neighborhood radius parameter can be set to 8-12, and the minimum number of similar data in the neighborhood parameter can be set to 2-4 to meet the surface texture characteristics of the river. The pixel coordinate matrix is ​​used as the input of the density clustering model to obtain the clustering output data of two adjacent video frames (i.e., the first video frame and the second video frame).

[0078] Step S160: Filtering out a first target feature point set that conforms to the actual river surface texture characteristics according to the cluster output data;

[0079] It is understandable that the number of target feature points in the first target feature point set may be one or more, which is specifically determined according to the target feature points actually screened. The target feature points are valid feature points on the river surface corresponding to the video frame.

[0080] Step S170: performing feature point tracking processing according to the first target feature point set and the third video frame to obtain a second target feature point set;

[0081] The third video frame is the next video frame of the second video frame. The second target feature point set is a set of target feature points of the third video frame.

[0082] It can be understood that the second target feature point set obtained by performing feature point tracking processing on the first target feature point set and the third video frame is consistent with the actual surface texture characteristics of the river. By performing feature point tracking on the first target feature point set and the third video frame, the target feature points of the third video frame can be directly obtained, thereby improving the efficiency of obtaining target feature points that conform to the actual surface texture characteristics of the river.

[0083] Step S180: Calculate actual flow rate data based on feature points corresponding to the first target feature point set and the second target feature point set.

[0084] Among them, the actual flow rate data refers to the actual flow rate value of the river.

[0085] In an embodiment of the present application, a river video is acquired and each video frame of the river video is extracted to acquire a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame, and feature point recognition processing is performed on the first grayscale image and the second grayscale image to obtain a first pixel coordinate set including pixel coordinates of key feature points of the first grayscale image and a second pixel coordinate set including pixel coordinates of key feature points of the second grayscale image, respectively, so that key feature points of two adjacent video frames can be obtained; then, a pixel coordinate matrix is ​​obtained by splicing the first pixel coordinate set and the second pixel coordinate set, and density clustering is performed on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames, so that a first target feature point set that meets the actual surface texture characteristics of the river can be screened out according to the clustering output data; then, a first target feature point set is obtained according to the first target feature point set. The target feature point set and the third video frame are subjected to feature point tracking processing to obtain a second target feature point set, and then the actual flow velocity data can be calculated based on the feature points corresponding to the first target feature point set and the second target feature point set, that is, by obtaining the key feature points of two adjacent video frames, density clustering is performed based on these key feature points to obtain clustering output data, and then based on the clustering output data, the target feature points that meet the actual surface texture characteristics of the river can be screened out; then, by performing subsequent feature point tracking on these target feature points, the target feature points of the next video frame can be directly obtained, thereby improving the efficiency of obtaining target feature points that meet the actual surface texture characteristics of the river; finally, the actual flow velocity data can be obtained by calculating these effective target feature points that can reflect the surface texture characteristics of the river, thereby improving the accuracy of calculating the flow velocity value of the river.

[0086] In one embodiment, step S130 is further described. Step S130 may include but is not limited to step S210 and step S220.

[0087] Step S210: performing corner point detection on the first grayscale image to obtain a first pixel coordinate set.

[0088] Among them, corner detection can be implemented using the ORB (Oriented FAST and Rotated BRIEF) algorithm, which is a popular computer vision algorithm used to detect and describe local feature points in images. ORB combines the advantages of FAST (Features from Accelerated Segment Test) key point detection and BRIEF (Binary Robust Independent Elementary Features) descriptor, and introduces directionality and rotation invariance.

[0089] Exemplarily, the first grayscale image is used as an input of the ORB algorithm to obtain a first pixel coordinate set. The maximum number of corner points is set to 50-100, the pyramid collection rate is 1.2, the pyramid level is 8, the image edge exclusion parameter is set to 10-30, and the region size is set to 4-6 to meet the surface texture characteristics of the river. The first pixel coordinate set is a set of pixel coordinates of key feature points corresponding to the first video frame.

[0090] It should be noted that by setting the maximum number of corner points to 50-100, the number of feature points and the efficiency of the algorithm can be balanced; by setting the pyramid collection rate to 1.2, more subtle feature changes can be detected; by setting the pyramid level to 8, feature points can be detected at more scales, thereby improving the algorithm's ability to recognize objects of different scales; by setting the image edge exclusion parameter to 10-30, it is helpful to exclude unstable feature points at the edge of the image that may be caused by boundary effects. By excluding edge areas, the accuracy and robustness of feature point detection can be improved; by setting the area size to 4-6, the pixel brightness within the area size around the candidate point can be checked when detecting corner points. The area size is usually a circular or square neighborhood. In addition, parameters such as the maximum number of corner points, pyramid collection rate, pyramid level, image edge exclusion parameter, and area size can be set according to actual needs, and no specific restrictions are made here.

[0091] Step S220: performing optical flow tracing according to the first grayscale image and the second grayscale image to obtain a second pixel coordinate set.

[0092] Exemplarily, the first grayscale image and the second grayscale image are used as inputs of the LK sparse optical flow algorithm, and the second pixel coordinate set is output, which is the set of pixel coordinates of the key feature points corresponding to the second video frame. Among them, the LK (Lucas-Kanade) sparse optical flow algorithm is a classic computer vision technology used to estimate the movement of feature points in an image sequence, that is, optical flow. The LK algorithm is a sparse method because it only tracks some key feature points in the image, rather than the entire image area.

[0093] In an embodiment of the present application, by performing corner detection on the first grayscale image to obtain a first pixel coordinate set, and performing optical flow tracing based on the first grayscale image and the second grayscale image to obtain a second pixel coordinate set, all key feature points of two adjacent video frames can be obtained, so that density clustering post-processing can be performed based on the first pixel coordinate set and the second pixel coordinate set in subsequent steps.

[0094] In one embodiment, when the clustering output data includes multiple feature clusters, step S160 is further described, and step S160 may include but is not limited to steps S310 to S350.

[0095] Step S310: Determine the total number of feature points and the number of clusters of all feature clusters according to the clustering output data.

[0096] The number of clusters is the number of cluster categories.

[0097] Step S320: Calculate the cluster average value based on the total number of feature points and the number of clusters.

[0098] Specifically, the total number of feature points is divided by the number of clusters to obtain the cluster average.

[0099] Step S330: When the number of feature points of the feature cluster is greater than the cluster average, the first target feature point is screened out according to the first screening criterion.

[0100] It should be noted that the feature cluster whose number of feature points is greater than the cluster average represents an area with obvious river surface features and has a greater impact on the final result of the flow velocity value. Therefore, it is necessary to determine whether the feature points in the feature cluster should be retained or removed based on the first screening criterion, where the retained feature points are the first target feature points.

[0101] The first target feature point is screened out according to the first screening criterion. Specifically, the coordinate information of each corresponding feature point in the first video frame and the second video frame can be determined according to the clustering output data, and the displacement deviation data of the two adjacent frames is calculated according to the coordinate information. When the feature point of the feature cluster meets the first preset condition, the second preset condition or the third preset condition, the feature point in the corresponding feature cluster is removed to obtain the screened first target feature point.

[0102] Among them, the coordinate information includes the vertical coordinate and / or the horizontal coordinate, the displacement deviation data includes the horizontal coordinate displacement deviation data (i.e., the x displacement deviation) and / or the vertical coordinate displacement deviation data (i.e., the y displacement deviation), the horizontal coordinate displacement deviation data is the difference between the horizontal coordinates of the same feature point in two adjacent frames, and the vertical coordinate displacement deviation data is the difference between the vertical coordinates of the same feature point in two adjacent frames.

[0103] The first preset condition is that the proportion of abnormal values ​​of the displacement deviation data is greater than a first preset value, wherein the abnormal values ​​of the displacement deviation data can be judged according to the 3sigma criterion, and the first preset value can be set according to actual conditions, and no specific restrictions are made here.

[0104] The second preset condition is that the proportion of negative values ​​in the displacement deviation data is greater than the second preset value, wherein the proportion of negative values ​​in the displacement deviation data is the proportion of displacement deviation data with negative values ​​in a set of feature clusters to the number of all displacement deviation data. The second preset value can be set according to actual conditions and is not specifically limited here. In addition, the feature points corresponding to the displacement deviation data with negative values ​​are tracking feature points whose displacement directions do not correspond to the actual river directions. Therefore, it is necessary to find tracking feature points whose displacement directions do not correspond to the actual river directions from the feature clusters whose feature point numbers are greater than the cluster average.

[0105] The third preset condition is that the distance between the feature points of the current feature cluster and the feature points of the excluded feature cluster is less than the third preset value, wherein the distance is the Euclidean distance, which is the real distance between two feature points in two-dimensional space. The third preset value can be 1 pixel, 2 pixels or more pixels, which can be set according to actual conditions and is not specifically limited here. It can be understood that within a certain distance range, the feature cluster that is close to the feature points of the excluded feature cluster is regarded as an abnormal feature cluster, so the feature points in the corresponding feature cluster are removed.

[0106] For example, taking the river video corresponding to the Heilong River Basin in a certain county as an example, Figure 2 As shown, Figure 2 The clustering output data based on the first video frame and the second video frame is shown, denoted as , z represents the number of clusters. Assume that the total number of feature points is , then the cluster average can be obtained as formula (1), that is,

[0107] (1)

[0108] in, It is also the index number of M, where M represents a feature point in a feature cluster.

[0109] When the number of feature points of a feature cluster is greater than the cluster average, that is, According to the cluster output data, the coordinate information (i.e., the horizontal coordinate and the vertical coordinate) of each corresponding feature point in the first video frame and the second video frame is determined, and the horizontal coordinate displacement deviation data dx and the vertical coordinate displacement deviation data dy of each feature point are calculated according to the coordinate information.

[0110] Taking the first preset condition as an example, when the horizontal axis displacement deviation data dx and / or ordinate displacement deviation data dy If the proportion of abnormal values ​​is greater than a first preset value (such as 25%), the feature points in the feature cluster are removed. dx and vertical axis displacement deviation data dyThe calculation method of is shown in formula (2), that is,

[0111] (2)

[0112] in, represents the horizontal coordinate of the feature point corresponding to the first video frame, represents the horizontal coordinate of the feature point corresponding to the second video frame, represents the ordinate of the feature point corresponding to the first video frame, Indicates the ordinate of the feature point corresponding to the second video frame.

[0113] The abnormal value ratio of the displacement deviation data (i.e., the horizontal axis displacement deviation data dx and / or the vertical axis displacement deviation data dy) can be calculated according to the 3sigma criterion. For example, assuming that the horizontal axis displacement deviation data corresponding to each feature point in a certain feature cluster is dx List A = [0.22076462,0.22257652,0.22606969,0.25100497,0.36090867,0.53379553,

[0114] 0.66974582,0.6884241,0.71145984,0.72151191,0.89478405,1.39367673,1.57332425,1.59785028,1.69290234,1.70094946,1.72016727,1.73652244,2.03585835,2.06835412], the first preset value is 25%, the abnormal value proportion of the horizontal coordinate displacement deviation data corresponding to all feature points in the feature cluster calculated by the 3sigma criterion is greater than 25%, so the feature points in the feature cluster are considered abnormal, and all feature points in the feature cluster are removed, such as Figure 3 The feature points are circled as shown.

[0115] Taking the second preset condition as an example, if the displacement deviation data (i.e. the horizontal axis displacement deviation data dx and / or ordinate displacement deviation data dy ) is a negative value, and the negative value ratio is greater than the second preset value, then the feature points in the feature cluster are removed. For example, assuming that the horizontal coordinate displacement deviation data corresponding to each feature point in a feature cluster is dxList B = [0.36097684,-0.42313241,0.47634822,0.72876899,1.17266127,1.19288599,-1.24098472,1.33693704,-1.35876635,-1.35923894,-2.42082028,-2.5653341], the second preset value is 30%, because the negative value ratio in the list is greater than 30%, therefore, remove all feature points in the feature cluster, such as Figure 4 The feature points are circled as shown.

[0116] Taking the third preset condition as an example, as shown in formula (3), the feature clusters whose feature points are greater than the cluster average are obtained by looping through The feature points in the cluster are clustered with the excluded features The distance between the feature points , if the distance Less than the third preset value , then remove the feature points in the corresponding feature cluster (i.e., the distance Greater than or equal to the third preset value The feature points in the currently traversed cluster feature and the feature points of the excluded feature cluster (for example Figure 3 , Figure 4 The distance between the feature points in the cluster is less than the third preset value, so the feature points in the currently traversed cluster features are removed.

[0117] (3)

[0118] It can be understood that the first screening criterion uses the first preset condition, the second preset condition and the third preset condition as screening conditions for feature points, thereby screening out the first target feature point.

[0119] Step S340: When the number of feature points of the feature cluster is less than or equal to the cluster average value, the second target feature point is screened out according to the second screening criterion.

[0120] It should be noted that the feature clusters whose feature points are less than or equal to the cluster average represent areas that can accurately reflect the flow velocity. If the difference between the feature points of the feature clusters and the cluster average is small, they can represent the actual flow velocity and can be saved.

[0121] Specifically, the second target feature points are screened out according to the second screening criterion, which can specifically be to obtain the direction of the river; the coordinate information of each corresponding feature point in the first video frame and the second video frame is determined according to the clustering output data, and the displacement deviation data and the displacement difference direction of the two adjacent frames are obtained according to the coordinate information; when the feature points of the feature cluster meet the fourth preset condition, the feature points in the feature cluster are retained; when the feature points of the feature cluster meet the fifth preset condition, the feature points in the corresponding feature cluster are removed to obtain the screened second target feature points.

[0122] It can be understood that the feature points of the feature cluster that meet the fourth preset condition indicate that the number of feature points of the feature cluster can represent the actual flow rate and can therefore be retained. Among them, the fourth preset condition is that the displacement difference direction of the feature points of the feature cluster is the same as the river direction and the displacement difference value in the displacement deviation data is less than the fourth preset value. The displacement difference direction can be calculated according to formula (2) to obtain a displacement vector, and the direction of the displacement vector is the displacement difference direction. The river direction can be determined according to the actual flow direction of the river. The displacement difference value can be the horizontal coordinate displacement deviation data dx or the vertical coordinate displacement deviation data dy, which can be specifically calculated by formula (2), that is, the displacement scalar in the displacement vector is calculated by formula (2). The fourth preset value can be 1pix, 2pix or other values, and is not specifically limited here.

[0123] For example, assuming that the horizontal coordinate displacement deviation data corresponding to each feature point in a certain feature cluster is dx List C = [0.81628883, 0.9046013, 0.9907221], the fourth preset value is 1pix, and the displacement direction of each feature point in this feature cluster is correct (that is, the displacement difference direction of the feature point is the same as the river direction). It can be seen that the number of features in the feature cluster is small, and the displacement difference of each feature point in this feature cluster is less than 1pix and the displacement direction is correct. Therefore, all feature points in this feature cluster are retained, such as Figure 5 The feature points are circled in the figure.

[0124] Among them, the fifth preset condition is that the Manhattan distance of the feature points of the feature cluster is greater than or equal to the preset distance, and the proportion is greater than or equal to the fifth preset value. The preset distance can be 20 pixels, 21 pixels, etc.; the fifth preset value can be 20%, 25% or other proportions, which can be set according to actual conditions, and no specific restrictions are made here. It can be understood that the Manhattan distance can be used to determine whether the distances of the feature points in each feature cluster are far apart.

[0125] For example, if the Manhattan distance of the feature points of the feature cluster is greater than or equal to the preset distance, the preset distance is pixels, and the proportion of feature points whose Manhattan distance is greater than or equal to the preset distance is greater than or equal to the fifth preset value , then all feature points contained in the feature cluster are removed; otherwise, all feature points contained in the feature cluster are retained. For example, if the Manhattan distance of the feature points of the feature cluster is less than the preset distance, and the proportion is less than the fifth preset value , then all feature points contained in the feature cluster are retained, that is, the second target feature points, as shown in formula (4) and formula (5).

[0126] (4)

[0127] (5)

[0128] Among them, the table The x-coordinate of each feature point in a feature cluster whose number of feature points is less than or equal to the cluster average, The y coordinate of each feature point in a feature cluster whose number of feature points is less than or equal to the cluster average, and Used to identify different feature points in feature clustering, such as and It can represent the x-coordinates of any two feature points in the feature cluster; The minimum and The minimum value is 0. The maximum value and The maximum value of is the total number of feature points of the corresponding feature cluster minus one; Represents the Manhattan distance of each feature point in a feature cluster whose number of feature points is less than or equal to the cluster mean.

[0129] For example, the x-coordinates of feature points in a feature cluster are calculated by formula (4) to obtain a list d = [30.62035845, 3.03153008, 101.14666115, 63.16096493, 69.44529569, 104.50361046, 99.60640423, 2.8973167 ...] as an example. Since the values ​​in the list meet the removal condition of formula (5), all feature points contained in the feature cluster are removed, such as Figure 6 shown.

[0130] It can be understood that the second screening criterion uses the fourth preset condition and the fifth preset condition as screening conditions for feature points, thereby screening out the second target feature points.

[0131] Step S350: obtaining a first target feature point set according to all first target feature points and second target feature points.

[0132] Specifically, the first target feature point set is a set of first target feature points and second target feature points.

[0133] In an embodiment of the present application, by determining the total number of feature points and the number of clusters of all feature clusters based on the cluster output data, and calculating the cluster average value based on the total number of feature points and the number of clusters, it is possible to determine whether each feature cluster is a category that can accurately reflect the flow rate area based on the cluster average value; when the number of feature points of a feature cluster is greater than the cluster average value, it means that the feature cluster corresponds to an area with obvious river surface features and has a greater impact on the final result of the flow rate value, so it is necessary to filter out the first target feature point from the feature cluster according to the first screening criterion; when the number of feature points of a feature cluster is less than or equal to the cluster average value, it indicates that the feature points in the feature cluster can represent an area that can accurately reflect the flow rate, at this time, the second target feature point can be filtered out according to the second screening criterion; finally, a first target feature point set that conforms to the actual river surface texture characteristics can be obtained based on all the first target feature points and the second target feature points. Therefore, compared with the traditional image algorithm that identifies the river flow rate based on all feature points, the embodiment of the present application can effectively exclude abnormal feature points on the river surface, optimize the selection of feature points, and improve the flow rate recognition accuracy.

[0134] In one embodiment, step S180 is further described. Step S180 may include but is not limited to steps S610 to S640.

[0135] Step S610: Calculate the pixel displacement difference between the feature points corresponding to the first target feature point set and the second target feature point set.

[0136] Specifically, the horizontal coordinate difference and the vertical coordinate difference of the pixel of the same feature point in the first target feature point set and the second target feature point set are calculated, and then the pixel displacement difference is obtained according to the horizontal coordinate difference and the vertical coordinate difference of the pixel.

[0137] It should be noted that all feature points in the retained feature clusters must be calculated.

[0138] Step S620: Obtain the change time interval of the corresponding feature point on the pixel plane.

[0139] Step S630: Calculate the plane velocity data on the pixel plane according to the pixel displacement difference and the change time interval.

[0140] Specifically, the pixel displacement difference is divided by the change time interval to obtain the plane velocity data on the pixel plane. The plane velocity data can be calculated by formula (6), that is,

[0141] (6)

[0142] in, Represents the plane velocity data on the pixel plane corresponding to the feature point, represents the first target feature point set, represents the second target feature point set, and t represents the change time interval.

[0143] Step S640: Obtaining actual flow velocity data according to the plane velocity data and the preset conversion matrix.

[0144] Specifically, the preset conversion matrix can be a conversion matrix from a two-dimensional pixel plane to a three-dimensional real space, and the plane velocity data on the pixel plane is converted into actual flow velocity data through the conversion matrix from the two-dimensional pixel plane to the three-dimensional real space.

[0145] In an embodiment of the present application, by calculating the pixel displacement difference of the feature points corresponding to the first target feature point set and the second target feature point set, and obtaining the change time interval of the corresponding feature points on the pixel plane, the plane velocity data on the pixel plane can be calculated according to the pixel displacement difference and the change time interval, and then the actual flow velocity data can be obtained according to the plane velocity data and the preset transformation matrix. That is to say, the embodiment of the present application uses the retained effective feature points that can reflect the actual flow velocity of the river to perform video flow velocity recognition, thereby improving the flow velocity recognition accuracy.

[0146] In one embodiment, when performing feature point tracking processing according to the first target feature point set and the third video frame, the river video flow rate recognition method further includes the following steps:

[0147] When the feature point tracking disappears, the feature point recognition process is performed on the first grayscale image and the second grayscale image again after a preset number of video frames.

[0148] The preset number of video frames can be set according to actual conditions and is not specifically limited here.

[0149] It is understandable that due to the interference of complex external conditions, tracking may disappear. Therefore, a preset number of video frames is set as the restart interval of the algorithm. When tracking disappears, the feature point recognition processing of the first grayscale image can be performed again after an interval of the preset number of video frames, and subsequent optical flow tracking can be continued, so as to realize feature point recognition processing of the second grayscale image.

[0150] In the embodiment of the present application, by setting a preset number of video frames as the restart interval of the algorithm, it is possible to avoid the situation where the feature point tracking disappears due to a complex external environment, optimize the selection of feature points, and improve the flow rate recognition accuracy.

[0151] In one embodiment, Figure 7As shown, a video surveillance device is used to obtain a river video, and each video frame of the river video is extracted, and then a first grayscale image of the first video frame and a second grayscale image of the next adjacent second video frame are obtained, wherein the grayscale image is defined as , i represents the device serial number of the video surveillance device, j represents the frame sequence of the video frame, Represents the grayscale image of the j-th video frame acquired by the i-th video surveillance device.

[0152] Then, corner point detection is performed on the first grayscale image to obtain a first pixel coordinate set. Assume that the first grayscale image is , the first grayscale image As the input of the ORB algorithm, get the first pixel coordinate set , where the minimum value of s is 0 and the maximum value of s is the maximum number of corner points minus 1. Represents a single key feature point.

[0153] Next, optical flow tracing is performed based on the first grayscale image and the second grayscale image to obtain a second pixel coordinate set. and the second grayscale image As the input of the LK sparse optical flow algorithm, the output is the second pixel coordinate set, that is, the second grayscale image The set of pixel coordinates of the key feature points .

[0154] Next, the first pixel coordinate set and the second pixel coordinate set The pixel coordinates of the same feature point in The splicing functions are combined to form a two-dimensional matrix M (i.e., pixel coordinate matrix) with a shape of (s, 4), where 4 represents The x- and y-coordinates of the feature points and The x-coordinate and y-coordinate of the feature point are shown in formula (7).

[0155] (7)

[0156] Furthermore, the pixel coordinate matrix is ​​subjected to density clustering post-processing to obtain clustering output data of two adjacent video frames, and the first target feature point set that conforms to the actual river surface texture characteristics is screened out based on the clustering output data. , and then perform feature point tracking processing based on the first target feature point set and the third video frame to determine whether the feature point disappears after tracking. If not, obtain the second target feature point set At this time, pixel displacement can be performed, that is, the first target feature point set is calculated and the second target feature point set The pixel displacement difference of the corresponding feature point is used to obtain the change time interval of the corresponding feature point on the pixel plane, the pixel displacement difference is divided by the change time interval to obtain the plane velocity data on the pixel plane, and then the plane velocity data on the pixel plane is transformed through the transformation matrix from the pixel two-dimensional plane to the three-dimensional real space to obtain the actual flow rate data, that is, the actual river flow rate; if it is, that is, the feature point tracking disappears, then set the preset video frame number T as the restart interval of the algorithm (that is, the interval T frames), and the next time the feature point recognition processing and subsequent feature point tracking processing are performed on the j+Tth frame video frame, which will not be repeated here.

[0157] In one embodiment, Figure 8 As shown, a method for density clustering post-processing of a pixel coordinate matrix can be specifically initializing a density clustering model DBSCAN, taking the pixel coordinate matrix as the input of the density clustering model, and obtaining clustering output data of two adjacent video frames, wherein the clustering output data includes multiple feature clusters, determining the total number of feature points and the number of clusters of all feature clusters according to the clustering output data, and calculating the clustering average value according to the total number of feature points and the number of clusters. When the number of feature points of a feature cluster is greater than the clustering average value, the coordinate information of each corresponding feature point in the first video frame and the second video frame can be determined according to the clustering output data, and the displacement deviation data of the two adjacent frames can be calculated according to the coordinate information. When the feature points of the feature cluster meet the first preset condition, the second preset condition, or the third preset condition, the feature points in the corresponding feature cluster are removed to obtain the first target feature point after screening, wherein the first preset condition is that the proportion of abnormal values ​​in the displacement deviation data is greater than the first preset value; the second preset condition is that the proportion of negative values ​​in the displacement deviation data is greater than the second preset value; and the third preset condition is that the distance between the feature point of the current feature cluster and the feature point of the excluded feature cluster is less than the third preset value.

[0158] When the number of feature points of a feature cluster is less than or equal to the cluster average, the river direction is obtained, and then the coordinate information of each corresponding feature point in the first video frame and the second video frame is determined according to the cluster output data, and the displacement deviation data and the displacement difference direction of the two adjacent frames are obtained according to the coordinate information. When the displacement difference direction of the feature points of the feature cluster is the same as the river direction and the displacement difference value in the displacement deviation data is less than a fourth preset value, the feature points in the feature cluster are retained; when the Manhattan distance of the feature points of the feature cluster is greater than or equal to the preset distance, the proportion is greater than or equal to the fifth preset value, the feature points in the corresponding feature cluster are removed to obtain the screened second target feature points.

[0159] like Fig. 9As shown, an embodiment of the present invention provides a computer device 400, including a memory 410, a processor 420, and a computer program stored in the memory 410 and executable on the processor 420, wherein the processor 420 and the memory 410 may be connected via a bus or other means. Fig. 9 The example of bus connection is shown in the figure, and the processor executes the computer program to implement the river video flow rate identification method of the first embodiment as above. Therefore, the river video flow rate identification method in the above embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated.

[0160] An embodiment of the present invention provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions can be used to enable a computer to execute the river video flow rate identification method of the first embodiment as described above. Therefore, the river video flow rate identification method in the above embodiment will not be described in detail here. In addition, the description of the beneficial effects of using the same method will not be described in detail.

[0161] The embodiment of the present application also provides a computer program product or a computer program, which may include computer instructions, which may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor may execute the computer instructions so that the computer device executes the river video flow velocity identification method in the above embodiment, and therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0162] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed methods above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium or a non-transitory medium and a communication medium or a temporary medium. As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk DVD or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0163] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.

Claims

1. A method for identifying flow velocity in a river video, characterized in that: include: Acquire a river video, and extract each video frame of the river video; Acquire a first grayscale image of a first video frame and a second grayscale image of a next adjacent second video frame; Performing feature point recognition processing on the first grayscale image and the second grayscale image to obtain a first pixel coordinate set and a second pixel coordinate set, respectively, wherein the first pixel coordinate set includes pixel coordinates of key feature points of the first grayscale image, and the second pixel coordinate set includes pixel coordinates of key feature points of the second grayscale image; The first pixel coordinate set and the second pixel coordinate set are concatenated to obtain a pixel coordinate matrix; Performing density clustering post-processing on the pixel coordinate matrix to obtain clustering output data of two adjacent video frames; Filtering out a first target feature point set that conforms to actual river surface texture characteristics according to the cluster output data; Performing feature point tracking processing according to the first target feature point set and the third video frame to obtain a second target feature point set, wherein the third video frame is a next video frame of the second video frame; The actual flow rate data is calculated based on the feature points corresponding to the first target feature point set and the second target feature point set; wherein The step of selecting a first target feature point set that conforms to the actual surface texture characteristics of the river according to the cluster output data comprises: Determining the total number of feature points and the number of clusters of all feature clusters according to the cluster output data; Calculating a cluster average value according to the total number of feature points and the number of clusters; When the number of feature points of the feature cluster is greater than the cluster average, screening out the first target feature point according to a first screening criterion; When the number of feature points of the feature cluster is less than or equal to the cluster average, screening out second target feature points according to a second screening criterion; A first target feature point set is obtained according to all first target feature points and second target feature points; wherein The step of selecting the first target feature point according to the first screening criterion includes: Determine coordinate information of each corresponding feature point in the first video frame and the second video frame according to the clustering output data, and calculate displacement deviation data of two adjacent frames according to the coordinate information; When the feature points of the feature cluster meet the first preset condition, the second preset condition or the third preset condition, the feature points in the corresponding feature cluster are removed to obtain the filtered first target feature points; Wherein, the first preset condition is that the proportion of abnormal values ​​of the displacement deviation data is greater than a first preset value; The second preset condition is that the proportion of negative values ​​in the displacement deviation data is greater than a second preset value; The third preset condition is that the distance between the feature point of the current feature cluster and the feature point of the excluded feature cluster is less than a third preset value; The step of screening out the second target feature point according to the second screening criterion includes: Get river direction; Determine coordinate information of each corresponding feature point in the first video frame and the second video frame according to the clustering output data, and obtain displacement deviation data and displacement difference direction of two adjacent frames according to the coordinate information; When the feature points of the feature cluster meet the fourth preset condition, the feature points in the feature cluster are retained; when the feature points of the feature cluster meet the fifth preset condition, the feature points in the corresponding feature cluster are removed to obtain the filtered second target feature points; The fourth preset condition is that the displacement difference direction of the feature points of the feature cluster is the same as the river direction and the displacement difference value in the displacement deviation data is less than a fourth preset value; The fifth preset condition is that the proportion of the feature points of the feature cluster whose Manhattan distance is greater than or equal to the preset distance is greater than or equal to a fifth preset value.

2. The method for identifying river flow velocity using video according to claim 1, characterized in that: The performing feature point recognition processing on the first grayscale image and the second grayscale image to obtain a first pixel coordinate set and a second pixel coordinate set respectively includes: Performing corner point detection on the first grayscale image to obtain a first pixel coordinate set; Optical flow tracing is performed based on the first grayscale image and the second grayscale image to obtain a second pixel coordinate set.

3. The method for identifying river flow velocity using a video according to claim 1, characterized in that: The actual flow rate data is calculated according to the feature points corresponding to the first target feature point set and the second target feature point set, comprising: Calculate pixel displacement differences of feature points corresponding to the first target feature point set and the second target feature point set; Obtain the change time interval of the corresponding feature point on the pixel plane; Calculate the plane velocity data on the pixel plane according to the pixel displacement difference and the change time interval; The actual flow velocity data is obtained according to the plane velocity data and the preset conversion matrix.

4. The method for identifying river flow velocity using video according to claim 1, characterized in that: When performing feature point tracking processing according to the first target feature point set and the third video frame, the river video flow rate recognition method further includes: When the feature point tracking disappears, the feature point recognition process is performed again on the first grayscale image and the second grayscale image after a preset number of video frames.

5. A computer device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the river video flow velocity identification method as described in any one of claims 1 to 4 when executing the computer program.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the river video flow velocity identification method according to any one of claims 1 to 4.

7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the river video flow velocity identification method according to any one of claims 1 to 4 is implemented.