A tidal bore line connection method based on gradient amplitude growth
By using the Sobel operator and OTSU image segmentation method, combined with pixel point growth technology, the problem of insufficient edge detection and expansion operation in the recognition and connection of drone tide headlines is solved, and a more accurate tide headline recognition and connection effect is achieved.
Patent Information
- Application Number
- CN202210472516.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-04-29
AI Technical Summary
In the existing drone tide top line identification methods, the edge detection method easily detects river surface ripple or interference points that do not belong to the tide top line as edges, and the expansion operation has problems such as improper handling of edge fractures and inaccurate expansion of pixel points, which affects the accurate identification and connection of the tide top line.
The Sobel operator is used to calculate the gradient amplitude of the image in the Y-axis direction, and combined with the OTSU image segmentation method, the image is divided into foreground and background parts, and pixel points are grown according to the gradient amplitude of the endpoint neighborhood at the fracture, so as to achieve accurate connection of the tide-head line.
It improves the identification accuracy of the tide tide headline, can more accurately divide the tide headline area, and effectively connect the broken parts, enhancing the reliability of tide research data.
Smart Images

Figure CN114862726B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of marine information technology, relates to a tidal bore observation method, and specifically to a tidal bore head line connection method based on gradient amplitude growth. Background Art
[0002] The Qiantang River tidal bore is majestic and surging, and is a unique and spectacular natural landscape. Due to the different geographical environments of different river sections, different types of tidal bore forms will be formed, such as the cross tide in Haining, the first-line tide in Yanguan, the back tide in Laoyancang and Meiniaoba, which attract thousands of tourists every year to watch the tidal bore. The powerful force caused by the tidal bore in the process of moving forward sometimes directly affects the safety of buildings and shipping along the river and causes some unnecessary casualties. Therefore, exploring the laws of tidal bores and studying the hydraulic characteristics and generation mechanism of tidal bores have important academic value and practical significance for tidal bore protection and prevention.
[0003] The propagation speed of the tidal bore is an important characteristic of the tidal bore, which refers to the forward speed of the tidal bore head. The main influencing factors of the tidal bore propagation speed are the downstream tidal range, the upstream water depth and the runoff. The greater the water depth, the faster the tidal bore propagates; the greater the downstream tidal range, the faster the tidal bore propagation speed; the runoff and tidal bore propagation directions are opposite, the greater the runoff, the slower the tidal bore propagation speed. The tidal bore propagation speed is closely related to tidal bore forecast and shipping safety, and is also an important parameter for analyzing the hydraulic characteristics of tidal bores. Characteristics such as the tidal bore head height, tidal bore velocity, and local morphology of the tidal bore are all related to the tidal bore propagation speed.
[0004] Patent No. CN202110430752.1 discloses a machine vision tidal velocity measurement method based on drones. The implementation of this method includes six steps in sequence: video image acquisition, grayscale and filtering processing, edge detection, expansion operation, tidal head line extraction and tidal velocity calculation. The tidal propagation velocity calculation method provided by this patent utilizes the advantages of drones such as maneuverability and wide detection range, which is conducive to obtaining more comprehensive tidal velocity information. It has the advantages of large measurement space scale, accurate tidal head line identification, and high non-contact safety. However, the edge detection method used in the patent to detect the tidal head line and the expansion operation used when connecting the edges have shortcomings. The edge detection in this method adopts the Canny detection algorithm, which will convert the image The ripples or interference points on the river surface that do not belong to the tidal head line are detected as edges, which affects the detection results. Although the expansion operation solves the problem of edge discontinuity to a certain extent, it has obvious disadvantages: on the one hand, the edge break is too large to successfully connect the edge; on the other hand, the pixel expansion operation only expands the pixels of the broken part of the tidal head line, that is, the pixels adjacent to the pixels with the original pixel value of 255 are also set to 255. Therefore, the expanded pixels do not necessarily belong to the part of the tidal head line. It is just that the broken part of the tidal head line is filled by expanding the pixels. Expanding the pixels will inevitably expand the tidal head line area, and what is obtained is not the original tidal head line, but the expanded tidal head line.
[0005] In response to the above problems, this patent proposes a tidal bore head line connection method based on gradient amplitude growth. In view of the fact that the gradient amplitude of the tidal bore line in the Y-axis direction of the image, that is, the direction of the water flow, is relatively large when the tidal bore arrives, the tidal bore line connection method uses the Sobel operator to calculate the gradient amplitude. The operator can calculate the gradient amplitude of each pixel point on the Y-axis of the image. If the gradient amplitude is large, it may belong to the tidal bore head line. The image is divided into foreground and background parts by using the OTSU image segmentation method. Finally, pixel growth is performed according to the gradient amplitude of the endpoint neighborhood of the broken tidal bore head line, and the tidal bore head line is connected at the broken part of the tidal bore head line in the image. Since there are other pixels with the same high gradient amplitude in the image, they are detected as foreground parts. Therefore, the part with the largest contour area is screened out by comparing the size of the contour area, which is the tidal bore head line. Summary of the invention
[0006] The purpose of the present invention is to make up for the shortcomings of the existing unmanned aerial vehicle to identify the tidal head line and calculate the tidal propagation speed method. Aiming at the characteristic that the gradient amplitude of the tidal head line is large in the Y-axis direction when the tidal bore arrives, the Sobel operator is used to calculate the gradient amplitude. The operator can calculate the gradient amplitude of each pixel point on the Y-axis. The larger the gradient amplitude is, the more likely it is to belong to a part of the tidal head line. The image is divided into foreground and background parts by iteratively using the OTSU image segmentation method. Finally, growth is performed according to the gradient amplitude of the endpoint neighborhood of the broken tidal head line, so as to complete the connection of the tidal head line. Finally, the connected domain with the largest area is selected as the tidal head line of the tidal bore. The method can more accurately segment the tidal head line area of the tidal bore, and can accurately and effectively connect the broken parts of the tidal bore, thereby improving the recognition accuracy of the tidal head line of the tidal bore, and providing data support for tidal bore research.
[0007] A tidal edge connection method based on gradient amplitude growth, the process is as follows Figure 1 As shown, the following steps are included:
[0008] Step 1: Grayscale and median filter the collected tidal bore images.
[0009] Step 2: Use the Sobel operator to calculate the image amplitude gradient and convert the image format back to the original uint8 format.
[0010] Step 3: Use the OTSU image segmentation method to calculate the image segmentation threshold and use the threshold to segment the tidal image into foreground and background parts.
[0011] Step 4: Find all the right endpoints that meet the conditions in the image, which are the pixel points where the tidal head line breaks.
[0012] Step 5: Traverse each right endpoint and select the pixel point with the largest amplitude gradient among the three pixels on the right side of the right endpoint in the eight adjacent directions as the target point for the growth of the tide head line.
[0013] Step 6: Continue to screen the pixels in the right neighborhood of the target point. If there is no foreground pixel in its right neighborhood, select the pixel with the largest amplitude gradient as the target point for the next tidal line growth, and repeat the growth step. The number of growth steps can be manually set according to the image effect.
[0014] Step 7: According to the size of the contour area of each independent foreground part in the image, the contour with the largest area is selected as the tidal head line.
[0015] The specific steps of step 1 are as follows: according to the different sensitivities of human vision to colors, different weight coefficients are assigned to the B, G, and R channels of each pixel to perform weighted grayscale value calculation, which are used as the grayscale values of the entire image in turn; median filtering is to arrange the grayscale values of pixels in the neighborhood of a certain point in the image in ascending order according to the neighborhood template, and calculate the median of these grayscale values arranged from small to large, and use it as the grayscale value of this pixel.
[0016] The specific steps of step 2 are as follows: the Sobel operator is mainly used to obtain the first-order gradient of a digital image. Its common application and physical meaning are edge detection. The pixel values at the edge of the image will change significantly. The magnitude of the gradient amplitude represents the degree of change in the content of the image. First, a 3*3 convolution kernel needs to be defined. According to the characteristic that the pixel points before and after the tide head line are significantly different when the tide comes, the convolution kernel is selected as the convolution template of the Sobel operator in the Gy direction. The convolution kernel is convolved with the original image to obtain the longitudinal gradient value of each pixel point. The function of the convolution kernel is that the greater the difference between the pixel points above and below the pixel point, the greater the absolute value of the result, that is, the greater the gradient amplitude, the more likely it is the tide head line of the tide. Since the result may be negative or greater than 255, it is also necessary to convert the data type into uint8 type to obtain a grayscale image with pixel values between 0 and 255.
[0017] The specific steps of step 3 image segmentation are:
[0018] 3-1: First calculate the histogram of the image, that is, divide all the pixels of the image into 256 regions from 0 to 255, count the number of pixels in each region, and normalize the histogram
[0019] 3-2: Define a threshold i for classification, start iteration from 0, count the proportion w0 of pixels with gray levels 0 to i in the entire image, and calculate their average gray level u0; count the proportion w1 of pixels with gray levels i to 255 in the entire image, and count the average gray level u1 of background pixels;
[0020] 3-3: Calculate the variance of foreground pixels and background pixels g = w0*w1*(u0-u1);
[0021] 3-4: i++; Go to 3-2, and end the iteration until i reaches 256, and get the i value corresponding to the maximum g;
[0022] 3-5: Use the i value obtained in 3-4 as the threshold for the iteration start in 3-2, and repeat steps 3-2, 3-3, and 3-4 to obtain a new image segmentation threshold j;
[0023] 3-6: Set the pixels in the image with a grayscale level greater than j to 255, and the pixels below the threshold to 0, to obtain an image with the foreground and background separated.
[0024] The specific steps of step 4 are: traverse all pixel points in the image, determine whether the three right points in the eight-neighborhood of the pixel point are all empty, if empty, it means that the point is the right endpoint, and save it, where the eight-neighborhood represents the adjacent pixel points in eight directions connected to a pixel point.
[0025] The specific steps of step 5 are: traverse each right endpoint, and select the pixel point with the largest amplitude gradient among the three pixels on the right side of the eight neighborhoods of the right endpoint as the target point for the growth of the tide head line.
[0026] The specific steps of step 6 are: continue to screen the three pixel points on the right side of the target point. If there are no foreground pixels among these three pixel points, that is, the pixel value of the pixel point is not 255, then select the pixel point with the largest amplitude gradient as the target point for the growth of the next tidal head line, and repeat the growth step. The number of repetitions can be set manually. The larger the interval at the break of the tidal head line, the more times can be set.
[0027] The specific steps of step 7 are: after image segmentation, the foreground part of the image includes the tide head line of the tidal bore and other parts with higher grayscale thresholds, and all contours in the image are found. The contour is a whole connected by the edges of the image, and the area with the largest contour area is the tidal head line area.
[0028] The beneficial effects of the present invention are:
[0029] The present invention selects the convolution template in the Gy direction of the Sobel operator in view of the drastic change of the longitudinal pixel points of the tidal bore. This method makes it easier to identify the tidal head line and avoids detecting other interfering pixel points to a greater extent.
[0030] The present invention uses the OTSU image segmentation method iteratively to more accurately segment the tidal head line area of the tidal bore, thereby improving the tidal head line detection accuracy of the tidal bore.
[0031] The present invention selects the pixel point with the largest amplitude gradient in the right neighborhood at the break of the tidal head line as the growth target, which is more in line with the tidal head line instead of a simple expansion operation, expands the tidal head line area, and can complete the connection of the tidal head line when the break interval is large. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a flow chart of the tidal head line connection method based on gradient amplitude growth;
[0033] Figure 2 It is the Sobel operator template graph;
[0034] Figure 3 It is a diagram of the tide head line connection and identification effect; DETAILED DESCRIPTION
[0035] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments.
[0036] Step 1: According to the different sensitivity of human vision to color, the B, G, and R channels of each pixel are assigned different weight coefficients to weight the grayscale value, which are used as the grayscale value of the entire image. The calculation formula is shown in the following formula (1):
[0037] f (u, v) = 0.1140* B(u, v) + 0.5870*G(u, v) + 0.2989* R(u, v) (1)
[0038] Median filtering is to arrange the gray values of pixels in the neighborhood of a certain point in the image in ascending order according to the neighborhood template, and calculate the median of these gray values arranged from small to large, and use it as the gray value of this pixel. The processing formula is shown in formula (2):
[0039]
[0040] In the above formula, A is the neighborhood template window, median means the median, f(u,v) is the two-dimensional data sequence, and the final display effect is as follows: Figure 3 As shown in (a) in .
[0041] Step 2: The Sobel operator is mainly used to obtain the first-order gradient of digital images. Its common application and physical meaning is edge detection. The pixel values at the edge of the image will change significantly. The magnitude of the gradient amplitude represents the degree of change in the content of the image. First, a 3*3 convolution kernel needs to be defined. According to the obvious difference between the pixels before and after the tidal bore line when the tidal bore arrives, the convolution kernel is selected as the convolution template of the Sobel operator in the Y-axis direction, such as Figure 2 The Sobel operator shown in (a) and (b) is suitable for situations where the grayscale of the image changes dramatically on the X-axis. The convolution kernel is convolved with the original image to obtain the longitudinal gradient value of each pixel. The function of the convolution kernel is that the larger the difference between the upper and lower pixels of the pixel, the larger the result, that is, the larger the gradient amplitude, the more likely it is the tide head line of the tidal bore. Since the result may be negative or greater than 255, it is also necessary to convert the data type to uint8 type, so that a grayscale image with pixel values between 0 and 255 is obtained. The result is shown in Figure 3 As shown in (b) in .
[0042] Step 3: This process is to obtain the threshold value for image segmentation. The specific steps are as follows: 3-1: First calculate the histogram of the image, that is, divide all the pixels of the image into 256 regions from 0 to 255, count the number of pixels in each region, and normalize the histogram
[0043] 3-2: Define a threshold i for classification, start iteration from 0, count the proportion w0 of pixels with gray levels 0 to i in the entire image, and calculate their average gray level u0; count the proportion w1 of pixels with gray levels i to 255 in the entire image, and count the average gray level u1 of background pixels;
[0044] 3-3: Calculate the variance of foreground pixels and background pixels g = w0*w1*(u0-u1);
[0045] 3-4: i++; Go to 3-2, and end the iteration until i reaches 256, and get the i value corresponding to the maximum g;
[0046] 3-5: Use the i value obtained in 3-4 as the threshold for the start of the iteration in 3-2, and repeat steps 3-2, 3-3, and 3-4 to obtain a new image segmentation threshold;
[0047] 3-6: Set the pixels in the image that are greater than the threshold to 255, and the pixels that are lower than the threshold to 0, and get a picture with the foreground and background separated. The result is as follows Figure 3 As shown in (c) in .
[0048] Step 4: Traverse all the pixels in the image and determine whether the three pixels on the right of the eight adjacent pixels in the eight directions of the pixel are all background, that is, the pixel value is 0. If it is the background, it means that the point is the right endpoint and it is saved.
[0049] Step 5: Traverse each right endpoint and select the pixel point with the largest amplitude gradient among the three pixels on the right side of the eight-neighborhood of the right endpoint as the target point for the growth of the tide head line.
[0050] Step 6: Continue to filter the pixels in the right neighborhood of the target point. If there is no foreground pixel in its right neighborhood, select the pixel with the largest amplitude gradient as the target point for the next tidal head line growth. Repeat the growth step. The number of repetitions can be set manually. The larger the interval at the break of the tidal head line, the more times can be set. This time, the number of growths is set to 20. The results are as follows: Figure 3 As shown in (d) in .
[0051] Step 7: After image segmentation, the foreground part of the image includes the tide head line of the tidal bore and other parts with higher grayscale thresholds. Find all the contours in the image. The contour is a whole connected by the edges of the image. The area with the largest contour area is the tidal head line area. The result is as follows: Figure 3As shown in (e) in .
[0052] The above are preferred embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field shall, within the technical scope disclosed by the present invention, make any changes or substitutions according to the technical solution of the present invention, which shall be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A tidal bore line connection method based on gradient amplitude growth, characterized in that: The following steps are involved: Step 1: grayscale and median filter the acquired image; Step 2: Use the Sobel operator to calculate the image amplitude gradient and convert the image format back to the original uint8 format; Step 3: Iteratively use the OTSU image segmentation method to calculate the image segmentation threshold and use the threshold to segment the image into foreground and background parts; Step 4: Find the right endpoint of the eight-neighborhood of all pixels in the image where the three right points are empty, which is the pixel point where the tidal head line is broken. The eight-neighborhood represents the eight adjacent pixels connected to a pixel point. Step 5: Traverse each right endpoint and select the pixel point with the largest amplitude gradient among the three pixels on the right side of the right endpoint in the eight adjacent directions as the target point for the growth of the tide head line; Step 6: Continue to screen the pixels in the right neighborhood of the target point. If there is no foreground pixel in its right neighborhood, select the pixel with the largest amplitude gradient as the target point for the next tide head line growth, and repeat the growth step of step 6. The number of growth steps is manually set according to the image effect. Step 7: According to the area size of each independent foreground part contour in the image, the contour with the largest area is selected as the tidal head line; The specific steps in step 4 are: traverse all the pixel points in the image, determine whether the three pixel points on the right side of the eight adjacent pixel points in the eight directions of the pixel point are all background, that is, the pixel value is 0; if it is background, it means that the point is the right endpoint and it is saved.
2. A tidal bore line connection method based on gradient amplitude growth according to claim 1, characterized in that The specific steps of step 1 are as follows: according to the different sensitivities of human vision to colors, different weight coefficients are assigned to the B, G, and R channels of each pixel to perform weighted grayscale value calculation, which are used as the grayscale values of the entire image in turn; median filtering is to arrange the grayscale values of pixels in the neighborhood of a certain point in the image in ascending order according to the neighborhood template, and calculate the median of these grayscale values arranged from small to large, and use it as the grayscale value of this pixel.
3. A tidal bore line connection method based on gradient amplitude growth according to claim 1, characterized in that: The specific steps of step 2 are: the Sobel operator is used to obtain the first-order gradient of the digital image, the convolution kernel is selected as the convolution template of the Sobel operator in the Gy direction, the convolution kernel is convolved with the original image to obtain the longitudinal gradient amplitude of each pixel point, and the data type is converted to uint8 type, thereby obtaining a grayscale image with pixel values between 0 and 255.
4. The method for connecting tidal bore lines based on gradient amplitude growth according to claim 1, characterized in that: The specific steps of step 3 are: first, the gray level i of the first segmented image as the foreground and background in the gray level of 0 to 255 is calculated by the OTSU image segmentation method, and then the gray level j of the segmented image as the foreground and background in the gray level of i to 255 is calculated by the OTSU image segmentation method. The obtained j is the threshold of image segmentation. The pixel point with a gray level greater than j is the foreground, otherwise it is the background pixel point.
5. The tidal bore line connection method based on gradient amplitude growth according to claim 1, characterized in that: The specific steps in step 5 are: traverse each right endpoint, and select the pixel point with the largest amplitude gradient among the three pixels on the right side of the eight neighborhoods of the right endpoint as the target point for the growth of the tide head line.
6. A tidal bore line connection method based on gradient amplitude growth according to claim 4, characterized in that: The specific steps of step 6 are: continue to screen the pixel points in the right neighborhood of the target point. If there is no foreground pixel point in its right neighborhood, select the pixel point with the largest amplitude gradient as the target point for the next tidal head line growth, and repeat the growth step of step 6. The number of repetitions can be set manually, and the number of settings can increase as the interval at the break of the tidal head line becomes larger.
7. A tidal bore line connection method based on gradient amplitude growth according to claim 1, characterized in that: The specific steps of step 7 are: after image segmentation, the foreground part of the image includes the tide head line of the tidal bore and other parts with higher grayscale thresholds, and all contours in the image are found. The contour is a whole connected by the edges of the image, and the area with the largest contour area is the tidal head line area.
Citation Information
Patent Citations
Medical image segmentation method based on improved gradient vector flow model
CN104680498A
Machine vision tidal bore flow velocity measurement method based on unmanned aerial vehicle
CN113344953A
Cited By
Eagre head line detection and segmentation method
CN121330542A