Non-contact flow measurement method based on frame difference and space-time image velocimetry and computer device
Patent Information
- Application Number
- CN202411175700.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2044-08-26
AI Technical Summary
[0003]由于STIV方法的精度主要依赖于时空图像纹理的清晰程度和角度检测的准确性,对于河道断面较规整、非汛期流速流量较小的河道,水面平静,产生波纹、泡沫等示踪不明显,导致时空图像纹理相较于流量较大的汛期河流不明显,极大的影响了纹理主方向的检测,从而影响河流流量测量的稳定性和准确性
[0051] This invention uses consecutive frames of original images to calculate a water flow saliency map, and then overlays it with the original image to obtain an image with clear traces. This reduces the impact of insufficient traces on the river surface, which leads to unclear or missing spatiotemporal image textures.
Smart Images

Figure CN119048546B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of river flow measurement, specifically to a non-contact flow measurement method and computer device based on frame difference and spatiotemporal image velocity measurement. Background Technology
[0002] STIV (Space-time Image Velocimetry) mainly synthesizes spatiotemporal images from water surface videos captured by cameras on one side of the riverbank. It estimates the principal direction of the texture through different methods, thereby estimating the surface velocity of the river. The algorithm efficiency is more than 10 times that of cross-correlation, so it has been widely used in river velocity measurement in recent years.
[0003] Since the accuracy of the STIV method mainly depends on the clarity of the spatiotemporal image texture and the accuracy of angle detection, for rivers with relatively regular cross-sections and low flow velocity and flow rate during non-flood seasons, the water surface is calm and traces such as ripples and foam are not obvious. As a result, the spatiotemporal image texture is not obvious compared to rivers with large flow during the flood season, which greatly affects the detection of the main direction of texture, thus affecting the stability and accuracy of river flow measurement. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a non-contact flow measurement method and computer device based on frame difference and spatiotemporal image velocity measurement, which greatly improves the stability and accuracy of river flow measurement.
[0005] The present invention achieves the above objectives by adopting the following technical solution: Firstly, the present invention provides a non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement, comprising:
[0006] S1. Utilize frame difference to generate a water flow motion saliency map from the original river surface images of consecutive frames in the video sequence, and overlay it with the original river surface images to obtain a water flow image;
[0007] S2. Generate a spatiotemporal image based on the water flow image;
[0008] S3. Calculate the local texture principal direction using the local Fourier maximum angle estimation method, and calculate the local correlation coefficient C using the gradient tensor method;
[0009] The principal direction of local texture is calculated using the local Fourier maximum angle estimation method:
[0010] The spatiotemporal image is transformed into a spectral image using a two-dimensional Fourier transform, and the principal direction of the Fourier spectrum is obtained. θ m , main direction θ m Main direction of texture in spatiotemporal image δ Satisfies the following orthogonality relation: ;
[0011] The two-dimensional Fourier transform is expressed by the following formula:
[0012]
[0013] In the formula, h(x,t) It is a spatiotemporal image; F(u,v) It is the Fourier transform of the image; M, N These are the height and width of the image;
[0014] The amplitude along the horizontal and vertical straight lines centered on the spectrum is set to 0. The filter is set as an ellipse and used as the integration region, with the major and minor axes respectively... N / 8 By integrating two pixels within the range of 0°–180°, the principal direction of the spectrum can be obtained. θ m Then, the main direction of the texture is calculated using orthogonality. δ ;
[0015] Calculate the local correlation coefficient C using the gradient tensor method:
[0016] The formula for calculating the local correlation coefficient C is as follows:
[0017]
[0018]
[0019]
[0020]
[0021] and These represent the gradients of the image along the x-axis and t-axis, respectively. A Indicates the integration region;
[0022] , Δx A unit pixel in a grayscale image;
[0023] S4. Calculate the average principal direction of texture based on the principal direction of local texture and the local correlation coefficient C;
[0024] The spatiotemporal image is divided into multiple rectangular regions. The local texture principal direction and local correlation coefficient C of each rectangular region are calculated using the method in step S3. Then:
[0025] ;
[0026] This indicates the main local texture direction for each rectangular region. Indicates the principal direction of the average texture.
[0027] S5. Calculate the flow velocity and flow rate of the river surface based on the main direction of the average texture.
[0028] Furthermore, after S2 generates the spatiotemporal image, it also includes preprocessing the generated spatiotemporal image, specifically including:
[0029] The modified alpha mean filter is used to denoise the generated spatiotemporal image. f(x,t) In the pixel neighborhood, delete d Minimum value and d Calculate the remaining pixels based on the maximum value. The arithmetic mean is expressed by the following formula:
[0030] In the formula: m, n Indicates the size of the filter. S R Represents a rectangular neighborhood. d The range of values for is (0, mn / 2-1);
[0031] The following method is used to enhance the denoised spatiotemporal image using passivation masking:
[0032] , f smooth A smooth image representing a spatiotemporal picture. f mask This represents a passivated masked image;
[0033] , k This represents the preset weights. k> 1; h(x,t) This represents the spatiotemporal image after passivation and masking enhancement.
[0034] Furthermore, S1 specifically includes:
[0035] The images of the nth frame and the (n-1)th frame in the video sequence are F n and F n-1 The grayscale value of the corresponding pixel is denoted as f n x,y and f n-1 x,y The motion saliency plot at time n is as follows D n , d n x,y for Dn The elements are:
[0036]
[0037] In the formula: h For the preset threshold; k 1 ,k 2 The preset coefficients are set to values greater than 1 and less than 1, respectively.
[0038] Generate motion saliency map D n Then, the image is overlaid with the original image of the river surface to obtain a water flow image. R n , r n x,y for R n The elements are:
[0039] .
[0040] Furthermore, S2 specifically includes:
[0041] N frames of water flow image sequence are acquired at a set time interval ∆t. Then, velocity measurement lines are set parallel to the direction of water flow. The width of the velocity measurement line is 1 pixel and the length is L pixels. The grayscale of each velocity measurement line is extracted frame by frame and arranged in order from top to bottom to synthesize a spatiotemporal image of size L×N pixels.
[0042] Furthermore, S5 specifically includes:
[0043] If the surface flow characteristics of the river travel a distance along the velocity measurement line, D The time is T Corresponding to pixel motion k Intra-frame motion i If there are 100 pixels, then the average velocity of the velocity measuring line is:
[0044]
[0045] In the formula: Indicates the principal direction of the average texture. S X This represents the actual distance represented by each pixel. fps Indicates the camera's frame rate;
[0046] Vertical average velocity v Expressed as follows: , η Indicates the surface velocity coefficient;
[0047] Finally, the flow rate is calculated using the velocity-area method, as follows:
[0048] , v i This represents the average velocity along the vertical line of the interval. A i This represents the area of the interval.
[0049] Secondly, the present invention provides a computer device including a memory storing program instructions, which, when executed, perform the aforementioned non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement.
[0050] The beneficial effects of this invention are as follows:
[0051] This invention uses consecutive frames of original images to calculate a water flow saliency map, and then overlays it with the original image to obtain an image with clear traces. This reduces the impact of insufficient traces on the river surface, which leads to unclear or missing spatiotemporal image textures.
[0052] This invention applies the local Fourier maximum angle estimation method to perform angle analysis on spatiotemporal images, introduces correlation parameters, and finally calculates the average direction angle based on the direction angles obtained locally in the entire spatiotemporal image and the correlation parameters, thereby improving the robustness of the texture principal direction measurement.
[0053] This invention preprocesses the generated spatiotemporal image by denoising through a modified alpha mean filter and enhancing the image through passivation masking, thereby improving the clarity of the image texture. Attached Figure Description
[0054] Figure 1 This is a flowchart of a non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement provided in an embodiment of the present invention;
[0055] Figure 2 The images shown are spatiotemporal image preprocessing results provided in this embodiment of the invention. (a) represents the original spatiotemporal image, (b) represents the spatiotemporal image after frame difference superposition, (c) represents the image after applying modified alpha mean filtering, and (d) represents the image after passivation masking enhancement.
[0056] Figure 3 This is a schematic diagram of texture main direction determination provided in an embodiment of the present invention. (a) represents the preprocessed spatiotemporal image, (b) represents the amplitude spectrum image of (a), (c) represents the elliptical search region of (b), and (d) represents the energy-angle distribution map.
[0057] Figure 4 This is a schematic diagram of the texture principal direction solving process provided in an embodiment of the present invention;
[0058] Figure 5 These are example images of standard images with different main texture directions provided in embodiments of the present invention;
[0059] Figure 6 These are flow velocity and flow rate comparison charts provided in the embodiments of the present invention. (a) represents the vertical average flow velocity comparison chart, (b) represents the average flow velocity comparison chart, and (c) represents the flow rate comparison chart. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.
[0061] This invention provides a non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement, such as... Figure 1 As shown, it specifically includes:
[0062] Calculate the motion saliency map, and overlay the motion saliency map with the original map:
[0063] In natural river channels, without tracer particles and with short time intervals, subtle water surface movements are difficult to detect. In such cases, insufficient tracer coverage of the river surface leads to unclear or missing spatiotemporal image textures, and the measurement results cannot accurately reflect the velocity of the river surface.
[0064] Therefore, this invention utilizes consecutive frame images to calculate a saliency map of water flow motion, and overlays it with the original image to obtain an image with clear traces. Then, the STIV method is used to estimate the surface flow velocity. The images of the nth and (n-1)th frames in the video sequence are... F n and F n-1 The grayscale value of the corresponding pixel is denoted as f n x,y and f n-1 x,y The motion saliency plot at time n is as follows D n , d n x,y for D n The elements are:
[0065]
[0066] In the formula: h For the preset threshold; k 1 ,k 2The preset coefficients can be set to values greater than 1 and less than 1 respectively to highlight the motion area;
[0067] Generate motion saliency map D n Then, it is overlaid with the original image of the river surface to obtain a water flow image with clear traces. R n , r n x,y for R n The elements are:
[0068] .
[0069] Generate spatiotemporal images:
[0070] First, N frames of water flow image sequence are acquired at a certain time interval ∆t. Then, a series of velocity measurement lines are set parallel to the direction of water flow, with a width of 1 pixel and a length of L pixels. The grayscale of each velocity measurement line is extracted frame by frame and arranged in order from top to bottom to synthesize a spatiotemporal image of size L×N pixels.
[0071] Preprocessing of the generated spatiotemporal image:
[0072] While the spatiotemporal image generated by frame difference processing can produce more effective texture than the original image, it also produces noise such as salt and pepper. Therefore, the image needs to be denoised and enhanced.
[0073] Modified Alpha Mean Filter for Noise Reduction:
[0074] The modified alpha mean filter is used to denoise the generated spatiotemporal image. f(x,t) In the pixel neighborhood, delete d Minimum value and d Calculate the remaining pixels based on the maximum value. The arithmetic mean is expressed by the following formula:
[0075] In the formula: m, n Indicates the size of the filter. S R Represents a rectangular neighborhood. d The range of values for is (0, mn / 2-1);
[0076] Enhance spatiotemporal images using passivation masking, as follows:
[0077] , f smoothA smooth image representing a spatiotemporal picture. f mask This represents a passivated masked image;
[0078] , k This represents the preset weights. k> 1; h(x,t) This represents the spatiotemporal image after passivation and masking enhancement.
[0079] The result after preprocessing is as follows Figure 2 As shown.
[0080] Preprocessed spatiotemporal images inevitably still contain some noise or local texture loss, which interferes with the detection of the main texture direction. This invention applies the local Fourier maximum angle estimation method to the spatiotemporal image for angle analysis and introduces correlation parameters. C Finally, based on the direction angle and correlation parameters obtained locally from the entire spatiotemporal image, C To calculate the average direction angle, thereby improving the robustness of the texture principal direction measurement.
[0081] Calculate the local angle using the local Fourier maximum angle estimation method:
[0082] The preprocessed spatiotemporal image, such as Figure 3 As shown in (a), a spectral image is generated after two-dimensional Fourier transform, as follows: Figure 3 As shown in (b), the principal direction of the Fourier spectrum is obtained. θ m , main direction θ m Main direction of texture in spatiotemporal image δ Satisfies the following orthogonality relation: ;
[0083] The two-dimensional Fourier transform is expressed by the following formula:
[0084]
[0085] In the formula, h(x,t) It is a spatiotemporal image; F(u,v) It is the Fourier transform of the image; M, N These are the height and width of the image;
[0086] The amplitude along the horizontal and vertical straight lines centered on the spectrum is set to 0. The filter is set as an ellipse and used as the integration region, with the major and minor axes respectively... N / 8 And 2 pixels, such as Figure 3 As shown in (c), the principal direction of the spectrum can be obtained by integrating within the range of 0°–180°. θ m ,like Figure 3As shown in (d), the main direction of the texture is then calculated using orthogonality. δ .
[0087] Calculate the local correlation coefficient C using the gradient tensor method:
[0088] To evaluate the sharpness of spatiotemporal image textures and improve the accuracy of texture principal direction detection, a correlation parameter is introduced. C The calculation formula is as follows:
[0089]
[0090]
[0091]
[0092]
[0093] and These represent the gradients of the image along the x-axis and t-axis, respectively. A Indicates the integration region;
[0094] , Δx A unit pixel in a grayscale image.
[0095] Calculate the principal direction of spatiotemporal image texture:
[0096] The spatiotemporal image is divided into several rectangular regions. First, the angle and weight C (i.e., correlation coefficient C) of each region are calculated using the method described above. Regions with clearer textures have higher weights, while regions with less clear textures have lower weights. The process is as follows: Figure 4 As shown. The calculation formula is as follows:
[0097] ;
[0098] This indicates the main local texture direction for each rectangular region. Indicates the principal direction of the average texture.
[0099] After determining the principal direction of the texture, phase plane coordinates can be used ( x,y ) and actual spatial rectangular coordinates ( X,Y,Z The actual length of the speed measuring line can be obtained from the relationship between the given information and the actual length of the line, using the following formula:
[0100]
[0101] In the formula: ( X P ,Y P ,ZP ) represents the camera's actual spatial rectangular coordinates. f Represents focal length, ( Δx,Δy () indicates the lens distortion correction factor. r ij ( i,j= 1-3) are the transformation coefficients between the two coordinates.
[0102] Calculate surface velocity and flow rate:
[0103] Assume the river surface flow characteristics travel a distance along the velocity measurement line. D The time is T Corresponding to pixel motion k Intra-frame motion i If there are 100 pixels, then the average velocity of the velocity measuring line is:
[0104]
[0105] In the formula: Indicates the size of the texture angle. S X This represents the actual distance represented by each pixel (in meters per pixel). fps This indicates the camera's frame rate (in frames per second).
[0106] Vertical average velocity v It can be expressed as follows:
[0107] In the formula: η This represents the surface velocity coefficient, for natural rivers (with a sandy, pebbly, or boulder-rich bed). η = 0.8; For artificial concrete channels, η = 0.9.
[0108] Finally, the flow rate is obtained using the velocity-area method, as shown in the following formula:
[0109] In the formula: v i This represents the average velocity along the vertical line of the interval. A i This represents the area of the interval.
[0110] The present invention will be further described below with reference to specific embodiments.
[0111] The Nanchuan River originates from the Lajishan Mountains and is approximately 49.2 km long. The Nanchuan River Hydrological Station is located in Xining City, Qinghai Province, and is under the jurisdiction of the Qinghai Provincial Hydrological Resources Monitoring and Reporting Center. Based on years of calculations and calibrations at the hydrological station, the slope coefficient of the left bank is 0.8, and the slope coefficient of the right bank is 0.7. The natural river channel velocity coefficient is taken as 0.8. The ground calibration layout for the flow measurement experiment is as follows. Figure 6 As shown, the actual spatial rectangular coordinates of the ground calibration points were measured using a total station.
[0112] In this experiment, the camera was set up at an elevation of 2272m on the second terrace of the left bank of the Nanchuan River. It captured river video at a frame rate of 30 frames per second for a duration of 10 seconds. During the acquisition process, the camera was fixed with no significant shaking, and the water flow was stable. Six velocity measurement lines, each 300 pixels long, were laid parallel to the riverbank. Simultaneously, current was measured using a current meter, with measurement verticals set at distances of 14.5m, 15.5m, 16m, 17m, 17.5m, and 18m from the starting point.
[0113] Angle detection results comparison:
[0114] Before detecting the principal direction of the texture, to verify the effectiveness of different detection methods, detection is performed on images with specified texture directions generated based on a two-dimensional sine function. Randomly selected texture images are used, such as... Figure 5 As shown in Table 1, the standard texture image was calculated using the gradient tensor method, the traditional FFT method, and the improved FFT method, respectively. The calculation results for the measured spatiotemporal image are shown in Table 2.
[0115] Table 1 Comparison of Main Direction Detection Results for Standard Texture Images
[0116]
[0117] Table 2 Comparison of measured spatiotemporal image texture main direction detection results
[0118]
[0119] As shown in Table 1, when calculating the angle of a standard texture image, the average relative errors of the gradient tensor method, the traditional FFT (Fast Fourier Transform) method, and the improved FFT method are 1.44%, 3.64%, and 2.61%, respectively. This indicates that all three methods are reliable in detecting standard texture images, with the gradient tensor method showing the highest accuracy and the calculation result being closer to the standard value. The improved FFT method, compared to the traditional FFT method, improves accuracy by 1.03%. The traditional FFT method... Figure 4 The detection resulted in a large error, indicating that the traditional FFT method is not very sensitive when detecting small texture principal directions. The relative errors of the other calculation results were all around 5%, indicating good detection accuracy.
[0120] Table 2 shows that for the measured spatiotemporal images, the texture is less clear than that of the standard texture image. The gradient tensor method produces a larger error compared to the other two methods, with a maximum error of 70.72%. This indicates that the gradient tensor method has poor noise resistance and stability when detecting measured spatiotemporal images with noise and relatively unclear textures. The average relative errors of the principal directions of the texture calculated by the gradient tensor method, the traditional FFT method, and the improved FFT method are 20.25%, 4.38%, and 0.94%, respectively. This shows that the angle calculated by the improved FFT method is the most accurate among the three methods, and the calculated angle result is closer to the value obtained by human visual estimation.
[0121] Comparison of average flow velocity and flow rate calculation results:
[0122] The comparative experiment selected the vertical average flow velocity results calculated by the STIV algorithm, the traditional FFT-STIV algorithm, and a new method combining frame difference method and local Fourier maximum angle analysis, as shown in Table 3. Figure 6 As shown in (a). The vertical average velocity in Table 3 is calculated using the vertical average velocity formula of this invention, with η taken as 0.8; the vertical average velocity measured by the current meter method is the velocity at a relative water depth of 0.6. The average velocity and flow rate are calculated according to the river flow measurement specifications. The flow rate and average velocity results calculated by the current meter method are shown in Table 4. A comparison of the average velocity and flow rate results using different algorithms is shown in Table 5. Figure 6 As shown in (b) and (c).
[0123] Table 3 Comparison of Vertical Average Flow Velocity Results
[0124]
[0125] Table 4. Flow measurement results from the propeller velocity meter
[0126]
[0127] Table 5 Comparison of measurement results using different methods
[0128]
[0129] Analysis of the vertical average velocity error is shown in Table 3 and Figure 6 (a) It can be seen that the average relative error of the vertical average velocity calculated by the new method is 9.83%, which is 25.49% and 15.28% higher than that of the STIV and traditional FFT-STIV methods, respectively. This indicates that the vertical average velocity calculated by the new method is closer to the true value measured by the current meter. At the same time, due to the influence of weeds on the bank, tree shadows, and distance from the camera on the pixels, the relative errors of velocity measurement lines 1 and 5 are relatively high, while the measurement accuracy of the vertical average velocity at the other measurement points is relatively high.
[0130] Analysis of average flow velocity and flow rate error, as shown in Tables 4 and 5. Figure 6 As shown in (b) and (c), compared with the results measured by the current meter, the relative errors of the average flow velocity and flow rate calculated by the new method are 1.35% and 0.94%, respectively, which meet the monitoring requirements of hydrological stations. Its accuracy is 31.08% and 31.04% higher than the STIV method, respectively. Compared with the traditional FFT-STIV method without motion saliency mapping and local Fourier texture principal direction calculation, its accuracy is 22.7% and 23.92% higher, respectively. This indicates that in cases of low flow velocity, small flow rate, and unclear spatiotemporal image texture due to indistinct tracer characteristics, calculating the minute motions captured by motion saliency mapping and the local Fourier texture principal direction calculation are crucial to improving the accuracy of the new algorithm. It has good applicability and stability, and can provide support for the scientific management of watershed water resources. Experimental results show that the relative error of the river cross-section flow rate and average flow velocity calculated by the algorithm proposed in this invention is less than 2% compared with the current meter results, significantly improving the algorithm's accuracy and stability, and meeting the measurement requirements of practical engineering.
[0131] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement, characterized in that, include: S1. Utilize frame difference to generate a water flow motion saliency map from the original river surface images of consecutive frames in the video sequence, and overlay it with the original river surface images to obtain a water flow image; S2. Generate a spatiotemporal image based on the water flow image, and preprocess the generated spatiotemporal image. The preprocessing includes denoising the generated spatiotemporal image using a modified alpha mean filter, and enhancing the denoised spatiotemporal image using a passivation mask. S3. Calculate the local texture principal direction using the local Fourier maximum angle estimation method, and calculate the local correlation coefficient C using the gradient tensor method; The principal direction of local texture is calculated using the local Fourier maximum angle estimation method: The spatiotemporal image is transformed into a spectral image using a two-dimensional Fourier transform, and the principal direction θ of the Fourier spectrum is obtained. m The main direction θ m The principal direction δ of the texture in the spatiotemporal image satisfies the following orthogonality: ; The two-dimensional Fourier transform is expressed by the following formula: ; In the formula, h(x,t) is the spatiotemporal image; F(u,v) is the Fourier transform of the image; M and N are the height and width of the image; By setting the amplitudes on the horizontal and vertical lines centered on the spectrum to 0, and setting the filter as an ellipse and using it as the integration region, with the major and minor axes being N / 8 and 2 pixels respectively, and integrating within the range of 0°–180°, the principal spectral direction θ can be obtained. m Then, the main texture direction δ is calculated using orthogonality. Calculate the local correlation coefficient C using the gradient tensor method: The formula for calculating the local correlation coefficient C is as follows: ; ; ; ; and Let A represent the gradient of the image along the x-direction and t-direction, respectively, and let A represent the integration region. Δx is one unit pixel in the grayscale image; S4. Calculate the average principal direction of texture based on the principal direction of local texture and the local correlation coefficient C; The spatiotemporal image is divided into multiple rectangular regions. The local texture principal direction and local correlation coefficient C of each rectangular region are calculated using the method in step S3. Then: ; This indicates the main local texture direction for each rectangular region. Indicates the principal direction of the average texture; S5. Calculate the flow velocity and flow rate of the river surface based on the main direction of the average texture.
2. The non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement according to claim 1, characterized in that, In step S2, the generated spatiotemporal image is denoised using a modified alpha mean filter, specifically including: Modified alpha mean filtering involves removing d minimum and d maximum values from the pixel neighborhood of the spatiotemporal image f(x,t) and calculating the remaining pixels. The arithmetic mean is expressed by the following formula: In the formula: m and n represent the filter size, S R Let d represent a rectangular neighborhood, and the range of values for d is (0, mn / 2-1). The following method is used to enhance the denoised spatiotemporal image using passivation masking: f smooth A smoothed image representing a spatiotemporal picture, f mask This represents a passivated masked image; k represents the preset weight, k>1; h(x,t) represents the spatiotemporal image after passivation masking enhancement.
3. The non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement according to claim 1, characterized in that, S1 specifically includes: The images of the nth frame and the (n-1)th frame in the video sequence are F n and F n-1 The grayscale value of the corresponding pixel is denoted as f. n x,y and f n -1 x,y The motion saliency plot at time n is D. n d n x,y D n The elements are: ; In the formula: h is the preset threshold; k1 and k2 are preset coefficients, set to values greater than 1 and less than 1, respectively; Generate motion saliency map D n Then, it is overlaid with the original image of the river surface to obtain the water flow image R. n r n x,y For R n The elements are: 。 4. The non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement according to claim 1, characterized in that, S2 specifically includes: N frames of water flow image sequence are acquired at a set time interval ∆t. Then, velocity measurement lines are set parallel to the direction of water flow. The width of the velocity measurement line is 1 pixel and the length is L pixels. The grayscale of each velocity measurement line is extracted frame by frame and arranged in order from top to bottom to synthesize a spatiotemporal image of size L×N pixels.
5. The non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement according to claim 1, characterized in that, S5 specifically includes: If the distance the surface flow feature of the river travels along the velocity line is D, and the time is T, corresponding to the pixel movement of i pixels within k frames, then the average flow velocity of the velocity line is: ; In the formula: S represents the principal direction of the average texture. X This represents the actual distance represented by each pixel, and fps represents the camera's frame rate. The vertical average velocity v is expressed by the following formula: η represents the surface velocity coefficient; Finally, the flow rate is calculated using the velocity-area method, as follows: v i A represents the average velocity along the vertical line of the interval. i This represents the area of the interval.
6. A computer device comprising a memory storing program instructions, characterized in that, When the program instructions are executed, the non-contact flow measurement method based on frame difference and spatiotemporal image velocity measurement as described in any one of claims 1-5 is performed.