CN-116030082-B - Sea-sky-line real-time detection method and system
Abstract
The invention belongs to the technical field of image processing and computer vision, and particularly relates to a sea-sky-line real-time detection method and system. The invention divides the sea-sky-line detection into two parts of coarse calculation and fine calculation. The first part is coarse calculation, which is to downsample the collected visible light or infrared image and calculate a longitudinal gray gradient image, threshold segmentation is carried out on the longitudinal gray gradient image to obtain a binarized image, the boundary of the binarized image is calculated, and then the approximate intercept and slope of the sea-sky line are calculated through hough transformation. The second part is fine calculation, the method is that according to the sea-sky line intercept and slope calculated in the first part, the position of the maximum value of the image longitudinal gray gradient map is longitudinally searched in the area near the sea-sky line of the longitudinal gray gradient map calculated in the first part, the obtained position point is subjected to hough transformation, and then the accurate position and slope of the sea-sky line are calculated. The scheme has the advantages of small calculated amount, small memory occupation, simple algorithm principle and high realization efficiency.
Inventors
- LI YINGJUAN
- LU XIAOYAN
- WEI HONG
- XU KAILUAN
- LIU PEIZHEN
- ZHAO MIYANG
- WANG JIE
Assignees
- 西安应用光学研究所
Dates
- Publication Date
- 20260508
- Application Date
- 20221110
Claims (5)
- 1. A method for real-time detection of a sea-sky-line, the method comprising: step 1, after receiving a sea-sky-line detection command sent by a photoelectric detection system, acquiring a frame of original image by a corresponding sensor; step 2, calculating a longitudinal gray gradient map after the original image is downsampled; step 3, calculating a segmentation threshold value of the longitudinal gray gradient map; step 4, threshold segmentation is carried out on the longitudinal gray gradient map according to a segmentation threshold value, so as to obtain a binarized image; step 5, calculating the boundary of the segmented binarized image and storing the coordinates of the boundary points; step 6, sending the coordinates of the boundary points into a hough transformation function for calculation; step 7, searching the position of the maximum value of the hough space output by the hough transformation function, and calculating the approximate intercept and slope of the sea-sky line according to the coordinates of the position; Step 8, selecting a small range near the sea-sky line in the longitudinal gray gradient map calculated in the step 2 by taking the sea-sky line rough intercept and the slope calculated in the step 7 as references, searching the maximum value of each column of the longitudinal gray gradient map and storing the coordinates of the maximum value; step 9, sending the coordinate value of each column of maximum value point into a hough transformation function for calculation; step 10, searching the position of the maximum value of the hough space output by the hough transformation function, and calculating the accurate intercept and slope of the sea-sky line according to the coordinates of the position, so as to obtain the position of the sea-sky line; step 11, plotting the sea-sky line on the image by using a straight line, and reporting the accurate intercept and slope value of the sea-sky line to a photoelectric system; in the step 2, the calculation formula of the vertical gray gradient map is as follows: Wherein: Gray is a longitudinal Gray gradient map after downsampling; f is the original image; i, j is the row and column index of the longitudinal gray gradient map; s is the number of longitudinal gradient accumulated lines; sample_height is the line downsampling rate; sample_width is the column downsampling rate; In the step 3, the process of calculating the segmentation threshold of the vertical gray gradient map is as follows: firstly, calculating the average value of a longitudinal gray gradient map: Wherein H Gray =H/sample_height,W Gray = W/sample_width; H Gray ,W Gray is the height and width of the longitudinal gray gradient map; h, W are the height, width of the original image respectively; Gray average is the mean value of the longitudinal Gray gradient map; Then, the maximum value Gray of the vertical Gray gradient map is searched max The segmentation threshold Gray Threshold is obtained by weighting the mean value and the maximum value of the longitudinal Gray gradient map: Gray Threshold = Gray average · t+ Gray max · (1-t); wherein t and 1-t are respectively the gray average value and the occupied weight of the gray value of the edge point, and 0< t <1; in the step 4, the longitudinal gray gradient map is subjected to threshold segmentation to obtain a binarized image; judging whether the value of the longitudinal gray gradient map is larger than the segmentation threshold value, assigning 255 to the points larger than the segmentation threshold value and assigning 0 to the points smaller than or equal to the segmentation threshold value, thereby obtaining a binarized segmented image ; In the step 5, calculating the boundary of the segmented binarized image and storing the coordinates of the boundary point; detecting a first column of a binarized image from top to bottom, if gray level changes exist, considering the first column as a boundary point, storing the position of the point, and counting the number of the boundary points; Calculating by the same method, and traversing each column of the binary image in turn to obtain a boundary point position sequence EDGEMAPLIST set and a boundary point number EDGELENGTH1 of the whole binary image; EdgeMapList1={px 11 ,py 11 ,px 12 ,py 12 ,px 13 ,py 13 ,...,px 1n ,py 1n ,...} Wherein px 1n represents the x-coordinate of the nth boundary point at the time of the rough calculation, py 1n represents the y-coordinate of the nth boundary point at the time of the rough calculation; in the step 6, the coordinates of the boundary points are sent to a hough transformation function for calculation; The method comprises the steps of presetting Rho values and Theta sequence values required by hough transformation, taking a plurality of values uniformly distributed between 70-110 degrees according to the characteristic that sea-sky lines are basically horizontal, sending boundary point position sequences EDGEMAPLIST and boundary point number EDGELENGTH1 into a hough transformation function, and calculating hough space values; in the step 7, searching the position of the maximum value of the hough space output by the hough transformation function, and calculating the approximate intercept and the slope of the sea-sky line according to the coordinates of the position; Specifically, as the straight line in the rectangular coordinate system and the point in the hough space are in one-to-one correspondence, namely ρ=x·cos (θ) +y·sin (θ), x, y are the coordinates of the midpoint of the rectangular coordinate system, ρ, θ is the coordinates of the midpoint of the hough space, the hough space is a two-dimensional matrix, and the coordinates (ρ max1 ,θ max1 ) of the maximum point of the matrix represents the longest straight line in the binarized boundary diagram, namely the sea antenna; Thus, the approximate slope k 1 and intercept b 1 of the sea-antenna can be calculated by coordinate transformation; k 1 = cos(θ max1 )/sin(θ max1 )/sample_width·sample_height; b 1 =(ρ max1 - Rho/2)·2/sin(θ max1 )·sample_height。
- 2. The method for real-time detection of sea-sky-line according to claim 1, wherein in the step 8, a small range around the sea-sky-line is selected from the vertical gray-scale gradient map calculated in the step 2 by taking the sea-sky-line rough intercept and slope calculated in the step 7 as references, and a maximum value of each column of the vertical gray-scale gradient map is searched and coordinates of the maximum value are stored; The method comprises the steps of (1) obtaining the approximate slope and intercept of the sea-sky line by calculating the approximate position of the sea-sky line in the step (7), selecting the area near the sea-sky line in the longitudinal gray gradient map calculated in the step (2) by taking the value as a reference to carry out sea-sky line detection again, wherein the width of the selected area is the same as that of the original longitudinal gray gradient map, and the upper boundary of the height is top and the lower boundary is bottom; if k 1 > =0 top = b 1 - k 1 · W-2·S; bottom = b 1 + 2·S; If k 1 <0, then top = b 1 - 2·S; bottom = b 1 + k 1 · W - 2·S; Wherein W is the width of the original image; s is the number of longitudinal gradient accumulated lines; k 1 ,b 1 is the approximate slope and intercept of the sea-antenna calculated in advance, respectively; Searching the maximum value of each column of the sub-longitudinal gray gradient map sequentially from top to bottom from left to right to obtain a position sequence EDGEMAPLIST of the maximum value and the length EDGELENGTH of the maximum value point; EdgeMapList2={px 21 ,py 21 ,px 22 ,py 22 ,px 23 ,py 23 ,...,px 2n ,py 2n ,...} Where px 2n represents the x-coordinate of the nth maximum point at the time of the refinement, py 2n represents the y-coordinate of the nth maximum point at the time of the refinement.
- 3. The method for real-time detection of sea-sky-line according to claim 2, wherein in the step 9, the coordinate value of each maximum point is sent to a hough transform function for calculation; and (3) presetting Rho values and Theta sequence values required by hough transformation in the step (6), sending the boundary point position sequence EDGEMAPLIST and the boundary point number EDGELENGTH to a hough transformation function, and calculating a hough space value.
- 4. The method for real-time detection of sea-sky-line according to claim 3, wherein in step 10, the position of the maximum value of hough space outputted by hough transformation function is searched, and the accurate intercept and slope of sea-sky-line are calculated by the coordinates of the position, so as to obtain the position of sea-sky-line; the calculation method of the step 10 is the same as that of the step 7, the coordinates of the maximum value point of the hough space are marked as (rho max2 ,θ max2 ), the accurate position information of the sea-sky line is obtained through calculation, and the calculation method of the slope k 2 and the intercept b 2 is as follows: k 2 = cos(θ max2 )/sin(θ max2 )/sample_width·sample_height b 2 =(ρ max2 - Rho/2)·2/sin(θ max2 )·sample_height。
- 5. A real-time sea-sky-line detection system for performing the real-time sea-sky-line detection method according to any one of claims 1-4, comprising a longitudinal gray-scale gradient map calculation module, a segmentation threshold calculation module, an edge detection module, a sea-sky-line fitting module, wherein: The longitudinal gray gradient map calculation module is used for downsampling an original image and calculating a longitudinal gray gradient map of the downsampled image; the segmentation threshold calculation module is used for calculating the average value and the maximum value of the longitudinal gray gradient map and weighting out a segmentation threshold; The edge detection module is used for binarizing the longitudinal gray gradient map according to the segmentation threshold value and calculating edge information of the binarized image; The sea-sky-line fitting module is used for detecting straight lines on edges, searching the longest straight line in the image based on a Hough transformation method and fitting the longest straight line into the sea-sky-line.
Description
Sea-sky-line real-time detection method and system Technical Field The invention belongs to the technical field of image processing and computer vision, and particularly relates to a sea-sky-line real-time detection method and system. Background The ship-based photoelectric detection system is important equipment for marine police forces to realize activities such as ocean right maintenance, duty, law enforcement and the like, and can be used for searching, detecting and tracking targets by utilizing visible light, infrared light, a laser range finder and other optical sensors carried by the system. Current offshore target detection and tracking technologies face a number of challenges. Firstly, the offshore environment is complex and changeable, and severe weather such as rain, haze and the like often occurs, secondly, the offshore environment is always in a dynamic change process under the influence of various natural factors such as illumination, wind, sea waves and the like, and video data collected in the offshore environment contains a large amount of noise and disturbance information such as disordered fish scale light, irregularly-moving waves with rich textures and the like. Finally, the visual range of the offshore target is small, the video information shakes severely, the position change is serious, and the real-time accurate positioning is difficult. In face of new challenges in complex marine climate environments, conventional target detection techniques have failed to meet the requirements of real-time and efficient processing of offshore data. Moreover, under sea-sky background conditions and in a remote head-up state, targets such as missiles, unmanned aerial vehicles, ships, vessels, boats and the like always appear near the sea-sky area. Therefore, before detecting a weak target, it is necessary to first detect the sea-antenna and then process the area near the sea-antenna. The method has the advantages that on one hand, the area of target searching can be reduced by determining the sea-sky line, after the position information of the sea-sky line is obtained, only the area near the sea-sky line can be searched, the operation amount is reduced, and the real-time performance of the system is ensured, on the other hand, after the sea-sky line is detected, the region of interest (ROI) is divided, unnecessary interference information such as sky cloud layer, haze, sea wave, seabird, background on the coast and the like can be eliminated, and the accuracy of target detection and tracking is improved. In the aspect of sea-sky-line detection, most of the existing detection technologies have the following defects of (1) complex calculation process, poor practicality, (2) low calculation efficiency and poor instantaneity, (3) being only suitable for simple sea-sky backgrounds, often failing in detection in severe weather, with more cloud layers, great storms or great sea surface interference, and (4) being mainly used for detecting infrared targets and not suitable for visible light targets. The invention discloses a method for detecting an infrared image sea-sky-line connected domain under a sea-sky background, which is disclosed in a patent with publication number CN106127728B, a patent with publication number CN104268877A and publication number CN104268877A, a sea-sky-line self-adaptive detection method for an infrared image, a patent with publication number CN105787950A and publication number CN105787950A, and a patent with publication number CN105787950A and publication number CN. However, a large amount of information is lost in the image of the method, so that the method is difficult to achieve both speed and accuracy, cannot be directly applied to a visible light scene, greatly limits the application range, cannot detect the inclined sea-sky line, and is unfavorable for subsequent target detection and the like. The invention discloses an infrared image sea-sky-line detection method based on a linear search matrix, which is still aimed at an infrared image and can detect inclined sea-sky-lines but cannot resist interference of cloud layers, sea wave clutter, seabirds, ships and the like. The current method for detecting the sea-sky line of the visible light image mainly utilizes the gray characteristics of the sea surface and the sky to detect the sea-sky line. For example, a place with the largest gray gradient in the column direction is calculated as a sea-sky line, for example, patent with publication number CN102279973a, entitled "sea-sky line detection method based on high gradient key points" discloses a sea-sky line detection method based on high gradient key points, which has the disadvantage that detection is in error when there is a large gray difference between a cloud layer and sky, between sea waves and sea surfaces, and when there is interference of ships, islands, large sea waves, etc. The invention discloses a sea-sky-line detection method based on mathematical morphology,