Remote sensing image ship course detection method and system

By processing remote sensing images, the minimum external rectangular features of the ship are extracted and the areas are divided. Combined with the rotation angle and bow area, the problems of large calculation amount and low detection accuracy caused by the increase in super parameters in the existing technology are solved, and efficient and accurate ship heading detection is achieved.

CN119991796APending Publication Date: 2025-05-13BEIJING JIAOTONG UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411964638.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The prior art requires the introduction of additional hyperparameters in ship heading detection, resulting in large calculation volume, low detection accuracy, and insufficient utilization of the prior information of the ship shape characteristics, resulting in limited angle range and difficulty in distinguishing the bow and stern.

Method used

By processing the remote sensing image, the outline of the target object is extracted, the coordinates, width, height and rotation angle of the center point of the smallest external rectangle are calculated, and the number of pixel points with a pixel value equal to 255 in each area is calculated. Combined with the rotation angle and bow area, the heading of the ship is judged.

Benefits of technology

It realizes efficient ship heading detection without introducing additional hyperparameters, with small calculation amount and high detection accuracy, and can judge rotation angle and heading without limitations, and is simple and easy to expand.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991796A_ABST
    Figure CN119991796A_ABST
Patent Text Reader

Abstract

The invention provides a remote sensing image ship course detection method and system, and the method comprises the steps: processing a ship image obtained through detection, and obtaining an image block; the contour of the target object in the image block is extracted, the areas of all contours are calculated, and the contour with the maximum area value is obtained; the area of the contour is determined by calculating the coordinate, width, height and rotation angle of the central point of the minimum enclosing rectangle of the contour and the coordinates of the four vertexes of the contour; by calculating the coordinates of the midpoints of the two long sides of the minimum enclosing rectangle, the midpoint of the long side closest to the origin of the coordinates and the midpoint of the other long side are obtained through division; the minimum enclosing rectangle is divided into two areas, and the bow area of the target object is obtained by calculating the number of pixel points with the pixel values equal to 255 in the two areas; and comparing and calculating the number of the pixel points, comparing the width and the height of the minimum enclosing rectangle, and combining the rotation angle and the prow area to obtain the course information of the target object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a remote sensing image ship heading detection method and system. Background Art

[0002] my country is a maritime power with vast sea areas and coastlines. Ships are an important target at sea. At the same time, with the increase in the number of satellites in orbit around the world, remote sensing image resources are becoming more abundant. Using remote sensing images to accurately detect ships at sea is of great value in understanding navigation trends and safeguarding national maritime rights and interests.

[0003] Before determining the direction of the ship, the ship needs to be detected first. In terms of ship detection, traditional machine learning detection algorithms need to manually design features based on the structure and shape of the ship. The process is cumbersome and it is difficult to capture high-level features in the image, resulting in low detection accuracy. With the development of deep learning theory, object detection algorithms based on convolutional neural networks have emerged. This type of method builds a basic network for feature extraction based on the mainstream convolutional neural network, which can be divided into two-stage algorithms represented by R-CNN and single-stage algorithms represented by YOLO and SSD. The two-stage algorithm first generates candidate areas to obtain pre-selected boxes, and then performs sample classification and regression through convolutional neural networks. Its detection accuracy is high but the detection speed is slow; the single-stage algorithm uses the backbone feature extraction network to directly locate and classify the target, with slightly lower detection accuracy but faster speed. The idea of ​​the YOLO algorithm is to divide the image into multiple grids, predict a bounding box for each grid, and the confidence of these bounding boxes and the probability of the category to which the object belongs, and then eliminate overlapping bounding boxes through the non-maximum suppression algorithm.

[0004] Since ships usually have a large aspect ratio and arbitrary direction, horizontal detection boxes are difficult to meet the needs of detecting the position and heading of ships in practical applications. In terms of ship orientation judgment, existing methods detect ships as rotating targets. Methods based on preset anchor frames are usually implemented by changing the representation of candidate frames, introducing hyperparameters such as the size, aspect ratio, direction angle, offset, etc. of the frame to describe the rotating target. However, the increase in hyperparameters brings additional parameter adjustment burden, increases computational cost and affects detection speed. For example, Zenghui Zhang et al. proposed to generate regions of interest with different headings based on the RPN architecture by rotating the preset anchor frame to different directions, and used three additional hyperparameters of scale, aspect ratio, and steering angle to control the size, shape and direction of the anchor frame. The scale is set to 4 and 8, the aspect ratio is set to 1:4 and 1:8, and the steering angle is set to 0, and Six angles. Therefore, there are H×W×2×2×4 possible proposed regions on the feature map of size H×W. The computational cost of calculating IoU and executing the non-maximum suppression algorithm is high, and the setting of parameter values ​​is somewhat subjective. In summary, in the problem of ship heading judgment, a solution is needed that does not require the introduction of additional hyperparameters, has low computational complexity, and has high detection accuracy. Summary of the invention

[0005] The embodiments of the present invention provide a remote sensing image ship heading detection method and system, which are used to solve the technical problems existing in the prior art.

[0006] In order to achieve the above object, the present invention adopts the following technical scheme.

[0007] A remote sensing image ship heading detection method, comprising:

[0008] S1 processes the ship image obtained by detection to obtain an image block; converts the image block into a grayscale image, performs histogram equalization on the grayscale image, and then performs binary thresholding processing;

[0009] S2 extracts the contours of the target object in the grayscale image processed by binary thresholding, calculates the areas of all contours, and obtains the contour with the largest area value;

[0010] S3 obtains the coordinates of the center point of the minimum circumscribed rectangle of the contour with the largest area value, as well as the width, height, and rotation angle of the minimum circumscribed rectangle through function calculation; obtains the coordinates of the four vertices through calculation based on the obtained width, height, rotation angle, and center point coordinates of the minimum circumscribed rectangle; obtains the area of ​​the minimum circumscribed rectangle based on the width, height, rotation angle, center point coordinates, and four vertex coordinates of the minimum circumscribed rectangle;

[0011] S4 calculates the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle of the contour with the largest area value, and divides to obtain the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side;

[0012] S5 divides the minimum circumscribed rectangle of the contour with the largest area value into two regions, and obtains the bow region of the target object by respectively calculating the number of pixel points with pixel values ​​equal to 255 in the two regions;

[0013] S6 obtains the heading information of the target object by comparing the number of pixel points with pixel values ​​equal to 255 in the two areas obtained by calculation, and comparing the width and height of the minimum circumscribed rectangle of the contour with the largest area value, combining the rotation angle of the minimum circumscribed rectangle and the bow area of ​​the target object.

[0014] Preferably, step S3 further comprises: converting the coordinates of the four vertices of the minimum circumscribed rectangle into coordinate values ​​in the original image by respectively adding the coordinate values ​​of the upper left corner vertex of the image block in the original image.

[0015] Preferably, the process of dividing and obtaining the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side in step S4 includes:

[0016] When the horizontal coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle are equal, the smaller distance between the vertical coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle and the coordinate origin is M1, and the larger distance is M2;

[0017] When the horizontal coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle are not equal, the one with the smaller horizontal coordinate distance from the origin is M1, and the one with the larger horizontal coordinate distance from the origin is M2.

[0018] Preferably, the process of respectively calculating the number of pixel points with a pixel value equal to 255 in the two regions in step S5 includes:

[0019] If the width of the minimum circumscribed rectangle is greater than the height, the first region rect1 is formed by point P0, point P1, midpoint M1, and midpoint M2, and the second region rect2 is formed by midpoint M1, midpoint M2, point P2, and point P3;

[0020] Pass-through

[0021]

[0022] Calculate and obtain the first ship class C1 and the second ship class C2;

[0023] If the width of the minimum circumscribed rectangle is less than the height, the first region rect1 is composed of points P0, P3, midpoint M1, and midpoint M2, and the second region rect2 is composed of points M1, M2, P1, and P2;

[0024] Pass-through

[0025]

[0026] The first ship class C1 and the second ship class C2 are obtained by calculation.

[0027] Preferably, step S6 comprises:

[0028] If the number of pixels with a pixel value of 255 in the first region rect1_pixels is smaller, the first ship class C1 is used as the bow;

[0029] If the width of the minimum circumscribed rectangle is greater than the height and the rotation angle is 0 degrees, the bow C1 of the target object is facing west. If the rotation angle is 90 degrees, the bow C1 of the target object is facing north. If the rotation angle is other values, the bow C1 of the target object is facing northwest.

[0030] If the width of the minimum circumscribed rectangle is less than the height and the rotation angle is 0 degrees, the bow C1 of the target object is facing north. If the rotation angle is 90 degrees, the bow C1 of the target object is facing east. If the rotation angle is other values, the bow C1 of the target object is facing northeast.

[0031] If the number of pixels rect2_pixels with a pixel value of 255 in the first region is smaller, the second ship class C2 is used as the bow;

[0032] If the width of the minimum circumscribed rectangle is greater than the height and the rotation angle is 0 degrees, the bow C2 of the target object faces east. If the rotation angle is 90 degrees, the bow C2 of the target object faces south. If the rotation angle is other values, the bow C2 of the target object faces southeast.

[0033] If the width of the minimum circumscribed rectangle is less than the height and the rotation angle is 0 degrees, the bow C2 of the target object faces south. If the rotation angle is 90 degrees, the bow C2 of the target object faces west. If the rotation angle is other values, the bow C2 of the target object faces southwest.

[0034] In a second aspect, the present invention provides a remote sensing image ship heading detection system, including a data acquisition and preprocessing module, a ship detection module and a heading determination module;

[0035] The data acquisition and preprocessing module is used for:

[0036] Detecting the target area to obtain a ship image; processing the ship image obtained by the detection to obtain an image block;

[0037] The vessel detection module is used to:

[0038] The coordinates of the center point of the minimum circumscribed rectangle of the contour with the largest area value, as well as the width, height, and rotation angle of the minimum circumscribed rectangle are obtained through function calculation; based on the obtained width, height, rotation angle, and coordinates of the center point of the minimum circumscribed rectangle, the coordinates of the four vertices are obtained through calculation; based on the width, height, rotation angle, coordinates of the center point, and coordinates of the four vertices of the minimum circumscribed rectangle, the area of ​​the minimum circumscribed rectangle is obtained;

[0039] By calculating the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle of the contour with the largest area value, the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side are obtained;

[0040] The minimum circumscribed rectangle of the contour with the largest area value is divided into two regions, and the bow region of the target object is obtained by respectively calculating the number of pixel points with pixel values ​​equal to 255 in the two regions;

[0041] The heading determination module is used for:

[0042] The heading information of the target object is obtained by comparing the number of pixels with a pixel value of 255 in the two regions, comparing the width and height of the minimum circumscribed rectangle of the contour with the largest area value, combining the rotation angle of the minimum circumscribed rectangle and the bow area of ​​the target object.

[0043] It can be seen from the technical solutions provided by the above embodiments of the present invention that the present invention provides a remote sensing image ship heading detection method and system, wherein the method includes: processing the ship image obtained by detection, obtaining an image block and converting it into a grayscale image for processing; extracting the contour of the target object in the image block, calculating the area of ​​all contours, and obtaining the contour with the largest area value; determining the area of ​​the minimum circumscribed rectangle by calculating the coordinates of the center point, width, height, rotation angle and coordinates of the four vertices of the minimum circumscribed rectangle of the contour; calculating the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle, dividing and obtaining the midpoint of the long side closest to the coordinate origin, and the midpoint of the other long side; dividing the minimum circumscribed rectangle into two areas, and obtaining the bow area of ​​the target object by respectively calculating the number of pixels with pixel values ​​equal to 255 in the two areas; obtaining the heading information of the target object by comparing and calculating the number of pixels, and comparing the width and height of the minimum circumscribed rectangle, combined with the above rotation angle and bow area. The method and system provided by the present invention have the following advantages:

[0044] (1) Different from the previous technical solutions, the present invention does not predict the rotation angle of the ship when performing target detection, but processes the detection frame obtained by the target detection algorithm through the OpenCV function to obtain a rotation detection frame that fits the ship image. Therefore, there is no need to introduce additional hyperparameters for detecting the ship's heading, and the amount of calculation is small;

[0045] (2) The present invention distinguishes the bow and stern of a ship based on the prior information of the ship's shape features, and determines the ship's heading by combining the bow position and the rotation angle of the ship detection frame. The rotation angle and heading are not restricted.

[0046] (3) Compared with the algorithm specially designed for rotating target detection, the method proposed in the present invention does not involve changes in the target detection network architecture, is relatively simple, has certain flexibility, and is easy to expand.

[0047] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0049] Figure 1 A processing flow chart of a remote sensing image ship heading detection method provided by the present invention;

[0050] Figure 2 A process diagram of a preferred embodiment of a remote sensing image ship heading detection method provided by the present invention;

[0051] Figure 3 A schematic diagram of the width, height and rotation angle of the minimum circumscribed rectangle of a remote sensing image ship heading detection method provided by the present invention;

[0052] Figure 4 A schematic diagram of the bow position of a remote sensing image ship heading detection method provided by the present invention;

[0053] Figure 5 A schematic diagram of a first method for calculating the bow position of a remote sensing image ship heading detection method provided by the present invention;

[0054] Figure 6 A schematic diagram of a second method for calculating the bow position of a remote sensing image ship heading detection method provided by the present invention;

[0055] Figure 7 A schematic diagram of a first and a second case of calculating ship heading information in a remote sensing image ship heading detection method provided by the present invention;

[0056] Figure 8 A schematic diagram of the third and fourth situations of calculating the ship heading information of a remote sensing image ship heading detection method provided by the present invention;

[0057] Fig. 9 A logic block diagram of a remote sensing image ship heading detection system provided by the present invention;

[0058] Fig.10 A schematic diagram of the effect of an embodiment of a remote sensing image ship heading detection method provided by the present invention. DETAILED DESCRIPTION

[0059] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0060] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or coupling. The term "and / or" used herein includes any unit and all combinations of one or more associated listed items.

[0061] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.

[0062] To facilitate understanding of the embodiments of the present invention, several specific embodiments will be further explained below with reference to the accompanying drawings, and each embodiment does not constitute a limitation on the embodiments of the present invention.

[0063] The present invention provides a remote sensing image ship heading detection method and system, which are used to solve the following technical problems existing in the prior art:

[0064] (1) To solve the problem of low intelligence and high computational complexity caused by the need to introduce additional hyperparameters such as frame size, aspect ratio, direction angle, offset, etc. during ship heading detection.

[0065] (2) To solve the problem that in the process of ship heading detection, the prior information of ship shape features is not fully utilized and the ship is only modeled as a rotated rectangle to regress parameters.

[0066] (3) Solve the problem that the angle range is limited and the bow and stern cannot be distinguished during the ship heading detection process.

[0067] The Chinese invention patent disclosure specification (CN106780525A) discloses a method for extracting ship direction features from optical remote sensing images based on the minimum bounding rectangle of coordinate rotation. First, image preprocessing is performed to obtain the single-pixel edge of the target as an effective reference area for target direction feature extraction; for the acquired edge contour image, a quadrant division strategy is used to make an initial judgment on the target direction. The purpose of this step is to limit the search range of the minimum bounding rectangle and improve the efficiency of the algorithm; under the limitation of the initial judgment range of the target in the previous step, the minimum bounding rectangle within the search range is searched, and the bow direction is initially judged based on the minimum bounding rectangle. Finally, the minimum bounding rectangle obtained by extraction is used to extract ship direction-related features such as the length, width, and direction of the target. However, the solution of this document needs to scan 45 times after the initial judgment of the direction to determine the final minimum bounding rectangle rotation angle, which is a cumbersome process; on the other hand, this solution cannot further judge the ship's heading based on the rotation angle.

[0068] See also Figure 1 The present invention provides a remote sensing image ship heading detection method, comprising the following steps:

[0069] S1 processes the ship image obtained by detection to obtain an image block;

[0070] S2 extracts the contours of the target object in the image block, calculates the areas of all contours, and obtains the contour with the largest area value;

[0071] S3 obtains the coordinates of the center point of the minimum circumscribed rectangle of the contour with the largest area value, as well as the width, height, and rotation angle of the minimum circumscribed rectangle through function calculation; obtains the coordinates of the four vertices through calculation based on the obtained width, height, rotation angle, and center point coordinates of the minimum circumscribed rectangle; obtains the area of ​​the minimum circumscribed rectangle based on the width, height, rotation angle, center point coordinates, and four vertex coordinates of the minimum circumscribed rectangle;

[0072] S4 calculates the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle of the contour with the largest area value, and divides to obtain the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side;

[0073] S5 divides the minimum circumscribed rectangle of the contour with the largest area value into two regions, and obtains the bow region of the target object by respectively calculating the number of pixel points with pixel values ​​equal to 255 in the two regions;

[0074] S6 obtains the heading information of the target object by comparing the number of pixel points with pixel values ​​equal to 255 in the two areas obtained by calculation, and comparing the width and height of the minimum circumscribed rectangle of the contour with the largest area value, combining the rotation angle of the minimum circumscribed rectangle and the bow area of ​​the target object.

[0075] In the preferred embodiment provided by the present invention, the specific execution process of the above steps is as follows.

[0076] In step S1, image processing is performed on the candidate area obtained in the ship detection module to make the obtained image clearer. The detected image is divided into image blocks according to the detected frame. Each image block is converted into a grayscale image, and the grayscale image is histogram equalized and then binary thresholded.

[0077] In step S3, based on the maximum contour obtained in step S2, the minimum enclosing rectangle is calculated using the function in OpenCV, and the coordinates of the center point, width w, height h, rotation angle and four vertex coordinates of the minimum enclosing rectangle are obtained. The definitions of width, height and rotation angle are as follows Figure 3 As shown. After obtaining the above parameters, the area of ​​the minimum enclosing rectangle can be determined. Since the minimum enclosing rectangle is obtained based on the local image block, it is necessary to translate the coordinates of the four vertices of the minimum enclosing rectangle, that is, add the coordinate values ​​of the upper left corner vertex of the image block in the original image and convert them into coordinate values ​​in the original image.

[0078] In step S4, for the minimum circumscribed rectangle obtained in step S3, the coordinates of the midpoints of the two long sides are calculated, and the midpoint closer to the origin of the coordinate system is taken as M1, and the other midpoint is taken as M2, as shown in FIG. Figure 5 As shown, specifically:

[0079] When the horizontal coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle are equal, the midpoint with the smaller vertical coordinate distance from the origin of the coordinate is M1, and the midpoint with the larger vertical coordinate distance from the origin of the coordinate is M2;

[0080] When the horizontal coordinate values ​​of the midpoints of the two long sides of the minimum circumscribed rectangle are not equal, the midpoint with the smaller horizontal coordinate distance from the coordinate origin is M1, and the midpoint with the larger horizontal coordinate distance is M2.

[0081] In step S5, since the bow needs to reduce the resistance of the hull in the water, reduce the impact of waves, and increase stability, the bow is usually in a "V" shape, such as Figure 4 In order to determine the bow direction of the ship, the minimum bounding rectangle obtained in step S3 is divided into two regions, and the number of pixel points with pixel values ​​equal to 255 in the two regions is calculated respectively, and the smaller one is the region where the bow is located.

[0082] For the minimum bounding rectangle obtained in step S3, if its width is greater than its height, such as Figure 5As shown, the first region rect1 is composed of points P0, P1, midpoints M1, and M2, and the second region rect2 is composed of midpoints M1, M2, points P2, and P3. Calculate the number of pixels with a pixel value of 255 in the first region rect1 and the second region rect2, and record them as rect1_pixels and rect2_pixels respectively. and Calculate C1 and C2 respectively. In the formula, the x parameter represents the horizontal coordinate (x-axis coordinate) of the above point, and the y parameter represents the vertical coordinate (y-axis coordinate) of the above point. In the embodiment provided by the present invention, C1 and C2 are respectively the first ship class C1 and the second ship class C2. In addition, if Figure 5 As shown, points P0, P1, P2, and P3 are respectively the midpoints of the other two long sides (relative to the long sides calculated for M1 and M2) in the minimum circumscribed rectangle.

[0083] If its width is smaller than its height, such as Figure 6 As shown, the points P0, P3, M1, and M2 form the first region rect1, and the points M1, M2, P1, and P2 form the second region rect2. Calculate the number of pixels with a pixel value of 255 in the first region rect1 and the second region rect2, and record them as rect1_pixels and rect2_pixels respectively. and The first ship class C1 and the second ship class C2 are calculated separately.

[0084] In step S6, the numbers of pixels rect1_pixels and rect2_pixels in the two regions rect1 and rect2 calculated in step S5 are compared.

[0085] If rect1_pixels is smaller, it means that the bow is located in the rect1 area, and the point C1 represents the bow. Then determine the specific direction of the bow. If the width of the minimum circumscribed rectangle obtained in step S3 is greater than the height, and the rotation angle is 0 degrees, the bow of the ship is facing west; if the rotation angle is 90 degrees, the bow of the ship is facing north; when the rotation angle is other values, the bow of the ship is facing northwest. If the width of the minimum circumscribed rectangle is less than the height, and the rotation angle is 0 degrees, the bow of the ship is facing north; if the rotation angle is 90 degrees, the bow of the ship is facing east; when the rotation angle is other values, the bow of the ship is facing northeast.

[0086] If rect2_pixels is smaller, it indicates that the bow is located in the rect2 area, and the bow is represented by point C2. Then, the specific orientation of the bow is determined. If the width of the minimum bounding rectangle obtained in step S3 is greater than the height and the rotation angle is 0 degrees, the bow of the ship is facing east; if the rotation angle is 90 degrees, the bow of the ship is facing south; when the rotation angle is other values, the bow of the ship is facing southeast. If the width of the minimum bounding rectangle is less than the height and the rotation angle is 0 degrees, the bow of the ship is facing south; if the rotation angle is 90 degrees, the bow of the ship is facing west; when the rotation angle is other values, the bow of the ship is facing southwest.

[0087] Examples of the above various situations are as Figure 7 shown, Figure 7 (a) is rect1 < rect2 and w > h; Figure 7 (b) is rect1 < rect2 and w < h; Figure 8 (c) is rect1 > rect2 and w > h; Figure 8 (d) is rect1 > rect2 and w < h.

[0088] The present invention also provides a test example for exemplarily showing the effect of the present invention.

[0089] Take Fig.10 a and detect it according to this method. After ship detection and course discrimination, the target detection model used is YOLOv7, and the detection results are as Fig.10 shown in b. In the figure, the white box represents the detected ship contour, the white dot represents the direction of the bow, and the text "001 Southeast" marks the ship orientation judged by this method.

[0090] In a second aspect, the present invention provides a ship course detection system for remote sensing images, as Fig. 9 shown, including a data acquisition and preprocessing module 801, a ship detection module 802, and a course discrimination module 803.

[0091] The data acquisition and preprocessing module 801 is to collect the ship remote sensing image data required by the system and preprocess the remote sensing image data for subsequent detection, specifically including the following content:

[0092] (1) Collect the remote sensing image data of the ship;

[0093] (2) Mark the bounding box of the ship's circumscribed rectangle for the remote sensing image data;

[0094] (3) Divide the remote sensing image data into a training set and a test set.

[0095] The ship detection module 802 detects ships in remote sensing image data through the deep learning YOLOv7 model, which specifically includes the following contents:

[0096] (1) The training set divided by the data acquisition and preprocessing module is input into the YOLOv7 network, and after preprocessing operations such as data enhancement, training is performed to learn to extract the features of ships in remote sensing images;

[0097] (2) The trained model is applied to the test set to perform ship detection and obtain the candidate regions of ships in the remote sensing image test set data.

[0098] The heading determination module 803 determines the heading of the ship in the remote sensing image data. After obtaining the target detection result of the ship in the remote sensing image by the deep learning YOLOv7 model and processing the image, the minimum bounding rectangle detection frame of each detection object is found through the function in OpenCV. Since the bow of the ship is usually "V" shaped from the shape characteristics of the ship, this paper divides the detection result rectangular frame into two areas with the center point of the minimum bounding rectangle as the boundary, compares the number of pixels in the two areas, and takes the smaller area as the bow area. According to the calculation standard of the minimum bounding rectangle for the rotation angle, combined with the width and height of the ship, the heading of the bow is determined by angle classification.

[0099] In summary, the present invention provides a remote sensing image ship heading detection method and system, wherein the method includes: processing the ship image obtained by detection, obtaining an image block and converting it into a grayscale image for processing; extracting the contour of the target object in the image block, calculating the area of ​​all contours, and obtaining the contour with the largest area value; determining the area of ​​the minimum circumscribed rectangle by calculating the coordinates of the center point, width, height, rotation angle and coordinates of the four vertices of the minimum circumscribed rectangle of the contour; calculating the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle, dividing and obtaining the midpoint of the long side closest to the coordinate origin, and the midpoint of the other long side; dividing the minimum circumscribed rectangle into two areas, and obtaining the bow area of ​​the target object by respectively calculating the number of pixel points with pixel values ​​equal to 255 in the two areas; obtaining the heading information of the target object by comparing and calculating the number of the pixel points, and comparing the width and height of the minimum circumscribed rectangle, combined with the above-mentioned rotation angle and bow area. The method and system provided by the present invention have the following advantages:

[0100] (1) Different from the previous technical solutions, the present invention does not predict the rotation angle of the ship when performing target detection, but processes the detection frame obtained by the target detection algorithm through the OpenCV function to obtain a rotation detection frame that fits the ship image. Therefore, there is no need to introduce additional hyperparameters for detecting the ship's heading, and the amount of calculation is small;

[0101] (2) The present invention distinguishes the bow and stern of a ship based on the prior information of the ship's shape features, and determines the ship's heading by combining the bow position and the rotation angle of the ship detection frame. The rotation angle and heading are not restricted.

[0102] (3) Compared with the algorithm specially designed for rotating target detection, the method proposed in the present invention does not involve changes in the target detection network architecture, is relatively simple, has good flexibility, and is easy to expand;

[0103] (4) The minimum enclosing rectangle can be directly obtained based on the contour, including the rotation angle information, without further processing, the process is simpler and has better flexibility;

[0104] (5) It is possible to determine the corresponding ship heading according to the rotation angle, length, and width of various circumscribed rectangles, which is clearer and more operational.

[0105] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.

[0106] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.

[0107] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0108] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A remote sensing image ship heading detection method, characterized in that: include: S1 processes the ship image obtained by detection to obtain an image block; Convert the image block into a grayscale image, perform histogram equalization on the grayscale image, and then perform binary thresholding; S2 extracts the contours of the target object in the grayscale image processed by binary thresholding, calculates the areas of all contours, and obtains the contour with the largest area value; S3 obtains the coordinates of the center point of the minimum circumscribed rectangle of the contour with the largest area value, as well as the width, height, and rotation angle of the minimum circumscribed rectangle through function calculation; obtains the coordinates of the four vertices through calculation based on the obtained width, height, rotation angle, and center point coordinates of the minimum circumscribed rectangle; obtains the area of ​​the minimum circumscribed rectangle based on the width, height, rotation angle, center point coordinates, and four vertex coordinates of the minimum circumscribed rectangle; S4 calculates the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle of the contour with the largest area value, and divides to obtain the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side; S5 divides the minimum circumscribed rectangle of the contour with the largest area value into two regions, and obtains the bow region of the target object by respectively calculating the number of pixel points with pixel values ​​equal to 255 in the two regions; S6 obtains the heading information of the target object by comparing the number of pixel points with pixel values ​​equal to 255 in the two areas obtained by calculation, and comparing the width and height of the minimum circumscribed rectangle of the contour with the largest area value, combining the rotation angle of the minimum circumscribed rectangle and the bow area of ​​the target object.

2. The method according to claim 1, characterized in that Step S3 also includes: by respectively adding the coordinate values ​​of the upper left corner vertex of the image block in the original image, the coordinates of the four vertices of the minimum circumscribed rectangle are converted into coordinate values ​​in the original image.

3. The method according to claim 1, characterized in that The process of dividing in step S4 to obtain the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side includes: When the horizontal coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle are equal, the smaller distance between the vertical coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle and the coordinate origin is M1, and the larger distance is M2; When the horizontal coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle are not equal, the one with the smaller horizontal coordinate distance from the origin is M1, and the one with the larger horizontal coordinate distance from the origin is M2.

4. The method according to claim 3, characterized in that: The process of respectively calculating the number of pixel points with a pixel value equal to 255 in the two regions in step S5 includes: If the width of the minimum circumscribed rectangle is greater than the height, the first region rect1 is formed by point P0, point P1, midpoint M1, and midpoint M2, and the second region rect2 is formed by midpoint M1, midpoint M2, point P2, and point P3; Pass-through Calculate and obtain the first ship class C1 and the second ship class C2; If the width of the minimum circumscribed rectangle is less than the height, the first region rect1 is composed of points P0, P3, midpoint M1, and midpoint M2, and the second region rect2 is composed of points M1, M2, P1, and P2; Pass-through The first ship class C1 and the second ship class C2 are obtained by calculation.

5. The method according to claim 4, characterized in that Step S6 includes: If the number of pixels with a pixel value of 255 in the first region rect1_pixels is smaller, the first ship class C1 is used as the bow; If the width of the minimum circumscribed rectangle is greater than the height and the rotation angle is 0 degrees, the bow C1 of the target object is facing west. If the rotation angle is 90 degrees, the bow C1 of the target object is facing north. If the rotation angle is other values, the bow C1 of the target object is facing northwest. If the width of the minimum circumscribed rectangle is less than the height and the rotation angle is 0 degrees, the bow C1 of the target object is facing north. If the rotation angle is 90 degrees, the bow C1 of the target object is facing east. If the rotation angle is other values, the bow C1 of the target object is facing northeast. If the number of pixels rect2_pixels with a pixel value of 255 in the first region is smaller, the second ship class C2 is used as the bow; If the width of the minimum circumscribed rectangle is greater than the height and the rotation angle is 0 degrees, the bow C2 of the target object faces east. If the rotation angle is 90 degrees, the bow C2 of the target object faces south. If the rotation angle is other values, the bow C2 of the target object faces southeast. If the width of the minimum circumscribed rectangle is less than the height and the rotation angle is 0 degrees, the bow C2 of the target object faces south. If the rotation angle is 90 degrees, the bow C2 of the target object faces west. If the rotation angle is other values, the bow C2 of the target object faces southwest.

6. A remote sensing image ship heading detection system, characterized in that: It includes data acquisition and preprocessing module, ship detection module and heading determination module; The data acquisition and preprocessing module is used for: Detecting the target area to obtain a ship image; processing the ship image obtained by the detection to obtain an image block; The vessel detection module is used to: The coordinates of the center point of the minimum circumscribed rectangle of the contour with the largest area value, as well as the width, height, and rotation angle of the minimum circumscribed rectangle are obtained through function calculation; based on the obtained width, height, rotation angle, and coordinates of the center point of the minimum circumscribed rectangle, the coordinates of the four vertices are obtained through calculation; based on the width, height, rotation angle, coordinates of the center point, and coordinates of the four vertices of the minimum circumscribed rectangle, the area of ​​the minimum circumscribed rectangle is obtained; By calculating the coordinates of the midpoints of the two long sides of the minimum circumscribed rectangle of the contour with the largest area value, the midpoint of the long side closest to the coordinate origin and the midpoint of the other long side are obtained; The minimum circumscribed rectangle of the contour with the largest area value is divided into two regions, and the bow region of the target object is obtained by respectively calculating the number of pixel points with pixel values ​​equal to 255 in the two regions; The heading determination module is used for: The heading information of the target object is obtained by comparing the number of pixels with a pixel value of 255 in the two regions, comparing the width and height of the minimum circumscribed rectangle of the contour with the largest area value, combining the rotation angle of the minimum circumscribed rectangle and the bow area of ​​the target object.

Citation Information

Patent Citations

  • Optical remote sensing image ship direction feature extraction method based on coordinate rotation minimum enclosing rectangle

    CN106780525A

  • A ship detection method and system based on an optical remote sensing image

    CN109886133A

  • Ship target confirmation method based on local shape matching

    CN114067147A

  • Remote sensing image rotating ship target detection method based on AIS knowledge assistance

    CN114898213A

  • Image processing apparatus and image processing method

    US20190132529A1