A sea-sky-line detection method based on image block grayscale features and contour screening
Through the sea antenna detection method based on image block grayscale characteristics and contour screening, the robustness of sea antenna detection in complex marine environments is solved, and more accurate and efficient sea antenna detection is achieved.
Patent Information
- Application Number
- CN202310905203.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-24
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2043-07-24
AI Technical Summary
The existing sea antenna detection methods are not robust enough in complex marine environments and are easily disturbed by ship occlusion and sea surface waves, resulting in inaccurate detection.
The sea antenna detection method based on image block grayscale characteristics and contour screening is adopted to obtain the area with the largest grayscale changes through block processing, and combine Canny edge detection, closed operation and Hough transform linear detection to gradually screen out the sea antenna profile.
It improves the accuracy and robustness of sea antenna detection, reduces the amount of calculation, and effectively narrows the detection range in complex marine environments.
Smart Images

Figure CN117237377B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a sea-sky-line detection method and the technical field of image processing, in particular to a sea-sky-line detection method based on image block grayscale features and contour screening. Background Art
[0002] The sea-sky line is essentially a line or region that separates the sea surface from the sky. Generally speaking, pixels near or near the sea-sky line exhibit significant grayscale gradient variations. In a dynamic environment like the sea surface, the sea-sky line is a crucial factor in enabling unmanned vehicles (USVs) to perceive their surroundings using visual technology. Accurate sea-sky line detection is a crucial step in identifying regions of interest (ROIs) for USVs. This significantly reduces the detection range, improving the efficiency of surface target detection and ensuring safe navigation for USVs.
[0003] Due to the complex and ever-changing nature of the ocean environment, accurate sea-sky-line detection has always been a challenge. Currently, the sea-sky-line detection process generally consists of three steps: 1. Capture the original sea and sky background using a visual sensor. 2. Image preprocessing to suppress interference. 3. Detection and extraction of the sea-sky-line. Classic methods include transform-domain sea-sky-line detection, image segmentation-based sea-sky-line detection, edge detection operator-based sea-sky-line detection, and gradient saliency-based sea-sky-line detection. However, since most of these methods process the entire image, they are inevitably subject to interference from ship obstructions, sea waves, and other factors, resulting in a lack of robustness. Summary of the Invention
[0004] To address the problems presented in the prior art, the present invention provides a sea-sky-line detection method based on image block grayscale features and contour screening. The sea surface image is first segmented into appropriate blocks. The changes in the regional grayscale row mean are used to identify the sea-sky-line region. This allows for the detection and extraction of the sea-sky-line region, which can reduce interference from irrelevant areas to a certain extent and improve detection accuracy. This method, based on image block grayscale features and contour screening, is expected to help address the challenges of sea-sky-line detection. In practical scenarios, this algorithm can be implemented on equipment such as unmanned boats, further improving the efficiency of sea surface target detection.
[0005] The technical solution adopted in the present invention is:
[0006] The sea-sky-line detection method based on image block grayscale features and contour screening of the present invention comprises the following steps:
[0007] Step 1: Collect a sea-sky-line image and preprocess the sea-sky-line image to obtain a preprocessed sea-sky-line image. The sea-sky-line image is mainly divided into two areas, the sea surface and the sky, in a sea-sky scene. The sea-sky-line is the dividing line between the sea surface and the sky.
[0008] Step 2: Evenly divide the preprocessed sea-sky-line image into several detection areas, obtain the average grayscale value of each detection area, and then obtain the maximum value difference of each detection area. The detection area with the largest maximum value difference is used as the sea-sky-line area to be detected.
[0009] Step 3: perform edge detection and edge improvement processing on the sea-sky line area to be detected, and then perform edge detection processing to obtain a sea-sky line contour image.
[0010] In step 4, the sea-sky-line contour image is subjected to contour screening to obtain a final contour image. The sea-sky-line is extracted based on the final contour image. If the sea-sky-line is not extracted, the process returns to step 2 and the detection area with the largest value difference among the remaining detection areas other than the detection area selected last time is selected as the sea-sky-line area to be detected. Steps 3 and 4 are then repeated until the sea-sky-line is extracted, completing the sea-sky-line detection.
[0011] In the step 1, preprocessing the sea-sky-line image specifically includes standardizing the sea-sky-line image to a preset size and then converting it into a grayscale image to obtain a preprocessed sea-sky-line image.
[0012] In the step 2, the pre-processed sea-sky-line image is evenly divided into a number of detection areas, specifically, the pre-processed sea-sky-line image is evenly divided into a number of rectangular detection areas along the length direction of the sea antenna.
[0013] In the step 2, the row grayscale average value of each detection area is obtained, and then the maximum value difference of each detection area is obtained. Specifically, for each detection area, according to the grayscale value of each pixel in the detection area, the average grayscale value of the grayscale value of each row of pixels is obtained as the row grayscale average value of the detection area. The row grayscale average value corresponds to the degree of change of the grayscale row mean in each detection area. The larger the difference, the more significant the image change in the area; then the difference between the maximum and minimum values of the row grayscale average value in the detection area is taken as the maximum value difference of the detection area.
[0014] According to the maximum difference of the grayscale row mean of each area, sort them from large to small, and establish the corresponding area index sequence S. In the initial detection, let i = 0, S[0] is the index of the area with the largest maximum difference of the grayscale row mean on the original complete sea surface image, and then the sea-sky line area to be detected z can be further obtained. o The area with the largest difference is used as the sea-sky-line detection area because, in terms of the grayscale change of a single area in the divided sea surface image, the change is generally the largest near the sea-sky-line. Here, the maximum difference of the grayscale row mean of a single area is used as the representation.
[0015] In step three, the edge detection process specifically uses the Canny detection operator to perform edge detection processing.
[0016] The Canny detection operator is used to detect the edge of the area. Compared with the detection algorithms such as Sobel and Prewitt, the Canny edge detection fully utilizes the gradient information of the edge and makes the output edge binary image retain a certain amount of edge features without introducing too much noise. o After Canny edge detection, a preliminary binary edge map can be obtained. However, since the sky background will have some outlines of clouds and the ripples in the sea area will also form linear outlines after detection, both will affect the extraction of the sea-sky line, so further processing is required.
[0017] In the step 3, the edge improvement process is specifically performed using a closing operation.
[0018] Using a closing operation to improve edges can eliminate interference from other contours detected on the sky and sea surface, resulting in more accurate sea-skyline detection. Closing is a morphological filtering method that performs a dilation followed by an erosion operation on the image. Dilation seeks local maxima. Convolving kernel B with the image computes the maximum value of the pixels in the area covered by kernel B and assigns this maximum value to the pixel designated by the reference point. This gradually increases the size of highlight areas in the image, extending the contours outward and achieving a "thickening" effect. In the binary edge map of the sea surface image, the contours of the sea surface are numerous and complex. Dilation fills the sea surface area as smoothly as possible, further reducing their interference with sea-skyline extraction. Erosion seeks local minima, the inverse of dilation, and can therefore reduce or even eliminate highlight areas in the image. Erosion can help form locally connected domains in incompletely filled areas of the sea surface, facilitating contour search and screening in the next step, thereby eliminating irrelevant contour areas.
[0019] The main function of the closing operation is to fill small black holes within white objects and connect adjacent objects. Applying it to the binary edge map of the sea surface image mainly smoothes the sea surface area as much as possible, making it a unified whole, which helps to accurately extract the sea-sky line.
[0020] In step 4, the sea-sky-line contour image is subjected to contour screening to obtain a final contour image. Specifically, the perimeter of each contour in the sea-sky-line contour image and the aspect ratio of its circumscribed minimum rectangular boundary are obtained. Contours with a perimeter greater than a preset perimeter threshold and an aspect ratio of its circumscribed minimum rectangular boundary greater than a preset aspect ratio threshold are retained, and the remaining contours are removed to obtain the final contour image.
[0021] Contour filtering can prevent the presence of partially connected contours in the sea surface area that could interfere with sea-sky line detection, further eliminating irrelevant areas. Because the sea-sky line contour is elongated and has a longer perimeter than other contours, limiting the perimeter size and the aspect ratio of its outer rectangular bounding box allows for further contour filtering and elimination, reducing interference with subsequent line detection.
[0022] In the step 4, the sea-sky line is extracted according to the final contour image, specifically by using the Hough transform line detection method to extract the sea-sky line.
[0023] Hough transform line detection exploits the duality between points and lines. In line detection, there is a one-to-one correspondence between lines in image space and points in parameter space, and vice versa. Therefore, the Hough line detection algorithm transforms the line detection problem in image space into the point detection problem in parameter space, completing line detection by searching for peaks in parameter space. This method has the advantages of strong anti-interference capabilities and insensitivity to image noise.
[0024] In the initial detection, the area with the largest difference in grayscale row mean values is considered the target sea-sky-line area. However, in reality, due to the influence of weather and lighting, sea surface imaging is more complex, and a single criterion for judgment has certain limitations. Therefore, if a line that meets the requirements cannot be extracted in the current area, it means that the area is not the sea-sky-line area. Let i = i + 1, S[i + 1] is the index of the area to be extracted for the sea-sky-line area in the next step, and the corresponding image area is obtained. The detection process is repeated. If the sea-sky-line is extracted, the process ends; otherwise, the above steps are repeated until all image areas have been traversed.
[0025] The beneficial effects of the present invention are:
[0026] 1. The image is first divided into blocks to obtain the grayscale changes of each region, and then the sea-sky line area to be detected is determined. The sea-sky line can be detected relatively accurately in most scenes. At the same time, the detection range of the sea-sky line is narrowed, reducing the amount of calculation.
[0027] 2. Combine Canny edge detection, morphological filtering and other methods to further process the binary edge image of the region to reduce interference, making the subsequent sea-sky line detection more accurate and reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flow chart of the method of the present invention;
[0029] Figure 2 This is a picture example of the processing flow of the method of the present invention. Figure 2(a) is the original sea-skyline image. Figure 2 (b) is the sea-sky-line image to be detected, which is obtained by dividing the original sea-sky-line image into blocks and judging the grayscale row mean maximum difference. Figure 2 (c) is the first Canny edge detection map, Figure 2 (d) is the second Canny edge detection image after the closing operation. Figure 2 (e) is the edge detection image after contour screening, Figure 2 (f) is the sea-sky-line detection effect diagram;
[0030] Figure 3 This is an example diagram of the detection effect of the algorithm. Figure 3 (a) is the sea-sky-line detection effect diagram of the sea surface with strong light. Figure 3 (b) is the sea-sky line detection effect diagram of the sea surface where the sea-sky boundary is relatively fuzzy. Figure 3 (c) is the sea-sky-line detection effect diagram with waves and a landscape sea surface in the distance. Figure 3 (d) is the sea-sky-line detection effect diagram with the sea landscape in the distance. Figure 3 (e) is the sea-sky-line detection effect diagram of the sea surface with large cloud interference and shore landscape. Figure 3 (f) is the sea-sky-line detection effect diagram of the sea surface with uneven illumination. Figure 3 (g) is the sea-sky line detection effect diagram with blurred sea-sky boundary. Figure 3 (h) is the sea-sky-line detection effect diagram of the sea surface which is greatly disturbed by clouds. DETAILED DESCRIPTION
[0031] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0032] like Figure 1 FIG. 1 is a flow chart of a sea-sky-line detection method based on image block grayscale features and contour screening according to the present invention. The method comprises the following steps:
[0033] Step 1: Collect a sea-sky-line image and preprocess the sea-sky-line image to obtain a preprocessed sea-sky-line image. The sea-sky-line image is mainly divided into two areas, the sea surface and the sky, in a sea-sky scene. The sea-sky-line is the dividing line between the sea surface and the sky.
[0034] In step 1, the sea-sky-line image is preprocessed by standardizing the sea-sky-line image to a preset size and then converting it into a grayscale image to obtain a preprocessed sea-sky-line image.
[0035] Step 2: Evenly divide the preprocessed sea-sky-line image into several detection areas, obtain the average grayscale value of each detection area, and then obtain the maximum value difference of each detection area. The detection area with the largest maximum value difference is used as the sea-sky-line area to be detected.
[0036] In step 2, the pre-processed sea-sky-line image is evenly divided into a number of detection areas. Specifically, the pre-processed sea-sky-line image is evenly divided into a number of rectangular detection areas along the length direction of the sea antenna.
[0037] In step 2, the row grayscale average value of each detection area is obtained, and then the maximum value difference of each detection area is obtained. Specifically, for each detection area, according to the grayscale value of each pixel in the detection area, the average grayscale value of the grayscale value of each row of pixels is obtained as the row grayscale average value of the detection area. The row grayscale average value corresponds to the degree of change of the grayscale row mean in each detection area. The larger the difference, the more significant the image change in the area; then the difference between the maximum and minimum values of the row grayscale average value in the detection area is taken as the maximum value difference of the detection area.
[0038] According to the maximum difference of the grayscale row mean of each area, sort them from large to small, and establish the corresponding area index sequence S. In the initial detection, let i = 0, S[0] is the index of the area with the largest maximum difference of the grayscale row mean on the original complete sea surface image, and then the sea-sky line area to be detected z can be further obtained. o The area with the largest difference is used as the sea-sky-line detection area because, in terms of the grayscale change of a single area in the divided sea surface image, the change is generally the largest near the sea-sky-line. Here, the maximum difference of the grayscale row mean of a single area is used as the representation.
[0039] Step 3: perform edge detection and edge improvement processing on the sea-sky line area to be detected, and then perform edge detection processing to obtain a sea-sky line contour image.
[0040] In step three, the edge detection process specifically uses the Canny detection operator to perform edge detection processing.
[0041] The Canny detection operator is used to detect the edge of the area. Compared with the detection algorithms such as Sobel and Prewitt, the Canny edge detection fully utilizes the gradient information of the edge and makes the output edge binary image retain a certain amount of edge features without introducing too much noise. o After Canny edge detection, a preliminary binary edge map can be obtained. However, since the sky background will have some outlines of clouds and the ripples in the sea area will also form linear outlines after detection, both will affect the extraction of the sea-sky line, so further processing is required.
[0042] In step three, the edge improvement process is specifically performed using a closing operation.
[0043] Using a closing operation to improve edges can eliminate interference from other contours detected on the sky and sea surface, resulting in more accurate sea-skyline detection. Closing is a morphological filtering method that performs a dilation followed by an erosion operation on the image. Dilation seeks local maxima. Convolving kernel B with the image computes the maximum value of the pixels in the area covered by kernel B and assigns this maximum value to the pixel designated by the reference point. This gradually increases the size of highlight areas in the image, extending the contours outward and achieving a "thickening" effect. In the binary edge map of the sea surface image, the contours of the sea surface are numerous and complex. Dilation fills the sea surface area as smoothly as possible, further reducing their interference with sea-skyline extraction. Erosion seeks local minima, the inverse of dilation, and can therefore reduce or even eliminate highlight areas in the image. Erosion can help form locally connected domains in incompletely filled areas of the sea surface, facilitating contour search and screening in the next step, thereby eliminating irrelevant contour areas.
[0044] The main function of the closing operation is to fill small black holes within white objects and connect adjacent objects. Applying it to the binary edge map of the sea surface image mainly smoothes the sea surface area as much as possible, making it a unified whole, which helps to accurately extract the sea-sky line.
[0045] In step 4, the sea-sky-line contour image is subjected to contour screening to obtain a final contour image. The sea-sky-line is extracted based on the final contour image. If the sea-sky-line is not extracted, the process returns to step 2 and the detection area with the largest value difference among the remaining detection areas other than the detection area selected last time is selected as the sea-sky-line area to be detected. Steps 3 and 4 are then repeated until the sea-sky-line is extracted, completing the sea-sky-line detection.
[0046] In step 4, the sea-sky-line contour image is subjected to contour screening to obtain the final contour image. Specifically, the perimeter of each contour in the sea-sky-line contour image and the aspect ratio of its circumscribed minimum rectangular boundary are obtained. Contours with a perimeter greater than a preset perimeter threshold and an aspect ratio of its circumscribed minimum rectangular boundary greater than a preset aspect ratio threshold are retained, and the remaining contours are removed to obtain the final contour image.
[0047] Contour filtering can prevent the presence of partially connected contours in the sea surface area that could interfere with sea-sky line detection, further eliminating irrelevant areas. Because the sea-sky line contour is elongated and has a longer perimeter than other contours, limiting the perimeter size and the aspect ratio of its outer rectangular bounding box allows for further contour filtering and elimination, reducing interference with subsequent line detection.
[0048] In step 4, the sea-sky line is extracted based on the final contour image, specifically using the Hough transform line detection method to extract the sea-sky line.
[0049] Hough transform line detection exploits the duality between points and lines. In line detection, there is a one-to-one correspondence between lines in image space and points in parameter space, and vice versa. Therefore, the Hough line detection algorithm transforms the line detection problem in image space into the point detection problem in parameter space, completing line detection by searching for peaks in parameter space. This method has the advantages of strong anti-interference capabilities and insensitivity to image noise.
[0050] In the initial detection, the area with the largest difference in grayscale row mean values is considered the target sea-sky-line area. However, in reality, due to the influence of weather and lighting, sea surface imaging is more complex, and a single criterion for judgment has certain limitations. Therefore, if a line that meets the requirements cannot be extracted in the current area, it means that the area is not the sea-sky-line area. Let i = i + 1, S[i + 1] is the index of the area to be extracted for the sea-sky-line area in the next step, and the corresponding image area is obtained. The detection process is repeated. If the sea-sky-line is extracted, the process ends; otherwise, the above steps are repeated until all image areas have been traversed.
[0051] like Figure 2 (a) Figure 2 (b) Figure 2 (c) Figure 2 (d) Figure 2 (e) and Figure 2 (f) is a diagram illustrating the processing flow of the method of the present invention. From top to bottom, the diagram includes the original sea surface image, the sea-sky-line area to be detected obtained by segmentation and grayscale row mean maximum difference judgment, the first Canny edge detection image, the second Canny edge detection image after closing operation, the edge detection image after contour screening, and the sea-sky-line detection effect image of the method of the present invention.
[0052] like Figure 3 (a) Figure 3 (b) Figure 3 (c) Figure 3 (d) Figure 3 (e), Figure 3 (f), Figure 3 (g) and Figure 3 (h) is an example diagram of the detection effect of the method of the present invention. It can be seen that the method of the present invention can accurately detect the sea-sky line in most scenarios.
[0053] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered as equivalent replacement methods and are included in the scope of protection of the present invention.
Claims
1. A sea-sky-line detection method based on image block grayscale features and contour screening, characterized by: The method comprises the following steps: Step 1: collecting a sea-sky-line image and preprocessing the sea-sky-line image to obtain a preprocessed sea-sky-line image; Step 2: Evenly divide the pre-processed sea-sky-line image into several detection areas, obtain the average grayscale value of each detection area, and then obtain the maximum value difference of each detection area. The detection area with the largest maximum value difference is used as the sea-sky-line area to be detected. Step 3: performing edge detection and edge improvement processing on the sea-sky line area to be detected, and then performing edge detection processing to obtain a sea-sky line contour image; In step 4, the sea-sky-line contour image is subjected to contour screening to obtain a final contour image. The sea-sky-line is extracted based on the final contour image. If the sea-sky-line is not extracted, the process returns to step 2 and the detection area with the largest value difference among the remaining detection areas other than the detection area selected last time is selected as the sea-sky-line area to be detected. Steps 3 and 4 are then repeated until the sea-sky-line is extracted, completing the sea-sky-line detection.
2. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In the step 1, preprocessing the sea-sky-line image specifically includes standardizing the sea-sky-line image to a preset size and then converting it into a grayscale image to obtain a preprocessed sea-sky-line image.
3. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In the step 2, the pre-processed sea-sky-line image is evenly divided into a number of detection areas, specifically, the pre-processed sea-sky-line image is evenly divided into a number of rectangular detection areas along the length direction of the sea antenna.
4. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In the step 2, the row grayscale average value of each detection area is obtained, and then the maximum value difference of each detection area is obtained. Specifically, for each detection area, according to the grayscale value of each pixel in the detection area, the average grayscale value of the grayscale value of each row of pixels is obtained as the row grayscale average value of the detection area, and then the difference between the maximum and minimum values of the row grayscale average value in the detection area is taken as the maximum value difference of the detection area.
5. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In step three, the edge detection process specifically uses the Canny detection operator to perform edge detection processing.
6. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In the step 3, the edge improvement process is specifically performed using a closing operation.
7. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In step 4, the sea-sky-line contour image is subjected to contour screening to obtain a final contour image. Specifically, the perimeter of each contour in the sea-sky-line contour image and the aspect ratio of its circumscribed minimum rectangular boundary are obtained. Contours with a perimeter greater than a preset perimeter threshold and an aspect ratio of its circumscribed minimum rectangular boundary greater than a preset aspect ratio threshold are retained, and the remaining contours are removed to obtain the final contour image.
8. The sea-sky-line detection method based on image block grayscale features and contour screening according to claim 1, characterized in that: In the step 4, the sea-sky line is extracted according to the final contour image, specifically by using the Hough transform line detection method to extract the sea-sky line.
Citation Information
Patent Citations
Sea-sky-line detection method and system based on gray level co-occurrence matrix and Hough transformation
CN109978869A
Superpixel- and multivariate color space-based body outline extraction method
WO2019062092A1