A method for detecting texture direction angles of river surface spatiotemporal images based on spectrum adaptive mask

By using a spectrum adaptive masking method, combined with triangular thresholding, boundary tracking and least squares method, and LSD line segment detection algorithm, the false detection problem of frequency domain spatiotemporal image texture angle detection in complex noise scenes is solved, and high-precision online monitoring of river flow velocity is realized.

CN119444822BActive Publication Date: 2025-10-28HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411474934.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-10-28
Estimated Expiration
2044-10-22

AI Technical Summary

Technical Problem

Existing frequency domain spatiotemporal image texture angle detection methods are prone to false detections in complex noise scenarios, and fixed detection parameters are prone to errors in different noise interference scenarios, making it difficult to meet the real-time and accuracy requirements of river flow velocity measurement.

Method used

A spectrum-adaptive mask-based approach is adopted, which binarizes the amplitude spectrum using the triangular thresholding method, combines boundary tracking and least squares method to fit the elliptical mask, uses the LSD line segment detection algorithm to construct a DC mask to remove the influence of DC noise, and uses a coarse-to-fine texture orientation angle detection strategy to identify the validity of the detection results by combining the difference between coarse and fine localization.

Benefits of technology

It effectively eliminates DC noise interference, improves the accuracy of texture orientation angle detection, and is suitable for online monitoring of river flow velocity in complex noise environments, thus improving detection accuracy and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444822B_ABST
    Figure CN119444822B_ABST
Patent Text Reader

Abstract

This invention discloses a method for detecting the texture orientation angle of a river surface in a spatiotemporal image based on a spectrum adaptive mask, comprising the following steps: Step 1, acquiring a spatiotemporal image and its amplitude spectrum on a velocity measurement line using an image-based flow measurement system; Step 2, binarizing the amplitude spectrum using the triangular thresholding method and extracting the highlighted portion; Step 3, performing contour extraction and ellipse fitting on the binarized amplitude spectrum from Step 2 using boundary tracking and least squares methods to obtain an elliptical mask, and using its minor and major semi-axes for subsequent texture angle detection; Step 4, constructing a DC mask based on the LSD straight line segment detection algorithm and applying it to the amplitude spectrum to remove DC interference; Step 5, performing coarse-to-fine texture orientation angle detection based on the major and minor semi-axes of the elliptical mask from Step 3; Step 6, identifying the validity of the detection results based on the difference between coarse and fine localization. This invention can eliminate DC noise in the spatiotemporal image amplitude spectrum, achieve adaptive value selection for the integration radius parameter, improve the accuracy of texture orientation angle detection under various noise interferences, and identify the validity of the detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spatiotemporal image texture orientation recognition technology, and in particular to a method for detecting the texture orientation angle of a river surface spatiotemporal image based on a spectrum adaptive mask. Background Technology

[0002] Measuring river flow velocity has always been a hot research topic. Traditional measurement methods are no longer sufficient to meet the demands in terms of accuracy, timeliness, and safety. Addressing the challenges of equipment deployment during floods, the difficulty in measuring flow velocity, and the challenge of real-time river monitoring, coupled with significant advancements in internet technology, a series of non-invasive, low-cost, and highly efficient image-based velocity measurement technologies have emerged in recent decades. Currently, the most well-developed image-based velocity measurement technologies include Large Scale Particle Image Velocimetry (LSPIV), Large Scale Particle Tracking Velocimetry (LSPTV), and Space-Time Image Velocimetry (STIV). Among these algorithms, LSPIV's detection accuracy is highly sensitive to the selected window size; a window that is too small will result in the loss of target information, while a window that is too large will reduce spatial resolution. Furthermore, the LSPIV algorithm has a high learning cost, complex parameter settings, and a long time required for cross-correlation calculations, making it unable to obtain the flow velocity of the measured area in real time. The LSPTV algorithm, on the other hand, requires pre-deployment of tracer particles and high-precision video capture, demanding high image resolution, high video image processing costs, complex parameter settings, and long processing time. Therefore, it cannot meet the requirements for automated flow velocity measurement and has poor real-time performance. In addition, the LSPTV algorithm is limited and performs poorly in complex outdoor scenarios, such as uneven lighting or the absence of tracer particles. Compared to these two algorithms, the Spatiotemporal Image Velometry (STIV) method has great potential and application prospects due to its high spatial resolution and low time complexity. Moreover, this algorithm does not require pre-deployment of tracer particles and can quickly obtain the cross-sectional flow velocity distribution of the water surface being measured.

[0003] The core technology of spatiotemporal image velocimetry lies in how to accurately detect the main direction of texture from spatiotemporal images. Currently used spatiotemporal image texture angle detection methods mainly include the gradient tensor method and the frequency domain spatiotemporal image texture angle detection method. Among them, the frequency domain spatiotemporal image texture angle detection method is widely used due to its computational efficiency. This method mainly uses Fourier transform to convert the spatiotemporal image from the spatial domain to the frequency domain. Based on the Fourier self-registration property, the texture in the spatiotemporal image is redistributed in the frequency domain. Textures in the same direction are superimposed in the amplitude spectrum to form a bright band passing through the center of the amplitude spectrum, which is the effective spectral line. Moreover, the direction of this spectral line is orthogonal to the direction of the spatiotemporal image texture. By finding the direction of the spectral line, the direction of the spatiotemporal image texture can be calculated. Currently, the main approach involves setting an integration radius, calculating the angular energy distribution curve of the amplitude spectrum using polar coordinate projection, and then determining the spectral line direction through peak finding. However, this method is only suitable for scenarios with good environmental conditions and clear spatiotemporal image textures. For complex noisy scenarios (such as glare, turbulence, and ripples), especially scenarios with sidelobe interference in the amplitude spectrum and scenarios where the DC component diffuses and the brightness is higher than the effective spectral line, false detections often occur, resulting in gross errors. To address this issue, Fujita et al. proposed a fan-shaped filter method, but this method requires setting numerous parameters and lacks robustness. Zhang et al. conducted parameter sensitivity analysis on this method and obtained the optimal parameter values, but the experimental data only involved six common scenarios collected from the same hydrological station, excluding complex noisy scenarios. Therefore, existing frequency domain spatiotemporal image velocimetry methods still face problems such as the inability to eliminate image noise and the tendency for fixed detection parameters to cause false detections in different noise interference scenarios. Summary of the Invention

[0004] Purpose of the invention: This invention provides a method for detecting the texture orientation angle of a river surface in a spatiotemporal image based on a spectrum adaptive mask. It can eliminate DC noise in the amplitude spectrum of the spatiotemporal image, and achieve adaptive value of the integration radius parameter, thereby improving the accuracy of texture orientation angle detection under various noise interferences, and identifying the validity of the detection results.

[0005] Technical solution: The present invention provides a method for detecting the spatiotemporal image texture orientation angle of a river surface based on a spectrum adaptive mask, comprising the following steps:

[0006] Step 1: Use the image-based flow measurement system to obtain the spatiotemporal image and amplitude spectrum of the velocity measurement line;

[0007] Step 2: Based on the triangular thresholding method, binarize the amplitude spectrum and extract the highlighted part of the amplitude spectrum;

[0008] Step 3: Based on boundary tracking and least squares method, perform contour extraction and ellipse fitting on the binarized amplitude spectrum in step 2 to obtain an ellipse mask, and use its minor and major semi-axis for subsequent texture angle detection.

[0009] Step 4: Based on the LSD line segment detection algorithm, construct a DC mask and apply it to the amplitude spectrum to remove the DC influence;

[0010] Step 5: Based on the major and minor semi-axes of the elliptical mask in Step 3, perform texture direction angle detection from coarse to fine.

[0011] Step 6: Identify the validity of the detection results based on the difference between coarse and fine positioning.

[0012] Furthermore, in step 1, the spatiotemporal image and its amplitude spectrum on the velocity measurement line are obtained using the image method flow measurement system. The spatiotemporal image is constructed by capturing image sequences through river video, and the amplitude spectrum is obtained by performing a two-dimensional discrete Fourier transform on it.

[0013] Furthermore, in step 2, the threshold T is determined based on the triangular thresholding method, and the amplitude spectrum is divided into two parts, background and foreground, by equation (1), so that the gray value of the foreground part related to texture in the amplitude spectrum is 1, and the gray value of the background part unrelated to texture angle is 0, thereby obtaining the binarized amplitude spectrum |F2(u,v)|.

[0014]

[0015] Where |F(u,v)| represents the spatiotemporal image amplitude spectrum, u represents the horizontal axis, v represents the vertical axis, T represents the binarization threshold calculated by the triangular thresholding method, and |F2(u,v)| represents the binarization amplitude spectrum.

[0016] Furthermore, in step 3, based on boundary tracking and the least squares method, contour extraction and ellipse fitting are performed on the binarized amplitude spectrum from step 2 to obtain an elliptical mask. Subsequent texture angle detection is then performed using its minor and major semi-axes, specifically including the following steps:

[0017] Step 31: Based on the boundary tracking method, extract the outer contour of the part with a gray value of 1 in the binary amplitude spectrum, and traverse the image from left to right and from top to bottom to search for foreground points in the eight neighborhood counterclockwise method to obtain the set of outer boundary points of the foreground region, that is, the outer contour of the high-brightness spectral lines of the extracted amplitude spectrum and the texture-related part, so as to facilitate the subsequent ellipse fitting process.

[0018] Step 32: Based on the least squares method, perform ellipse fitting on the contour extraction results. The purpose is to obtain the major and minor axis parameters of the ellipse that includes the bright spectral lines in the amplitude spectrum and the texture-related part. The fitted ellipse mask includes the high-frequency part of the effective spectral lines passing through the center of the amplitude spectrum. Therefore, the major and minor axis parameters of the ellipse have a range inclusion relationship with the length of the effective bright spectral lines in the amplitude spectrum. This parameter can be used as the integration radius to detect the texture direction angle.

[0019] Furthermore, in step 4, based on the LSD line segment detection algorithm, a DC mask is constructed and applied to the amplitude spectrum to remove the DC influence. Specifically, the LSD algorithm is first used to perform line detection on the amplitude spectrum |F(u,v)|, and lines in the LSD line detection results with an angle difference of 1° from the horizontal and vertical directions are selected. Then, all the selected lines (x...) are used to... i1 ,y i1 ,x i2 ,y i2 The width w of the mask is determined by equation (2). If no straight line is detected, the width of the mask is 0.

[0020]

[0021] Where M represents the height of the amplitude spectrum |F(u,v)|, and L represents the width of the amplitude spectrum |F(u,v)|;

[0022] The DC mask mask(u,v) is constructed by equation (3), and applied to the amplitude spectrum by equation (4) to remove the gross error of the DC component on texture angle detection. The DC mask mask(u,v) has the same size as the amplitude spectrum |F(u,v)|.

[0023]

[0024] |F3(u,v)|=|F(u,v)|×mask(u,v) (4) where mask(u,v) is the constructed DC mask, |F(u,v)| is the original amplitude spectrum, and |F3(u,v)| is the DC-removed amplitude spectrum.

[0025] Furthermore, in step 5, based on the major and minor semi-axes of the elliptical mask in step 3, the texture orientation angle detection is performed from coarse to fine, specifically including the following steps:

[0026] Step 51: Using equation (5), sum the square terms of the amplitude spectrum with the minor semi-axis b of the ellipse as the integration radius and the polar coordinate projection method to obtain the energy angle distribution curve. The angle corresponding to the peak point on the curve is the coarse positioning MOT1 of the main direction of the spectrum.

[0027]

[0028] Where the water flow direction is from left to right, θ takes a value from 90° to 180°, and vice versa, it takes a value from 0° to 90°.

[0029] Step 52: Using equation (6), sum the square terms of the amplitude spectrum with the semi-major axis a of the ellipse as the integral radius in polar coordinate projection to obtain the energy angle distribution curve. The peak search range is limited to [MOT1-10, MOT1+10]. The angle corresponding to the peak point in this range on the curve is the final fine positioning MOT2 of the main direction of the spectrum. Finally, the final spatiotemporal image texture angle MOS is obtained through equation (7).

[0030]

[0031] Where θ takes the same value as above;

[0032] MOS = MOT2-90 (7).

[0033] Furthermore, in step 6, the validity of the detection results is identified based on the difference between coarse and fine positioning. Using formula (8), the detection results with a difference of less than or equal to 5° between the coarse and fine positioning angles are marked as valid, i.e., the results are considered reliable. The detection results with a difference of more than 5° between the coarse and fine positioning angles are marked as invalid, i.e., the results are considered unreliable. The detection results can be corrected based on these results in the future.

[0034]

[0035] Here, 1 indicates that the test result is marked as reliable, and 0 indicates that the test result is marked as unreliable.

[0036] Beneficial Effects: Compared with existing technologies, this invention has the following significant advantages: This invention constructs a DC mask using the LSD straight segment detection algorithm and applies it to the spatiotemporal image amplitude spectrum to remove the influence of horizontal and vertical DC component noise, solving the problem of gross errors caused by DC components in traditional methods. Furthermore, this invention introduces a method combining amplitude spectrum binarization, contour extraction, and ellipse fitting to construct an elliptical signal mask that adaptively determines the size of the integration radius. It proposes a coarse-to-fine search strategy based on polar coordinate projection, using the minor and then the major semi-axis as the integration radius, to detect texture direction angles. This solves the problem of gross errors easily caused by fixing the integration radius in traditional algorithms, improving the detection accuracy of spatiotemporal image velocimetry in various noise scenarios. This invention can be used for measuring the time-averaged flow velocity field of natural tracer water flows such as river surfaces, and is particularly suitable for online monitoring of river flow velocity in environments with significant noise. Attached Figure Description

[0037] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0038] Figure 2(a) is an example 1 of the spatiotemporal image obtained by the present invention.

[0039] Figure 2(b) shows the amplitude spectrum corresponding to Example 1 of the spatiotemporal image obtained by the present invention.

[0040] Figure 3(a) is an example 2 of the spatiotemporal image obtained by the present invention.

[0041] Figure 3(b) shows the amplitude spectrum corresponding to Example 2 of the spatiotemporal image obtained by the present invention.

[0042] Figure 4(a) is a schematic diagram of the amplitude spectrum gray level distribution histogram and the results of the triangular thresholding method in Example 1 of the present invention.

[0043] Figure 4(b) is a schematic diagram of the amplitude spectrum grayscale distribution histogram and the results of the triangular thresholding method in Example 2 of the present invention.

[0044] Figure 5(a) is a schematic diagram of the amplitude spectrum binarization result of Example 1 of the present invention.

[0045] Figure 5(b) is a schematic diagram of the amplitude spectrum binarization result of Example 2 of the present invention.

[0046] Figure 6 This is a schematic diagram illustrating the contour extraction principle of the present invention.

[0047] Figure 7(a) is a schematic diagram of binary amplitude spectrum contour extraction in Example 1 of the present invention.

[0048] Figure 7(b) is a schematic diagram of binary amplitude spectrum contour extraction in Example 2 of the present invention.

[0049] Figure 8(a) is a schematic diagram of the amplitude spectrum ellipse fitting result of Example 1 of the present invention.

[0050] Figure 8(b) is a schematic diagram of the amplitude spectrum ellipse fitting result of Example 2 of the present invention.

[0051] Figure 9(a) is a schematic diagram of the DC mask result of Example 1 of the present invention.

[0052] Figure 9(b) is a schematic diagram of the DC mask result of Example 2 of the present invention.

[0053] Figure 10(a) shows the energy angle distribution curve of coarse positioning detection of the short semi-axis in Example 1 of the present invention.

[0054] Figure 10(b) is a visualization of the integral radius and detection result of the coarse positioning detection spectrum of the short semi-axis in Example 1 of the present invention.

[0055] Figure 10(c) is a visualization of the spatiotemporal image detection results of coarse localization detection of the short semi-axis in Example 1 of the present invention.

[0056] Figure 11(a) shows the energy angle distribution curve of coarse positioning detection of the short semi-axis in Example 2 of the present invention.

[0057] Figure 11(b) is a visualization of the integral radius and detection result of the short semi-axis coarse positioning detection spectrum in Example 2 of the present invention.

[0058] Figure 11(c) is a visualization of the spatiotemporal image detection results of coarse localization detection of the short semi-axis in Example 2 of the present invention.

[0059] Figure 12(a) shows the energy angle distribution curve of the long semi-axis precision positioning detection in Example 1 of the present invention.

[0060] Figure 12(b) is a visualization of the integral radius and detection result of the long semi-axis fine positioning detection spectrum in Example 1 of the present invention.

[0061] Figure 12(c) is a visualization of the spatiotemporal image detection results of the long semi-axis fine positioning detection in Example 1 of the present invention.

[0062] Figure 13(a) shows the energy angle distribution curve for the long semi-axis precision positioning detection in Example 2 of the present invention.

[0063] Figure 13(b) is a visualization of the integral radius and detection result of the long semi-axis fine positioning detection spectrum in Example 2 of the present invention.

[0064] Figure 13(c) is a visualization of the spatiotemporal image detection results of the long semi-axis fine positioning detection in Example 2 of the present invention.

[0065] Figure 14(a) shows the detection energy angle distribution curve of Example 1 of the present invention using the conventional method.

[0066] Figure 14(b) is a visualization of the detection spectrum integral radius and detection results using the conventional method in Example 1 of the present invention.

[0067] Figure 14(c) is a visualization of the spatiotemporal image detection results using the conventional method in Example 1 of the present invention.

[0068] Figure 15(a) shows the detection energy angle distribution curve of Example 2 of the present invention using the conventional method.

[0069] Figure 15(b) is a visualization of the detection spectrum integral radius and detection results using the conventional method in Example 2 of the present invention.

[0070] Figure 15(c) is a visualization of the spatiotemporal image detection results using the conventional method in Example 2 of the present invention.

[0071] Figure 16(a) is a schematic diagram of the validity identification mark of the present invention being unreliable, and a visualization of the spatiotemporal image detection results of short semi-axis coarse positioning.

[0072] Figure 16(b) is a schematic diagram of the validity identification mark of the present invention being unreliable, and a visualization of the spatiotemporal image detection results of the long semi-axis fine positioning. Detailed Implementation

[0073] like Figure 1 As shown, a method for detecting the texture orientation angle of a river surface in a spatiotemporal image based on a spectrum adaptive mask includes the following steps:

[0074] S1: To obtain the spatiotemporal image and amplitude spectrum of the velocity measurement line using the image-based flow measurement system, it is first necessary to connect a camera, set the measurement time interval, download the river video file, capture the image sequence of the specified velocity measurement line location through the river video, construct a spatiotemporal image f(x,y) with the velocity measurement line image sequence as the horizontal axis and time as the vertical axis (image size set to L*M), and perform a two-dimensional discrete Fourier transform on it using equation (9):

[0075]

[0076] The amplitude spectrum is obtained by using the root of the sum of squares of the real part R(u,v) and the imaginary part I(u,v) from equation (10):

[0077] |F(u,v)|=[R 2 (u,v)+I 2 (u,v)] 1 / 2 (10)

[0078] Where u represents the abscissa of the amplitude spectrum and v represents the ordinate of the amplitude spectrum, the resulting spatiotemporal image example 1 and the amplitude spectrum annotation diagram are shown in Figure 2, and the resulting spatiotemporal image example 2 and its amplitude spectrum schematic diagram are shown in Figure 3. As can be seen from the figures, the spatiotemporal images exhibit obvious interference from nighttime pixels, turbulence, wind waves, and glare noise. In addition to the effective spectral lines passing through the center of the spectrum, the corresponding amplitude spectra also show sidelobe noise interference not passing through the image center and obvious DC component noise interference. The presence of these interferences can easily lead to false detections of texture angles.

[0079] S2: Determine the threshold T based on the triangular thresholding method and perform binarization processing on the amplitude spectrum. The triangular thresholding method is mainly used because this method is suitable for images with a single peak in the gray-level histogram, which is consistent with the gray-level histogram characteristics of the amplitude spectrum. The triangular thresholding method includes the following steps: First, obtain the gray-level distribution histogram of the image. Construct a straight line from the highest peak bmax to the darkest point bmin on the histogram. If the highest peak is biased to the left, then bmin is taken as the rightmost point. If the highest peak is biased to the right, then bmin is taken as the leftmost point. As shown in equation (11), calculate the vertical distance from each corresponding histogram b to the straight line starting from bmin until bmax. The histogram position corresponding to the maximum distance is the threshold T.

[0080] T = b where L(b) max (11)

[0081] Where L(b) is the distance between the point on the histogram and the constructed line, and b is the gray value corresponding to the point obtained on the histogram. For the amplitude spectrum, the spectral line corresponding to the texture often presents a large gray value. By using equation (12), the gray values ​​of pixels with gray values ​​greater than the threshold T in the amplitude spectrum are set to 1, and the gray values ​​of pixels with gray values ​​less than or equal to the threshold T are set to 0 to obtain the binarized amplitude spectrum |F2(u,v)|, thereby segmenting out the bright part in the amplitude spectrum, that is, the part corresponding to the texture spectral line. The gray distribution histogram of Example 1 and the schematic diagram of the result of the triangular thresholding method are shown in Figure 4. The gray distribution histogram of Example 2 and the schematic diagram of the result of the triangular thresholding method are shown in Figure 5. The final binarized amplitude spectrum effect diagrams of the two examples are shown in Figure 5. Figure 6 As shown.

[0082] It can be seen that the part of the amplitude spectrum related to the bright spectral lines can be effectively extracted from the background using this method.

[0083]

[0084] Where T represents the binarization threshold calculated by the triangular thresholding method, and |F2(u,v)| represents the binarized amplitude spectrum.

[0085] S3: Contour extraction and ellipse fitting are performed on the binarized image based on boundary tracking and least squares method. Specifically, the boundary tracking method extracts the outer contour of the portion with a grayscale value of 1 in the binarized amplitude spectrum. A schematic diagram of the principle is shown below. Figure 6 The specific steps are as follows: Scan the image from left to right and from top to bottom, find the foreground point with a value of 1 in the upper left corner and mark it as p0, and mark the adjacent point above p0 as q0; with p0 as the center and q0 as the starting point, conduct an eight-neighborhood counterclockwise search, and record the next foreground point found as p1, and the background point that is adjacent to and appears before p1 as q1; then repeat the above steps with p1 as the center and q1 as the starting point to conduct an eight-neighborhood counterclockwise search until p0 is scanned again and the scanning stops. At this time, the obtained sequence p is the set of boundary points in the foreground region, that is, the outer contour of the binary amplitude spectrum. The two example contour extraction effect diagrams are shown in Figure 7. Subsequently, based on the least squares method, the contour extraction result is fitted with an ellipse to construct an elliptical signal mask. The purpose is to obtain the major and minor axis parameters of the ellipse containing the bright spectral lines in the amplitude spectrum and the texture-related part. This parameter has a range inclusion relationship with the effective spectral line length of the amplitude spectrum. This parameter can be used as the integration radius for texture angle detection. Among them, the fitted plane ellipse equation is as shown in equation (13):

[0086] x 2 +Axy+By 2 +Cx+Dy+E=0 (13)

[0087] According to the least squares principle, the fitted objective function is given by equation (14):

[0088]

[0089] To minimize F, the partial derivatives of F must be zero. That is, the values ​​of A, B, C, D, and E can be obtained through equation (15), and the major and minor axes of the ellipse can be calculated according to equation (16), where a is the major axis and b is the minor axis.

[0090]

[0091]

[0092] Figure 8 shows the fitting results of two example ellipses. In Example 1, the ellipse fitted has a minor axis width of 25 pixels and a major axis width of 39 pixels. In Example 2, the ellipse fitted has a minor axis width of 25 pixels and a major axis width of 107 pixels. It can be seen that the ellipse fitted by Example 1 exactly includes the effective spectral lines passing through the center, while the ellipse fitted by Example 2 includes not only the effective spectral lines passing through the center but also some sidelobe spectral lines. Overall, the effective spectral line length is exactly within the range of the minor and major axes, which allows for subsequent coarse-to-fine texture angle detection based on the integration radius of the minor and major axes.

[0093] S4: Based on the LSD (Line Segment Detector) line segment detection algorithm, an adaptive DC mask is constructed according to the amplitude spectrum characteristics to remove the DC influence. The LSD algorithm extracts lines by combining image gradient and direction information. First, by calculating the gradient of each pixel, a corresponding gradient field is generated, and pixels with the same gradient within a certain threshold are connected to form a line support region. Second, a minimum bounding rectangle is generated for each line support region, and the principal axis of the rectangle represents the principal axis direction of the line support region. Finally, the line is judged for each rectangle according to the Helmholtz principle to obtain the final detection result. LSD is chosen mainly because the algorithm can obtain sub-pixel level line detection results in linear time, has strong robustness, and has high computational efficiency, making it very suitable for online automatic detection. The parameters involved in the LSD algorithm all use the default parameters of the function createLineSegmentDetector. The construction of the DC mask is mainly achieved by calculating the angle (x1, y1, x2, y2) of each line detection result of LSD and controlling the slope through equation (17).

[0094]

[0095] By using equation (18), straight lines with an angular difference of 1° from the horizontal and vertical directions are selected. These straight lines correspond to the edges of the horizontal and vertical DC spectral lines in the amplitude spectrum.

[0096]

[0097] Where θ is 1 to indicate retention and 0 to indicate rejection. Using all the filtered lines (x... i1 ,y i1 ,x i2 ,y i2 The width x of the horizontal mask and the width y of the vertical mask are determined by equation (19). If no straight line is detected, the width x of the horizontal mask and the width y of the vertical mask are both set to 0.

[0098]

[0099] A DC mask mask (u,v) is constructed using equation (20), where the size of mask (u,v) is the same as that of the amplitude spectrum |F(u,v)|. Then, it is applied to the amplitude spectrum using equation (21) to remove the gross error influence of the DC component on texture angle detection.

[0100]

[0101] |F3(u,v)|=|F(u,v)|×mask(u,v) (21)

[0102] Figure 9 shows the DC masking results obtained from two examples of this method. It can be seen that different DC masks can be obtained for amplitude spectra with different DC characteristics using this method. The effect of Example 1 is shown in Figure 9(a). Since there is no obvious DC component in Example 1, the LSD algorithm did not detect any straight line, and the resulting DC mask width is 0, which is equivalent to no masking. The effect of Example 2 is shown in Figure 9(b). Since there is an obvious DC component in Example 2, the LSD algorithm can detect the straight line corresponding to the DC, and the resulting DC mask width is 1. After adding the cross mask, the DC interference can be removed from the amplitude spectrum. The above results show that the DC masking method can adaptively adjust the mask shape according to the amplitude spectrum distribution characteristics and has strong robustness.

[0103] S5: Using equation (22), the summation of the squared terms of the amplitude spectrum by means of polar coordinate projection with the minor semi-axis b of the ellipse as the integration radius is used to obtain the energy angle distribution curve P1(θ). The angle corresponding to the peak point on the curve is the coarse localization MOT1 of the main direction of the spectrum. The detection results of Example 1 are shown in Figure 10, and the detection results of Example 2 are shown in Figure 11. Among them, Figure (a) is the energy angle distribution diagram, Figure (b) is the visualization diagram of the amplitude spectrum integration radius and detection results. The radius corresponding to the white circle in the figure is the size of the obtained minor semi-axis. Figure (c) is the visualization diagram of the spatiotemporal image detection results. It can be seen that the angle position corresponding to the effective spectral line shows a relatively obvious peak in the energy angle distribution curve, and the obtained detection results are also relatively accurate. The value of Example 1 is 44.0°, and the value of Example 2 is 60.3°. Considering that the minor semi-axis is shorter than the length of the effective spectral line, the entire effective spectral line is not fully utilized. This result is only used as a coarse localization. Further fine localization is required.

[0104]

[0105] The direction of water flow is from left to right, and θ ranges from 90° to 180°. Conversely, it ranges from 0° to 90°.

[0106] S5.2: By using equation (23) with the semi-major axis a of the ellipse as the integral radius and the coordinate projection method, the square term of the amplitude spectrum is summed to obtain the energy angle distribution curve P2(θ). The range of the peak point is limited to [MOT1-10, MOT1+10]. The angle corresponding to the peak point in this range on the curve is the final fine positioning MOT2 of the main direction of the spectrum. Finally, the final spatiotemporal image texture angle MOS is obtained by equation (24). The results of Example 1 are shown in Figure 12, and the results of Example 2 are shown in Figure 13. The texture angle detection angles are 44.3° and 56.4°, respectively. It can be seen that in the energy angle distribution map of Example 2, in addition to the angle position corresponding to the effective spectral line, there is a more obvious peak on the right. This is because the amplitude spectrum has a high brightness sidelobe caused by the interference of environmental noise (such as ripples, glare, etc.). When calculating the angle energy distribution curve using the semi-major axis, some sidelobes are included. At this time, using a coarse positioning search range of 10° to the left and right can effectively avoid searching for the peak to the sidelobe and thus causing false detection. Moreover, the semi-major axis range completely includes the entire effective spectral line, and the obtained result is more reliable. This is also the reason for using the coarse-to-fine detection strategy as the final detection result.

[0107]

[0108] MOS = MOT2-90 (24)

[0109] Figures 14 and 15 show the detection results of Examples 1 and 2 respectively, using the traditional method, i.e., without using a DC mask and with the integration radius fixed at half the image width. It can be seen that this method detects the direction of side lobes and noise rather than the direction of the true effective spectral lines, thus leading to false detections. In contrast, this method avoids the interference of side lobes and DC components and obtains the correct detection results, demonstrating the effectiveness and robustness of this method.

[0110] S6: Finally, using formula (25), the detection results with a difference of less than 5° between the coarse positioning angle and the fine positioning angle are marked as valid, that is, the detection results are considered reliable. The detection results with a difference of more than 5° between the coarse positioning angle and the fine positioning angle are marked as invalid, that is, the detection results are considered invalid. The detection results can be corrected based on this result in the future.

[0111]

[0112] In this system, 1 indicates that the detection result is marked as reliable by MOS, and 0 indicates that the detection result is marked as unreliable. In Example 1, the texture angle obtained by coarse localization using the short half-axis is 44.0°, and the texture angle obtained by fine localization using the long half-axis is 44.3°. The error between the two angles is 0.3°, which is less than 5 degrees, so the detection result is considered reliable. In Example 2, although the spatiotemporal image is affected by glare and ripples, the texture is relatively continuous and clear. The texture angle obtained by coarse localization using the short half-axis is 60.3°, and the texture angle obtained by fine localization using the long half-axis is 56.4°. The error between the two angles is 3.9°, which is less than 5 degrees, so the detection result is considered reliable. (Figure 1) The spatiotemporal image texture in Figure 6 is sparse, discontinuous, and directionally ambiguous. Furthermore, the background texture direction is inconsistent with the bright band texture direction, and the definition of the true texture direction is controversial. The texture angle obtained by coarse localization using the short semi-axis is 69.3°, as shown in Figure 16(a). The texture angle obtained by fine localization using the long semi-axis is 60.6°, as shown in Figure 16(b). The error between the two angles is 8.7°, which exceeds 5°. Therefore, the detection result is considered unreliable, and texture angle correction measures can be designed to correct the detection result.

Claims

1. A method for detecting the texture orientation angle of a river surface in a spatiotemporal image based on a spectrum-adaptive mask, characterized in that, Includes the following steps: Step 1: Use the image-based flow measurement system to obtain the spatiotemporal image and amplitude spectrum of the velocity measurement line; Step 2: Based on the triangular thresholding method, binarize the amplitude spectrum and extract the highlighted part of the amplitude spectrum; Step 3: Based on boundary tracking and least squares method, perform contour extraction and ellipse fitting on the binarized amplitude spectrum in step 2 to obtain an ellipse mask, and use its minor and major semi-axis for subsequent texture angle detection. Step 4: Based on the LSD line segment detection algorithm, construct a DC mask and apply it to the amplitude spectrum to remove the DC influence; Step 5: Based on the major and minor semi-axes of the elliptical mask in Step 3, perform texture orientation angle detection from coarse to fine; specifically including the following steps: Step 51: Using equation (5), sum the square terms of the amplitude spectrum with the minor semi-axis b of the ellipse as the integration radius and the polar coordinate projection method to obtain the energy angle distribution curve. The angle corresponding to the peak point on the curve is the coarse positioning MOT1 of the main direction of the spectrum. Where the water flow direction is from left to right, θ takes a value from 90° to 180°, and vice versa, it takes a value from 0° to 90°. Step 52: Using equation (6), sum the square terms of the amplitude spectrum with the semi-major axis a of the ellipse as the integral radius in polar coordinate projection to obtain the energy angle distribution curve. The peak search range is limited to [MOT1-10, MOT1+10]. The angle corresponding to the peak point in this range on the curve is the final fine positioning MOT2 of the main direction of the spectrum. Finally, the final spatiotemporal image texture angle MOS is obtained through equation (7). Where θ takes the same value as above; MOS = MOT2-90 (7); Step 6: Identify the validity of the detection results based on the difference between coarse and fine positioning.

2. The method for detecting the spatiotemporal image texture orientation angle of a river surface based on a spectrum adaptive mask as described in claim 1, characterized in that, In step 1, the spatiotemporal image and its amplitude spectrum on the velocity measurement line are obtained using the image method flow measurement system. The spatiotemporal image is constructed by capturing image sequences through river video, and the amplitude spectrum is obtained by performing a two-dimensional discrete Fourier transform on it.

3. The method for detecting the spatiotemporal image texture orientation angle of a river surface based on a spectrum adaptive mask as described in claim 1, characterized in that, In step 2, the threshold T is determined based on the triangular thresholding method. The amplitude spectrum is divided into two parts, background and foreground, by equation (1), so that the gray value of the foreground part related to texture in the amplitude spectrum is 1, and the gray value of the background part unrelated to texture angle is 0, thereby obtaining the binarized amplitude spectrum |F2(u,v)|. Where |F(u,v)| represents the spatiotemporal image amplitude spectrum, u represents the horizontal axis, v represents the vertical axis, T represents the binarization threshold calculated by the triangular thresholding method, and |F2(u,v)| represents the binarization amplitude spectrum.

4. The method for detecting the spatiotemporal image texture orientation angle of a river surface based on a spectrum adaptive mask as described in claim 1, characterized in that, In step 3, based on boundary tracking and least squares method, contour extraction and ellipse fitting are performed on the binarized amplitude spectrum in step 2 to obtain an elliptical mask. Subsequent texture angle detection is then performed using its minor and major semi-axis. Specifically, the steps include: Step 31: Based on the boundary tracking method, extract the outer contour of the part with a gray value of 1 in the binary amplitude spectrum, and traverse the image from left to right and from top to bottom to search for foreground points in the eight neighborhood counterclockwise method to obtain the set of outer boundary points of the foreground region, that is, the outer contour of the high-brightness spectral lines of the extracted amplitude spectrum and the texture-related part, so as to facilitate the subsequent ellipse fitting process. Step 32: Based on the least squares method, perform ellipse fitting on the contour extraction results. The purpose is to obtain the major and minor axis parameters of the ellipse that includes the bright spectral lines in the amplitude spectrum and the texture-related part. The fitted ellipse mask includes the high-frequency part of the effective spectral lines passing through the center of the amplitude spectrum. Therefore, the major and minor axis parameters of the ellipse have a range inclusion relationship with the length of the effective bright spectral lines in the amplitude spectrum. Use this parameter as the integration radius to detect the texture direction angle.

5. The method for detecting the spatiotemporal image texture orientation angle of a river surface based on a spectrum adaptive mask as described in claim 1, characterized in that, In step 4, based on the LSD line segment detection algorithm, a DC mask is constructed and applied to the amplitude spectrum to remove the DC influence. Specifically, the LSD algorithm is first used to perform line detection on the amplitude spectrum |F(u,v)|, and lines in the LSD line detection results with an angle difference of 1° from the horizontal and vertical directions are selected. Then, all the selected lines (x...) are used to... i1 ,y i1 ,x i2 ,y i2 The width w of the mask is determined by equation (2). If no straight line is detected, the width of the mask is 0. Where M represents the height of the amplitude spectrum |F(u,v)| and L represents the width of the amplitude spectrum |F(u,v)|; a DC mask mask(u,v) is constructed by equation (3) and applied to the amplitude spectrum by equation (4) to remove the gross error of the DC component on the texture angle detection. The DC mask mask(u,v) has the same size as the amplitude spectrum |F(u,v)|. |F3(u,v)|=|F(u,v)|×mask(u,v) (4) Where mask(u,v) is the constructed DC mask, |F(u,v)| is the original amplitude spectrum, and |F3(u,v)| is the DC-removed amplitude spectrum.

6. The method for detecting the spatiotemporal image texture orientation angle of a river surface based on a spectrum adaptive mask as described in claim 1, characterized in that, In step 6, the validity of the detection results is identified based on the difference between coarse and fine positioning. Using formula (8), the detection results with a difference of less than or equal to 5° between the coarse and fine positioning angles are marked as valid, i.e., the results are considered reliable. The detection results with a difference of more than 5° between the coarse and fine positioning angles are marked as invalid, i.e., the results are considered unreliable. The detection results are then corrected based on these results. Here, 1 indicates that the test result is marked as reliable, and 0 indicates that the test result is marked as unreliable.

Citation Information

Patent Citations

  • Frequency domain space-time image velocity measurement method based on maximum flow velocity prior information

    CN113804916A

  • Space-time image velocity measurement method and device based on adaptive edge detection

    CN116342656A