River water surface space-time image texture direction angle detection method based on frequency spectrum adaptive mask

Through the spectrum adaptive mask-based method, the error detection problem of spatiotemporal image texture angle detection in complex noise scenarios is solved, achieving higher detection accuracy and robustness.

CN119444822AActive Publication Date: 2025-02-14HOHAI UNIV

Patent Information

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

AI Technical Summary

Technical Problem

Existing spatiotemporal image texture angle detection methods are difficult to accurately detect texture direction in complex noise scenarios, which can easily cause false detection and large errors.

Method used

Using a spectrum adaptive mask method, the elliptical mask is extracted by the triangular threshold method, boundary tracking and least squares method, and the DC mask is constructed using the LSD linear segment detection algorithm to remove the influence of DC noise, and through The rough to fine texture direction angle detection strategy improves detection accuracy.

Benefits of technology

Effectively eliminate DC noise, improve the accuracy and robustness of texture direction angle detection, and can accurately detect texture direction under various noise interference, reducing error detection rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444822A_ABST
    Figure CN119444822A_ABST
Patent Text Reader

Abstract

The invention discloses a river water surface space-time image texture direction angle detection method based on a frequency spectrum adaptive mask. The method comprises the following steps: step 1, obtaining a space-time image on a velocity measurement line and an amplitude spectrum thereof by using an image method flow measurement system; 2, binarizing the amplitude spectrum based on a triangular threshold method, and extracting a highlight part in the amplitude spectrum; step 3, performing contour extraction and ellipse fitting on the binarization amplitude spectrum in the step 2 based on boundary tracking and a least square method to obtain an ellipse mask, and performing subsequent texture angle detection by using a minor semi-axis and a major semi-axis of the ellipse mask; step 4, based on an LSD straight line segment detection algorithm, constructing a direct current mask and applying the direct current mask to the amplitude spectrum to remove direct current influence; 5, based on the long semi-axis and the short semi-axis of the elliptical mask in the step 3, coarse-to-fine texture direction angle detection is carried out; and step 6, carrying out detection result validity identification based on the coarse positioning and fine positioning difference value. According to the method, the direct current noise in the space-time image amplitude spectrum can be eliminated, the self-adaptive value taking of the integral radius parameter is realized, the texture direction angle detection accuracy under various noise interferences is improved, and the detection result is effectively identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of spatiotemporal image texture direction recognition, and in particular to a method for detecting a spatiotemporal image texture direction angle of a river water surface based on a spectrum adaptive mask. Background Art

[0002] Measuring the flow velocity of river water bodies has always been a hot topic worthy of research. Traditional measurement methods have been unable to meet people's needs in terms of measurement accuracy, timeliness and safety. In view of the difficulties in equipment deployment under flood conditions, the difficulty in measuring flow velocity, and the difficulty in real-time monitoring of rivers, coupled with the rapid progress of Internet technology, a series of non-invasive, low-cost and efficient velocity measurement technologies based on image analysis have emerged in the past few decades. So far, the image-based velocity measurement technologies that have been relatively well developed mainly include Large Scale Particle Image Velocimetry (LSPIV), Large Scale Particle Tracking Velocimetry (LSPTV) and Space-Time Image Velocimetry (STIV). Among them, the detection accuracy of LSPIV is sensitive to the selected window size. If the selected window size is too small, the target information will be lost, and vice versa, the spatial resolution will be reduced. In addition, the learning cost of the LSPIV algorithm is high, the parameter setting is relatively complex, the time for cross-correlation calculation is very long, and the flow velocity of the area to be measured cannot be obtained in real time. The key link of the LSPTV algorithm is that tracer particles need to be deployed in advance, and high-precision video images are required to be captured. The resolution of the image is very high, the cost of video image processing is high, the calculation parameter setting is relatively complex, and it takes a long time. Therefore, it cannot meet the requirements of automatic flow velocity measurement, and the real-time performance is poor. In addition, in complex outdoor scenes, such as uneven lighting or no tracer particles, the LSPTV algorithm is limited and its effect is not good. Compared with the above two algorithms, the space-time image velocimetry method (STIV) has great potential and application prospects because of its high spatial resolution and low time complexity. Moreover, this algorithm does not need to spread tracer particles in advance, and can quickly obtain the cross-sectional flow velocity distribution of the water surface to be measured.

[0003] The core technology of the spatiotemporal image velocimetry method lies in how to accurately detect the main direction of the texture from the spatiotemporal image. The 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 has been widely used due to its high 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. The 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 spectrum line. The direction of the spectrum line is orthogonal to the texture direction of the spatiotemporal image. The direction of the spatiotemporal image texture can be solved by finding the direction of the spectrum line. At present, the main method is to calculate the angle energy distribution curve by setting the integral radius, projecting the amplitude spectrum in polar coordinates, and then determine the direction of the spectrum line by peak finding. However, this method is only applicable to scenes with good environmental conditions and clear spatiotemporal image texture. For some complex noisy scenes (such as glare, turbulence, ripples, etc.), especially scenes with sidelobe interference in the amplitude spectrum and scenes with DC component diffusion and higher brightness than the effective spectrum line, it often causes false detection, resulting in gross errors. To solve this problem, Fujita et al. proposed a fan filter method, but this method requires setting many parameters and does not have good robustness; Zhang Zhen et al. conducted a parameter sensitivity analysis on this method and obtained the optimal parameter value, but the experimental data only involved six common scenes collected at the same hydrological station, not including complex noisy scenes; therefore, the existing frequency domain spatiotemporal image velocimetry method still faces problems such as the inability to eliminate image noise and the easy false detection of fixed detection parameters for different noise interference scenes. Summary of the invention

[0004] Purpose of the invention: The present invention provides a method for detecting the texture direction angle of a river water surface spatiotemporal image based on a spectrum adaptive mask, which can eliminate the DC noise in the amplitude spectrum of the spatiotemporal image and realize the adaptive value of the parameter of the integral radius, thereby improving the accuracy of texture direction angle detection under various noise interferences and identifying the validity of the detection results.

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

[0006] Step 1: Use the image method flow measurement system to obtain the space-time image and amplitude spectrum on the velocity measurement line;

[0007] Step 2: Binarize the amplitude spectrum based on the triangular threshold method and extract the highlight part of the amplitude spectrum;

[0008] 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 ellipse mask, and its minor semi-axis and major semi-axis are used for subsequent texture angle detection;

[0009] Step 4: Based on the LSD straight line segment detection algorithm, a DC mask is constructed and applied to the amplitude spectrum to remove the DC effect;

[0010] Step 5: Based on the long and short 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 positioning and fine positioning.

[0012] Furthermore, in step 1, the image method flow measurement system is used to obtain the space-time image and its amplitude spectrum on the velocity measurement line, the image sequence is captured by river video, the space-time image is constructed, and a two-dimensional discrete Fourier transform is performed on it to obtain the amplitude spectrum.

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

[0014]

[0015] Among them, |F(u,v)| represents the amplitude spectrum of the spatiotemporal image, u represents the abscissa, v represents the ordinate, T represents the binarization threshold calculated by the triangular threshold method, and |F2(u,v)| represents the binarization amplitude spectrum.

[0016] Furthermore, 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 ellipse mask, and subsequent texture angle detection is performed using its short semi-axis and long semi-axis. Specifically, the steps include:

[0017] Step 31, based on the boundary tracking method, extract the outer contour of the part with gray value 1 in the binary amplitude spectrum, traverse the image from left to right and from top to bottom, expand the eight fields and search for the foreground points in a counterclockwise manner, and obtain a set of outer boundary points of the foreground area, that is, the outer contour of the highlight spectrum line of the texture-related part in the extracted amplitude spectrum, so as to facilitate the subsequent ellipse fitting process;

[0018] Step 32: Based on the least squares method, an ellipse is fitted on the contour extraction result to obtain the major and minor axis parameters of the ellipse that includes the highlight spectral lines in the amplitude spectrum and the texture-related parts. 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 semi-axis parameters of the ellipse have a range inclusion relationship with the length of the highlight effective spectral lines of the amplitude spectrum. This parameter can be used as the integral radius for texture direction angle detection.

[0019] Furthermore, in step 4, based on the LSD straight 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 used to perform straight line detection on the amplitude spectrum |F(u,v)|, and the straight lines with an angle difference of 1° between the horizontal and vertical directions in the LSD straight line detection results are screened out. All the screened straight lines (x i1 ,y i1 ,x i2 ,y i2 ) The width w of the mask is determined by formula (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 effect 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 direction angle detection from coarse to fine specifically includes the following steps:

[0026] Step 51, by using equation (5) and taking the minor semi-axis b of the ellipse as the integral radius, the square terms of the amplitude spectrum are summed in polar coordinate projection to obtain an energy angle distribution curve, and the angle corresponding to the peak point on the curve is the rough positioning MOT1 of the main direction of the spectrum;

[0027]

[0028] The water flow direction is from left to right, and the value of θ is 90° to 180°, and vice versa, it is 0° to 90°;

[0029] Step 52, by using formula (6) and taking the major semi-axis a of the ellipse as the integral radius, the square terms of the amplitude spectrum are summed in polar coordinate projection to obtain an energy angle distribution curve, and the peak point 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 precise positioning MOT2 of the main direction of the spectrum. Finally, the final spatiotemporal image texture angle MOS is obtained by formula (7);

[0030]

[0031] Among them, the value of θ is the same as above;

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

[0033] Furthermore, in step 6, the validity of the detection result is identified based on the difference between the coarse positioning and the fine positioning. According to formula (8), the detection result with a difference between the coarse positioning angle and the fine positioning angle of less than or equal to 5° is marked as valid, that is, the result is considered reliable, and the detection result with a difference between the coarse positioning angle and the fine positioning angle of more than 5° is marked as invalid, that is, the result is considered unreliable. The detection result can be corrected later based on this result.

[0034]

[0035] Among them, 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 the prior art, the present invention has the following significant advantages: the present invention constructs a DC mask through the LSD straight line segment detection algorithm, and applies it to the amplitude spectrum of the space-time image to remove the influence of the horizontal and vertical DC component noise, thereby solving the problem of gross errors caused by the DC component of the traditional method; in addition, the present invention introduces a method combining amplitude spectrum binarization, contour extraction and ellipse fitting to construct an elliptical signal mask to adaptively determine the size of the integral radius, and proposes a coarse-to-fine search strategy based on the polar coordinate projection method, first using the short semi-axis and then the long semi-axis as the integral radius to perform texture direction angle detection, which solves the problem that the fixed integral radius of the traditional algorithm is prone to cause gross errors, and improves the detection accuracy of the space-time image velocimetry method in various noise scenarios; the present invention can be used for the time-averaged flow velocity field measurement of natural tracer water flows such as river surfaces, and is particularly suitable for online monitoring of river flow velocity with obvious environmental noise. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0039] FIG2( b ) is the amplitude spectrum corresponding to the spatiotemporal image example 1 obtained by the present invention.

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

[0041] FIG3( b ) is the amplitude spectrum corresponding to the spatiotemporal image example 2 obtained by the present invention.

[0042] FIG4( a ) is a schematic diagram of the amplitude spectrum grayscale distribution histogram and the triangular threshold method results of Example 1 of the present invention.

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

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

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

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

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

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

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

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

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

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

[0053] FIG. 10( a ) is a diagram showing the energy angle distribution curve of the minor semi-axis coarse positioning detection in Example 1 of the present invention.

[0054] FIG10( b ) is a visualization diagram of the integral radius and detection results of the minor semi-axis coarse positioning detection spectrum diagram of Example 1 of the present invention.

[0055] FIG10( c ) is a visualization of the spatiotemporal image detection results of the minor semi-axis coarse positioning detection in Example 1 of the present invention.

[0056] FIG. 11( a ) is an energy angle distribution curve of the minor semi-axis coarse positioning detection of Example 2 of the present invention.

[0057] FIG11( b ) is a visualization diagram of the integral radius and detection results of the minor semi-axis coarse positioning detection spectrum diagram of Example 2 of the present invention.

[0058] FIG11( c ) is a visualization of the spatiotemporal image detection results of the minor semi-axis coarse positioning detection of Example 2 of the present invention.

[0059] FIG. 12( a ) is a curve showing the energy angle distribution of the long semi-axis precise positioning detection in Example 1 of the present invention.

[0060] FIG12( b ) is a visualization diagram of the integral radius of the long semi-axis precise positioning detection spectrum diagram and the detection results of Example 1 of the present invention.

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

[0062] FIG. 13( a ) is a curve showing the energy angle distribution of the long semi-axis precise positioning detection in Example 2 of the present invention.

[0063] FIG13( b ) is a visualization diagram of the integral radius and detection results of the spectrum diagram of the long semi-axis precise positioning detection of Example 2 of the present invention.

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

[0065] FIG. 14( a ) is a detection energy angle distribution curve of Example 1 of the present invention using a traditional method.

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

[0067] FIG14( c ) is a visualization diagram of the spatiotemporal image detection results of Example 1 of the present invention using the traditional method.

[0068] FIG. 15( a ) is a detection energy angle distribution curve of Example 2 of the present invention using a traditional method.

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

[0070] FIG15( c ) is a visualization of the spatiotemporal image detection results of Example 2 of the present invention using the traditional method.

[0071] FIG. 16( a ) is a schematic diagram showing that the validity identification mark of the present invention is unreliable, and a visualization diagram of the detection result of the short semi-axis coarse positioning space-time image. FIG.

[0072] FIG16( b ) is a schematic diagram showing that the validity identification mark of the present invention is unreliable, and a visualization diagram of the detection results of the space-time image with precise positioning of the major semi-axis. DETAILED DESCRIPTION

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

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

[0075]

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

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

[0078] Among them, u represents the abscissa of the amplitude spectrum, v represents the ordinate of the amplitude spectrum, and the obtained spatiotemporal image example 1 and the amplitude spectrum annotation diagram are shown in Figure 2, and the obtained spatiotemporal image example 2 and its amplitude spectrum schematic diagram are shown in Figure 3. It can be seen from the figure that the spatiotemporal image presents obvious night pixels, turbulence, wind waves and glare noise interference, and the corresponding amplitude spectrum, in addition to the effective spectral lines passing through the center of the spectrum diagram, also presents sidelobe noise interference that does not pass through the center of the image and obvious DC component noise interference, and the existence of these interferences can easily cause false detection of texture angles.

[0079] S2: Determine the threshold T based on the triangular threshold method and perform binarization on the amplitude spectrum. The triangular threshold method is mainly used because this method is suitable for images with a single peak in the grayscale histogram, which coincides with the grayscale histogram characteristics of the amplitude spectrum. The triangular threshold method includes the following steps: first obtain the grayscale distribution histogram of the image, and 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, bmin is taken at the rightmost point, and if the highest peak is biased to the right, bmin is taken at the leftmost point; as shown in formula (11), calculate the vertical distance from each corresponding histogram b to the straight line from bmin until bmax, where the histogram position corresponding to the maximum distance is the threshold T.

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

[0081] Among them, L(b) is the distance between the point on the histogram and the constructed straight line, and b is the grayscale value corresponding to the point on the histogram. For the amplitude spectrum, the spectrum line corresponding to the texture often presents a larger grayscale value. Through formula (12), the grayscale value of the pixel point with a grayscale value greater than the threshold T in the amplitude spectrum is set to 1, and the grayscale value of the pixel point with a grayscale value less than or equal to the threshold T is set to 0 to obtain the binary amplitude spectrum |F2(u,v)|, thereby segmenting the highlighted part of the amplitude spectrum, that is, the part corresponding to the texture spectrum line. The grayscale distribution histogram of Example 1 and the schematic diagram of the triangular threshold method result are shown in Figure 4, and the grayscale distribution histogram of Example 2 and the schematic diagram of the triangular threshold method result are shown in Figure 5. The final binary amplitude spectrum effect diagrams of the two examples are shown in Figure 6. Figure 6 shown.

[0082] It can be seen that the part of the amplitude spectrum related to the highlight line is effectively extracted from the background by this method.

[0083]

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

[0085] S3: Based on boundary tracking and least squares method, the contour extraction and ellipse fitting of the binary image are performed. Among them, based on the boundary tracking method, the outer contour of the part with gray value 1 in the binary amplitude spectrum is extracted. The principle diagram is shown in Figure 6 , the specific steps are: scan the image from left to right and from top to bottom, find the foreground point with the value of 1 in the upper left corner and mark it as p0, and mark the adjacent point above p0 as q0; start the eight-field counterclockwise search with p0 as the center and q0 as the starting point, and record the next foreground point found as p1, and the background point that appears immediately before p1 as q1; then continue to repeat the above steps with p1 as the center and q1 as the starting point to perform the eight-field counterclockwise search until p0 is re-scanned and the scanning stops. At this time, the obtained sequence p is the set of boundary points in the foreground area, that is, the outer contour of the binary amplitude spectrum. The two examples of contour extraction effect 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, in order to obtain the major and minor axis parameters of the ellipse that contains the highlight spectral lines in the amplitude spectrum and the texture-related part. This parameter has a range-inclusive relationship with the effective spectral line length of the amplitude spectrum, and this parameter can be used as the integral radius for texture angle detection. Among them, the equation of the fitted plane ellipse is as follows:

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

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

[0088]

[0089] In order to minimize F, it is necessary to make the partial derivatives of F equal to 0, that is, the values ​​of A, B, C, D, and E can be obtained through formula (15), and then the major and minor semi-axis of the ellipse can be calculated according to formula (16), where a is the major semi-axis and b is the minor semi-axis.

[0090]

[0091]

[0092] The effects of two example ellipse fittings are shown in Figure 8. In the figure, the short semi-axis of the ellipse fitted in Example 1 is 25 pixels wide, and the long semi-axis is 39 pixels wide; the short semi-axis of the ellipse fitted in Example 2 is 25 pixels wide, and the long semi-axis is 107 pixels wide. It can be seen that the ellipse fitted in Example 1 just includes the effective spectral lines passing through the center, while the ellipse fitted in Example 2 includes not only the effective spectral lines passing through the center, but also a part of the sidelobe spectral lines. Overall, it is shown that the length of the effective spectral lines is just within the range of the short semi-axis and the long semi-axis, so that the subsequent texture angle detection can be carried out from coarse to fine based on the two results of the long and short semi-axis as the integration radius.

[0093] S4: Based on the LSD (a Line Segment Detector) line segment detection algorithm, an adaptive DC mask is constructed according to the amplitude spectrum characteristics to remove the DC effect. The LSD algorithm extracts lines by combining image gradient and direction information. First, the gradient of each pixel is calculated to generate the corresponding gradient field, and the pixels with the same gradient within a certain threshold are connected to form a line support region; secondly, a minimum circumscribed rectangle is generated for each line support region, and the main axis of the rectangle represents the main axis direction of the line support region; finally, the line judgment is performed on each rectangle according to the Helmholtz principle to obtain the final detection result. The main reason for choosing LSD is that the algorithm can obtain sub-pixel level line detection results in linear time, has strong robustness and high computational efficiency, and is very suitable for online automatic detection. The parameters involved in the LSD algorithm all use the default parameters of the function createLineSegmentDetector. The DC mask is mainly constructed by calculating the angle of each line detection result (x1, y1, x2, y2) of LSD through formula (17) and performing slope control.

[0094]

[0095] The straight lines whose angle difference with the horizontal and vertical directions is within 1° are selected by equation (18). These straight lines correspond to the edges of the horizontal and vertical DC lines in the amplitude spectrum:

[0096]

[0097] Among them, θ is 1 to keep, and 0 to discard. i1 ,y i1 ,x i2 ,y i2 ) The horizontal mask width x and the vertical mask width y are determined by formula (19). If no straight line is detected, the values ​​of the horizontal mask width x and the vertical mask width y are both 0.

[0098]

[0099] The DC mask mask(u,v) is constructed by equation (20), where the size of mask(u,v) is the same as the amplitude spectrum |F(u,v)|, and then applied to the amplitude spectrum by equation (21), thereby removing the gross error effect of the DC component on texture angle detection.

[0100]

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

[0102] The DC mask effect diagrams obtained by the two examples of this method are shown in Figure 9. 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, no straight line is detected by the LSD algorithm, and the DC mask width is 0, which is equivalent to no mask. The effect of Example 2 is shown in Figure 9(b). Since there is an obvious DC component in Example 2, the straight line corresponding to the DC can be detected by the LSD algorithm, and the DC mask width is 1. After adding a cross mask, the DC interference can be removed from the amplitude spectrum. The above results show that the DC mask method can adaptively adjust the mask shape according to the distribution characteristics of the amplitude spectrum, and has strong robustness.

[0103] S5: By using formula (22) and taking the minor semi-axis b of the ellipse as the integral radius, the square terms of the amplitude spectrum are summed by polar coordinate projection to obtain the energy angle distribution curve P1(θ). The angle corresponding to the peak point on the curve is the rough positioning 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, where Figure (a) is the energy angle distribution diagram, Figure (b) is the visualization diagram of the amplitude spectrum integral radius and the detection result, and the radius corresponding to the white circle in the figure is the size of the minor semi-axis obtained. Figure (c) is the visualization diagram of the spatiotemporal image detection result. It can be seen that the angle position corresponding to the effective spectrum line presents a relatively obvious peak in the energy angle distribution curve, and the obtained detection result is also relatively accurate, which is 44.0° for Example 1 and 60.3° for Example 2. Considering that the minor semi-axis is shorter than the effective spectrum line length, the entire effective spectrum line is not fully utilized, and this result is only used as a rough positioning. Fine positioning is required later.

[0104]

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

[0106] S5.2: The energy angle distribution curve P2(θ) is obtained by summing the square terms of the amplitude spectrum using the major semi-axis a of the ellipse as the integral radius through the coordinate projection method through formula (23). 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 precise positioning MOT2 of the main direction of the spectrum. Finally, the final spatiotemporal image texture angle MOS is obtained through formula (24). The effect of Example 1 is shown in Figure 12, and the effect of Example 2 is 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 diagram of Example 2, in addition to the angle position corresponding to the effective spectrum line, there is also a more obvious peak on its right side. This is due to the interference of environmental noise (such as ripples, glare, etc.) causing the appearance of side lobes with higher brightness in the amplitude spectrum. Some side lobes are included when the angle energy distribution curve is calculated using the major axis. At this time, using a coarse positioning search range of 10° on the left and right can effectively avoid the situation where peaks are found in the side lobes and thus lead to false detections. In addition, the entire effective spectrum line is completely included in the major axis range, and the result is more reliable as the final detection result. This is also the reason for using a coarse-to-fine detection strategy.

[0107]

[0108] MOS=MOT2-90 (24)

[0109] Figures 14 and 15 are the detection results of Example 1 and Example 2 according to the traditional method, that is, no DC mask is used and the integration radius is fixedly set to half the image width. It can be seen that this method detects the direction of the side lobes and noise rather than the direction of the real effective spectral lines, which leads to false detection. The present method avoids the interference of the side lobes and DC components and obtains the correct detection results, which reflects the effectiveness and robustness of the present method.

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

[0111]

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

Claims

1. A method for detecting the texture direction angle of river surface spatiotemporal image based on spectrum adaptive mask, characterized in that: The steps include: Step 1: Use the image method flow measurement system to obtain the space-time image and amplitude spectrum on the velocity measurement line; Step 2: Binarize the amplitude spectrum based on the triangular threshold method and extract the highlight part of the amplitude spectrum; 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 ellipse mask, and its minor semi-axis and major semi-axis are used for subsequent texture angle detection; Step 4: Based on the LSD straight line segment detection algorithm, a DC mask is constructed and applied to the amplitude spectrum to remove the DC effect; Step 5: Based on the long and short semi-axes of the elliptical mask in step 3, perform texture direction angle detection from coarse to fine; Step 6: Identify the validity of the detection results based on the difference between coarse positioning and fine positioning.

2. The method for detecting the texture direction angle of a river surface spatiotemporal image based on spectrum adaptive mask according to claim 1, characterized in that: In step 1, the image method flow measurement system is used to obtain the space-time image and its amplitude spectrum on the velocity measurement line, the image sequence is captured by river video, the space-time image is constructed, and the two-dimensional discrete Fourier transform is performed on it to obtain the amplitude spectrum.

3. The method for detecting the texture direction angle of a river surface spatiotemporal image based on spectrum adaptive mask according to claim 1, characterized in that: In step 2, the threshold T is determined based on the triangular threshold method, and the amplitude spectrum is divided into background and foreground parts by formula (1), so that the gray value of the foreground part related to the texture in the amplitude spectrum is 1, and the gray value of the background part irrelevant to the texture angle is 0, thereby obtaining the binary amplitude spectrum |F2(u,v)|; Among them, |F(u,v)| represents the amplitude spectrum of the spatiotemporal image, u represents the abscissa, v represents the ordinate, T represents the binarization threshold calculated by the triangular threshold method, and |F2(u,v)| represents the binarization amplitude spectrum.

4. The method for detecting the texture direction angle of a river surface spatiotemporal image based on spectrum adaptive mask according to 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 ellipse mask, and subsequent texture angle detection is performed using its short semi-axis and long semi-axis. Specifically, the steps include: Step 31, based on the boundary tracking method, extract the outer contour of the part with gray value 1 in the binary amplitude spectrum, traverse the image from left to right and from top to bottom, expand the eight fields and search for the foreground points in a counterclockwise manner, and obtain a set of outer boundary points of the foreground area, that is, the outer contour of the highlight spectrum line of the texture-related part in the extracted amplitude spectrum, so as to facilitate the subsequent ellipse fitting process; Step 32: Based on the least squares method, an ellipse is fitted on the contour extraction result to obtain the major and minor axis parameters of the ellipse that contains the highlight spectral lines in the amplitude spectrum and the texture-related parts. The fitted ellipse mask contains the high-frequency part of the effective spectral lines passing through the center of the amplitude spectrum. Therefore, the major and minor semi-axis parameters of the ellipse have a range inclusion relationship with the length of the highlight effective spectral lines of the amplitude spectrum. This parameter is used as the integral radius for texture direction angle detection.

5. The method for detecting the texture direction angle of a river water surface spatiotemporal image based on spectrum adaptive mask according to claim 1, characterized in that: In step 4, based on the LSD straight line segment detection algorithm, a DC mask is constructed and applied to the amplitude spectrum to remove the DC effect. Specifically, the LSD algorithm is used to perform straight line detection on the amplitude spectrum |F(u,v)|, and the straight lines with an angle difference of 1° between the horizontal and vertical directions in the LSD straight line detection results are screened out. All the screened straight lines (x i1 ,y i1 ,x i2 ,y i2 ) The width w of the mask is determined by formula (2). If no straight line is detected, the width of the mask is 0; Wherein, M represents the height of the amplitude spectrum |F(u,v)|, and L represents the width of the amplitude spectrum |F(u,v)|; the DC mask mask(u,v) is constructed by equation (3), and is applied to the amplitude spectrum by equation (4), thereby removing the gross error effect of the DC component on texture angle detection, wherein 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 texture direction angle of a river water surface spatiotemporal image based on spectrum adaptive mask according to claim 1, characterized in that: In step 5, based on the major and minor semi-axes of the elliptical mask in step 3, the texture direction angle detection from coarse to fine is performed, which specifically includes the following steps: Step 51, by using equation (5) and taking the minor semi-axis b of the ellipse as the integral radius, the square terms of the amplitude spectrum are summed in polar coordinate projection to obtain an energy angle distribution curve, and the angle corresponding to the peak point on the curve is the rough positioning MOT1 of the main direction of the spectrum; The water flow direction is from left to right, and the value of θ is 90° to 180°, and vice versa, it is 0° to 90°; Step 52, by using formula (6) and taking the major semi-axis a of the ellipse as the integral radius, the square terms of the amplitude spectrum are summed in polar coordinate projection to obtain an energy angle distribution curve, and the peak point 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 precise positioning MOT2 of the main direction of the spectrum. Finally, the final spatiotemporal image texture angle MOS is obtained by formula (7); Among them, the value of θ is the same as above; MOS = MOT2-90 (7).

7. The method for detecting the texture direction angle of a river surface spatiotemporal image based on spectrum adaptive mask according to claim 1, characterized in that: In step 6, the validity of the detection result is identified based on the difference between the coarse positioning and the fine positioning. According to formula (8), the detection result with a difference between the coarse positioning angle and the fine positioning angle of less than or equal to 5° is marked as valid, that is, the result is considered reliable, and the detection result with a difference between the coarse positioning angle and the fine positioning angle of more than 5° is marked as invalid, that is, the result is considered unreliable. The detection result is subsequently corrected according to this result; Among them, 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

  • Road crack image preprocessing method based on LSD and FLD fusion

    CN117058036A

  • Dual chargers with simultaneous wired and wireless charging

    KR1020240017299A

Cited By

  • SAM-based remote sensing image semantic segmentation method and system

    CN122454574A

  • Sam-based remote sensing image semantic segmentation method and system

    CN122454574B