Automatic ship matching method based on optical satellite remote sensing image
1. A ship automatic matching method based on optical satellite remote sensing images is characterized by comprising the following steps:
(1) defining the optical satellite remote sensing image with the shooting time before as p1The optical satellite remote sensing image with the later shooting time is p2To p foriRespectively carrying out coarse classification to obtain images k of coarse classification resultsiI represents the ith image, (i is 1, 2);
(2) image k of coarse classification result by rectangular template1、k2Matching, removing non-ship connected domains, and extracting a ship target area;
the method comprises the following specific steps:
(2.1) defining the upper left corner point of the image as an origin, and the right direction is the positive direction of an x axis and the downward direction is the positive direction of a y axis;
(2.2) calculating k1、k2Obtaining the length, the width and the angle of each connected domain according to the minimum circumscribed rectangle of each connected domain, wherein the length and the width are the length and the width of the corresponding minimum circumscribed rectangle, the angle is an included angle between the extension line of the long side of the minimum circumscribed rectangle and the positive direction of the x axis above the x axis, calculating the length-width ratio of the connected domains, and only keeping the connected domains with the length-width ratio of more than 1.5 and less than 15 to obtain the rest connected domains;
(2.3) calculating k separately1、k2The ship rectangular template of each residual connected domain is obtained to obtain k1Template set TEM1={temple1,1,temple1,2… } and k2Template set TEM2={temple2,1,temple2,2,…};
(2.4) use of TEM1For the roughly classified image k1Template matching using TEM2For the roughly classified image k2Carrying out template matching;
(2.5) expanding the ship target area to ensure that the ship is completely contained in the ship target area;
(3) inputting the four corner coordinates of the extended ship target area into a GrabCT algorithm, and accurately extracting a remote sensing image p1、p2The ship in (1) to obtain the extracted image z1And z2;
(4) Calculating the extracted image z1、z2A feature vector for each vessel;
(5) remote sensing image p by using ship feature vector1、p2And (5) matching the ships, and outputting a ship matching result.
2. The automatic ship matching method based on optical satellite remote sensing images as claimed in claim 1, wherein the rough classification process in step (1) is as follows:
(1.1) use of a Gaussian matrix pair p with a standard deviation of 0 and a size of 5X 5iPerforming Gaussian filtering smoothing to convert the smoothed image into a gray image giThe formula is as follows:
gi=Ri·0.299+Gi·0.587+Bi·0.114
in the formula, Ri、Gi、BiRespectively represents piAnd G, smoothing the red channel, the green channel and the blue channel by Gaussian, wherein the Gaussian matrix used by the Gaussian smoothing is as follows:
(1.2) calculating the grayscale image giEdge gradient image Grad ofiThe formula is as follows:
in the formula, GixDenotes giGrayscale image G for lateral edge detectioniyDenotes giGray level images of longitudinal edge detection;
(1.3) use of the threshold TiaFor the edge gradient image Grad obtained in the step (1.2)iPerforming binarization processing to obtain a mask image omegaiThreshold value TiaThe calculation formula is as follows:
Tia=max(Gradi)·0.2
(1.4) mask image-based ωiObtaining a gray image giTarget area a ofiCalculating aiHistogram of gray levels HiIs a frequency variation value vi[r]Obtaining an image adaptive segmentation threshold TibBy means of TibFor giDividing to be larger than threshold value TibIs a foreground region, less than a threshold value TibDefining the pixel value of the foreground area after segmentation as 1 and the pixel value of the background area as 0 to obtain a segmentation result fi;
Wherein, TibThe calculation formula is as follows:
in the formula, himeanRepresenting the mean value of the image grey frequencies, hi[r]Denotes a frequency (r is 0,1, …,255) at a gray value of r, vi[r]Indicates a frequency variation value (r ═ 0,1, …,255) at the gradation value r,representing the gray value at which the frequency variation value is minimum;
(1.5) Using 2X 2 inner core pairs f, respectivelyiAnd corroding and expanding to obtain a coarse classification result image ki.
3. The automatic ship matching method based on optical satellite remote sensing images as claimed in claim 1, wherein the calculation process of the template in step (2.3) is as follows:
the length and the angle of the foreground in the template are respectively the length and the angle of the corresponding connected domain, the ship length L is taken as an interval to divide real ship data, the average length-width ratio of the ship in each interval is counted, and the length-width ratio of the template foreground is determined according to the interval c where the approximate real length of the connected domain is locatedCalculating the foreground width in the template, wherein the calculation formula of the foreground width is as follows:
in the formula, length represents the foreground length in the template, e represents the number of ships in a ship length interval c in statistical data, delta represents the ship length-width ratio in the statistical data, and res represents the spatial resolution of the remote sensing image;
roughly classified image k according to foreground length, width and angle in template1Generating corresponding template image temples for each connected domain1,1、temple1,2…, obtaining an aggregate TEM1For the coarsely classified image k2Generating corresponding template image temples for each connected domain2,1、temple2,2…, obtaining an aggregate TEM2The pixel value of the foreground region in the template is 1, and the pixel value of the background region in the template is 0.
4. The automatic ship matching method based on the optical satellite remote sensing images as claimed in claim 3, wherein the length L of the ship is 0-50 m.
5. The automatic ship matching method based on optical satellite remote sensing images as claimed in claim 1, wherein the matching method in step (2.4) is as follows:
setting a threshold TSThe template starts to slide from the original point of the image, one pixel is slid each time, the whole image is traversed, the similarity score S between the template and the coverage area of the template is calculated at each position, and if the similarity score is larger than T, the similarity score S is calculatedSIf the matching is successful, recording coordinates of four corner points of the template when the matching is successful, marking the coordinates as a ship target area, and if the same connected domain is marked for multiple times, only keeping the highest similarity score once as the ship target area;
wherein, the similarity score S formula is calculated as follows:
in the formula, sample represents a template, X represents a connected component, and N (-) represents the number of pixels having a pixel value of 1 in the region (-).
6. The automatic ship matching method based on optical satellite remote sensing images as claimed in claim 1, wherein the expansion formula in step (2.5) is as follows:
wherein (x'1,y′1)、(x′2,y′2) Coordinates (x) representing the extended upper left corner point and lower right corner point of the ship target area, respectively1,y1)、(x2,y2) Representing the corresponding coordinates of the target area of the original vessel.
7. The automatic ship matching method based on the optical satellite remote sensing image as claimed in claim 1, wherein the accurate ship extraction process in step (3) is as follows:
(3.1) ships in the ship target area are the foreground to be divided, seawater and other targets are the background, and p is respectively paired in RGB space1、p2The foreground and the background are modeled by a Gaussian mixture model, pixels outside a ship target area are marked as the background, pixels inside the ship target area are marked as possible foreground or background, the Gaussian mixture model is initialized by using a K-means algorithm, K is taken to be 5, each pixel is distributed with a proper Gaussian component, and the nth pixel is distributed with proper Gaussian componentsThe Gaussian component of a pixel is denoted as kn;
(3.2) calculating p separately1、p2Gibbs energy E (α, k, θ, z) of the whole image, formula is as follows:
in the formula, α represents opacity, α ∈ {1,0}, θ ═ { pi (α, K), μ (α, K), ∑ (α, K), α ═ 0,1, K ═ 1,. and K }, z represents a video gray value array, U represents a region energy function, pi represents a weight of a gaussian component, μ represents a mean vector of each gaussian component, Σ represents a covariance matrix, V represents a boundary energy function, γ ═ 50, C represents a set of a certain pixel point and an adjacent pixel point, m and n represent two neighborhood pixels, and β represents a contrast between video pixels;
(3.3) updating the remote sensing image p1、p2Of each pixel of the imageAnd parameters of the Gaussian mixture matrixUntil convergence, finding the minimum value of the energy function E (alpha, k, theta, z) and obtaining p1、p2Obtaining the accurate extracted image z of the ship by the optimal segmentation boundary of the foreground and the background1、z2。
8. The automatic ship matching method based on optical satellite remote sensing images as claimed in claim 1,
the calculation step in step (4) is as follows:
calculating z1、z2The minimum bounding rectangle of each ship in the ship, the area of the ship, the length-width ratio lwr, the angle dir and the minimum bounding rectangle area are obtainedMERThereby obtaining a remote sensing image p1、p2Of each ship P1w=(recw,areaw,lwrw,dirw) And P2j=(recj,areaj,lwrj,dirj) Wherein w represents p1The w ships extracted in (j) represents p2Extracting the jth ship, rec represents the rectangular degree;
the calculation formula of the squareness rec is as follows:
9. the automatic ship matching method based on the optical satellite remote sensing image as claimed in claim 1, wherein the matching process in the step (5) is as follows:
(5.1) calculation of p1The feature vector and p of each ship2Establishing a bipartite graph between two image ships according to the similarity between the feature vectors of each ship, wherein the left vertex of the bipartite graph represents p1Middle ship, right vertex denotes p2Of a ship of (1), the similarity is greater than a threshold value TdConnecting the ships, wherein the weight of the connection is the similarity between the characteristic vectors of the two ships;
(5.2) assigning an initial score to each vertex of the bipartite graph, wherein the initial score of the left vertex is the maximum weight of the side connected with the left vertex, and the initial score of the right vertex is 0;
(5.3) adding the scores of the top points at the left end and the right end of the connecting line, if the added score is more than or equal to the weight of the connecting line, considering that the two sides of the connecting line are the same ship, and when p is greater than or equal to the weight of the connecting line1Two ships are matched to p2When the ship is the same ship, the matching conflicts, a specific value d is set to be 0.1, the left vertex score corresponding to the two conflict connecting lines is reduced by d, and the right vertex score is increased by d;
and (5.4) repeating the step (5.3), when the left vertex score corresponding to the conflict connecting line is 0, abandoning the matching of the ship, continuing to match other ships until the matching of all the ships is completed, and outputting a ship matching result.
10. The automatic ship matching method based on optical satellite remote sensing images as claimed in claim 9, wherein the similarity calculation formula in step (5.1) is as follows:
wherein R (P1)w,P2j) Represents p1W of the second ship and p2Similarity between the j-th ship in the middle, 0 ≦ R (P1)w,P2j)≤1,Andrespectively represent P1wAnd P2jIs measured.
Background
In recent years, with the launching of static optical orbit satellites and video satellites, continuous observation of ships in a large area is made possible, and a rich data source is provided for ship matching. The ship is used as a main transport carrier at sea, and ship matching has important value in both military fields and civil fields. The ship matching can find the same ship in the two images, obtain the distribution condition of the ship and the movement direction of the specific ship, and provide reliable data support for monitoring the marine traffic, monitoring illegal pollutant discharge, illegal fishing and other illegal behaviors.
In the optical satellite remote sensing image, the ship is small in size, few in texture and unclear in characteristics, and interference of sea surface noise, cloud layers and other targets on the sea brings certain difficulty to ship matching. The existing ship matching method is roughly divided into two steps of ship detection and ship matching.
The main methods for ship detection are background subtraction and saliency detection. The background difference method has a good effect on detecting moving ships under a complex background, but is sensitive to environmental noise, can only detect ships moving at a high speed under a fixed background, and has a poor effect on detecting anchored ships and ships moving at a low speed. At present, the most applied significance detection method is significance detection based on contrast, has the advantages of high calculation efficiency and capability of outputting a full-resolution significance map, is easy to generate response on local objects, and is easy to lose effectiveness when cloud cover exists or other sea surface targets interfere.
The ship matching is mainly carried out by extracting local feature points through SIFT, SURF, ORB and other methods, and then matching is carried out. The ship matching effect by adopting the method is not ideal because the ship occupies a small area in the satellite remote sensing image, the characteristics are not obvious, and redundant data generated by calculating the characteristic points of the whole image is more.
Disclosure of Invention
Based on the problems in the prior art, the invention provides an automatic ship matching method based on optical satellite remote sensing images, which can realize ship detection from rough to fine, can accurately match target ships and realizes automatic ship matching of the optical satellite remote sensing images.
The invention adopts the following technical scheme:
a ship automatic matching method based on optical satellite remote sensing images comprises the following steps:
(1) defining the optical satellite remote sensing image with the shooting time before as p1The optical satellite remote sensing image with the later shooting time is p2To p foriRespectively carrying out coarse classification to obtain images k of coarse classification resultsiI represents the ith image, (i is 1, 2);
further, the coarse classification process in step (1) is as follows:
(1.1) use of a Gaussian matrix pair p with a standard deviation of 0 and a size of 5X 5iPerforming Gaussian filtering smoothing to convert the smoothed image into a gray image giThe formula is as follows:
gi=Ri·0.299+Gi·0.587+Bi·0.114
in the formula, Ri、Gi、BiRespectively represents piAnd G, smoothing the red channel, the green channel and the blue channel by Gaussian, wherein the Gaussian matrix used by the Gaussian smoothing is as follows:
(1.2) calculating the grayscale image giEdge gradient image Grad ofiThe formula is as follows:
in the formula, GixDenotes giGrayscale image of lateral edge detection, GiyDenotes giGray level images of longitudinal edge detection;
(1.3) use of the threshold TiaFor the edge gradient image Grad obtained in the step (1.2)iPerforming binarization processing to obtain a mask image omegaiThreshold value TiaThe calculation formula is as follows:
Tia=max(Gradi)·0.2
(1.4) mask image-based ωiObtaining a gray image giTarget area a ofiCalculating aiHistogram of gray levels HiIs a frequency variation value vi[r]Obtaining an image adaptive segmentation threshold TibBy means of TibFor giDividing to be larger than threshold value TibIs a foreground region, less than a threshold value TibDefining the pixel value of the foreground area after segmentation as 1 and the pixel value of the background area as 0 to obtain a segmentation result fi;
In the technical scheme, the foreground comprises ships and other targets, and the background comprises seawater and other targets. Other objects include clouds, islands, noise, etc.
Wherein, TibThe calculation formula is as follows:
in the formula, himeanRepresenting the mean value of the image grey frequencies, hi[r]Denotes a frequency (r is 0,1, …,255) at a gray value of r, vi[r]Indicates a frequency variation value (r ═ 0,1, …,255) at the gradation value r,representing the gray value at which the frequency variation value is minimum;
(1.5) Using 2X 2 inner core pairs f, respectivelyiCorroding and expanding to obtain a coarse classification result image ki。
(2) Image k of coarse classification result by rectangular template1、k2Matching, removing non-ship connected domains, and extracting a ship target area;
the method comprises the following specific steps:
(2.1) defining the upper left corner point of the image as an origin, and the right direction is the positive direction of an x axis and the downward direction is the positive direction of a y axis;
(2.2) calculating k1、k2Obtaining the length, the width and the angle of each connected domain according to the minimum circumscribed rectangle of each connected domain, wherein the length and the width are the length and the width of the corresponding minimum circumscribed rectangle, the angle is an included angle between the extension line of the long side of the minimum circumscribed rectangle and the positive direction of the x axis above the x axis, calculating the length-width ratio of the connected domains, and only keeping the connected domains with the length-width ratio of more than 1.5 and less than 15 to obtain the rest connected domains;
(2.3) calculating k separately1、k2The ship rectangular template of each residual connected domain is obtained to obtain k1Template set TEM1={temple1,1,temple1,2… } and k2Template set TEM2={temple2,1,temple2,2,…};
Further, the calculation process of the template in step (2.3) is as follows:
the length and the angle of the foreground in the template are respectively the length and the angle of the corresponding connected domain, the ship length L is taken as an interval to divide real ship data, the average length-width ratio of the ship in each interval is counted, and the length-width ratio of the template foreground is determined according to the interval c where the approximate real length of the connected domain is locatedCalculating the foreground width in the template, wherein the calculation formula of the foreground width is as follows:
in the formula, length represents the foreground length in the template, e represents the number of ships in a ship length interval c in statistical data, delta represents the ship length-width ratio in the statistical data, and res represents the spatial resolution of the remote sensing image;
roughly classified image k according to foreground length, width and angle in template1Each of which is connected withTemplate image template corresponding to domain generation1,1、temple1,2…, obtaining an aggregate TEM1For the coarsely classified image k2Generating corresponding template image temples for each connected domain2,1、temple2,2…, obtaining an aggregate TEM2The pixel value of the foreground region in the template is 1, and the pixel value of the background region in the template is 0.
Further, the length L of the ship is 0-50 m.
When the L is 50 m, the reaction time is,the specific values of (a) are as follows:
(2.4) use of TEM1For the roughly classified image k1Template matching using TEM2For the roughly classified image k2Carrying out template matching;
further, the matching method in step (2.4) is as follows:
setting a threshold TSThe template starts to slide from the original point of the image, one pixel is slid each time, the whole image is traversed, the similarity score S between the template and the coverage area of the template is calculated at each position, and if the similarity score is larger than T, the similarity score S is calculatedSIf the matching is successful, recording coordinates of four corner points of the template when the matching is successful, marking the coordinates as a ship target area, and if the same connected domain is marked for multiple times, only keeping the highest similarity score once as the ship target area;
wherein, the similarity score S formula is calculated as follows:
in the formula, sample represents a template, X represents a connected component, and N (-) represents the number of pixels having a pixel value of 1 in the region (-).
Further, the threshold T in step (2.4)S=0.8。
(2.5) expanding the ship target area to ensure that the ship is completely contained in the ship target area;
further, the extended formula in step (2.5) is as follows:
wherein (x'1,y'1)、(x'2,y'2) Coordinates (x) representing the extended upper left corner point and lower right corner point of the ship target area, respectively1,y1)、(x2,y2) Representing the corresponding coordinates of the target area of the original vessel.
(3) Inputting the four corner coordinates of the extended ship target area into a GrabCT algorithm, and accurately extracting a remote sensing image p1、p2The ship in (1) to obtain the extracted image z1And z2;
Further, the accurate extraction process of the ship in the step (3) is as follows:
(3.1) ships in the ship target area are the foreground to be divided, seawater and other targets are the background, and p is respectively paired in RGB space1、p2The foreground and the background are modeled by a Gaussian mixture model, pixels outside a ship target area are marked as the background, pixels inside the ship target area are marked as possible foreground or background, the Gaussian mixture model is initialized by using a K-means algorithm, K is taken to be 5, each pixel is distributed with a proper Gaussian component, and the Gaussian component of the nth pixel is expressed as Kn;
(3.2) calculating p separately1、p2Gibbs energy E (α, k, θ, z) of the whole image, formula is as follows:
in the formula, α represents opacity, α ∈ {1,0}, θ ═ { pi (α, K), μ (α, K), ∑ (α, K), α ═ 0,1, K ═ 1,. and K }, z represents a video gray value array, U represents a region energy function, pi represents a weight of a gaussian component, μ represents a mean vector of each gaussian component, Σ represents a covariance matrix, V represents a boundary energy function, γ ═ 50, C represents a set of a certain pixel point and an adjacent pixel point, m and n represent two neighborhood pixels, and β represents a contrast between video pixels;
(3.3) updating the remote sensing image p1、p2Of each pixel of the imageAnd parameters of the Gaussian mixture matrixUntil convergence, finding the minimum value of the energy function E (alpha, k, theta, z) and obtaining p1、p2Obtaining the accurate extracted image z of the ship by the optimal segmentation boundary of the foreground and the background1、z2。
(4) Calculating the extracted image z1、z2A feature vector for each vessel;
further, the calculating step in the step (4) is as follows:
calculating z1、z2The minimum bounding rectangle of each ship in the ship, the area of the ship, the length-width ratio lwr, the angle dir and the minimum bounding rectangle area are obtainedMERThereby obtaining a remote sensing image p1、p2Of each ship P1w=(recw,areaw,lwrw,dirw) And P2j=(recj,areaj,lwrj,dirj) Wherein w represents p1The w ships extracted in (j) represents p2Extracting the jth ship, rec represents the rectangular degree;
the calculation formula of the squareness rec is as follows:
(5) remote sensing image p by using ship feature vector1、p2And (5) matching the ships, and outputting a ship matching result.
Further, the matching process in step (5) is as follows:
(5.1) calculation of p1The feature vector and p of each ship2Establishing a bipartite graph between two image ships according to the similarity between the feature vectors of each ship, wherein the left vertex of the bipartite graph represents p1Middle ship, right vertex denotes p2Of a ship of (1), the similarity is greater than a threshold value TdConnecting the ships, wherein the weight of the connection is the similarity between the characteristic vectors of the two ships;
further, the threshold value T in step (5.1)d=0.6。
Further, the similarity calculation formula in step (5.1) is as follows:
wherein R (P1)w,P2j) Represents p1W of the second ship and p2Similarity between the j-th ship in the middle, 0 ≦ R (P1)w,P2j)≤1,Andrespectively represent P1wAnd P2jIs measured.
(5.2) assigning an initial score to each vertex of the bipartite graph, wherein the initial score of the left vertex is the maximum weight of the side connected with the left vertex, and the initial score of the right vertex is 0;
(5.3) adding the scores of the top points at the left end and the right end of the connecting line, if the added score is more than or equal to the weight of the connecting line, considering that the two sides of the connecting line are the same ship, and when p is greater than or equal to the weight of the connecting line1Two in middleA ship is matched to p2When the ship is the same ship, the matching conflicts, a specific value d is set to be 0.1, the left vertex score corresponding to the two conflict connecting lines is reduced by d, and the right vertex score is increased by d;
and (5.4) repeating the step (5.3), when the left vertex score corresponding to the conflict connecting line is 0, abandoning the matching of the ship, continuing to match other ships until the matching of all the ships is completed, and outputting a ship matching result.
(III) advantageous effects
The method can effectively eliminate the interference of sea surface noise, cloud layers and other sea surface targets, can accurately extract the ship under a moving background and a fixed background, and can realize the automatic matching of the ship under the conditions of few ship characteristics and unclear texture;
the method for self-adaptive threshold value is provided for roughly classifying the optical remote sensing image, extracting possible foreground targets, then automatically generating a template to accurately position ships in the foreground targets, accurately extracting the ships through a GrabCT algorithm, reducing the detection range from rough to fine, avoiding interactive operation of the GrabCT algorithm, eliminating interference of cloud layers, other targets on the sea and noise on the sea, and realizing automatic detection of the ships; and constructing a bipartite graph between two image ships, and empowering the bipartite graph through the similarity between the feature vectors, so that the problem of few feature points of the ship is solved, and the automatic matching of the ship is realized.
Description of the drawings:
FIG. 1 is a schematic flow chart of the steps performed in the present invention;
FIG. 2 is a diagram of the results of the coarse classification according to the present invention;
FIG. 3 is a statistical chart of the ship length and the aspect ratio according to the statistics of the present invention;
FIG. 4 is a schematic view of a captain interval template made in accordance with the present invention;
FIG. 5 is a graph of the results of the ship extraction according to the present invention;
FIG. 6 is a schematic diagram of a ship match bipartite view of the present invention.
The specific implementation mode is as follows:
in order to make the objects, contents and advantages of the present invention clearer, the following detailed description of the embodiments of the present invention is made with reference to the accompanying drawings and examples:
referring to fig. 1, the method comprises the following specific steps:
(1) defining the optical satellite remote sensing image with the shooting time before as p1The optical satellite remote sensing image with the later shooting time is p2To p foriRespectively carrying out coarse classification to obtain images k of coarse classification resultsiI represents the ith video (i is 1, 2);
the rough classification process is as follows:
1.1) use of a Gaussian matrix pair p with a standard deviation of 0 and a size of 5X 5iPerforming Gaussian filtering smoothing to convert the smoothed image into a gray image giThe formula is as follows:
gi=Ri·0.299+Gi·0.587+Bi·0.114
in the formula, Ri、Gi、BiRespectively represents piAnd G, smoothing the red channel, the green channel and the blue channel by Gaussian, wherein the Gaussian matrix used by the Gaussian smoothing is as follows:
1.2) calculating the grayscale image giEdge gradient image Grad ofiThe formula is as follows:
in the formula, GixDenotes giGrayscale image of lateral edge detection, GiyDenotes giGray level images of longitudinal edge detection;
1.3) Using the threshold TiaFor the edge gradient image Grad obtained in the step 2)iPerforming binarization processing to obtain a mask image omegaiThreshold value TiaThe calculation formula is as follows:
Tia=max(Gradi)·0.2
1.4) based on the mask image ωiObtaining a gray image giTarget area a ofiCalculating aiHistogram of gray levels HiIs a frequency variation value vi[r]Obtaining an image adaptive segmentation threshold TibBy means of TibFor giAnd (3) carrying out segmentation, wherein the pixel value of the foreground region is 1 after segmentation, the pixel value of the background region is 0, the foreground comprises ships and other targets, and the background comprises seawater and other targets, so that a segmentation result f is obtainedi;
Wherein, TibThe calculation formula is as follows:
in the formula, himeanRepresenting the mean value of the image grey frequencies, hi[r]Denotes a frequency (r is 0,1, …,255) at a gray value of r, vi[r]Indicates a frequency variation value (r ═ 0,1, …,255) at the gradation value r,representing the gray value at which the frequency variation value is minimum;
1.5) checking f with 2X 2 kernels, respectivelyiCorroding and expanding to obtain a coarse classification result image kiAn example is shown in fig. 2.
(2) Image k of coarse classification result by rectangular template1、k2Matching, removing non-ship connected domains, and extracting a ship target area;
the method comprises the following specific steps:
2.1) defining the upper left corner point of the image as an original point, the right direction as the positive direction of an x axis and the downward direction as the positive direction of a y axis;
2.2) calculating k1、k2And acquiring the length, the width and the angle of each connected domain according to the minimum external rectangle of each connected domain, wherein the length and the width are the length and the width of the corresponding minimum external rectangle, and the angle is the square of the long-side extension line of the minimum external rectangle and the x axisCalculating the length-width ratio of the connected domain at an included angle above the x axis, and only keeping the connected domain with the length-width ratio of more than 1.5 and less than 15 to obtain the residual connected domain;
2.3) calculating k separately1、k2The ship rectangular template of each residual connected domain is obtained to obtain k1Template set TEM1={temple1,1,temple1,2… } and k2Template set TEM2={temple2,1,temple2,2,…};
The calculation process of the template is as follows:
the length and the angle of the foreground in the template are respectively the length and the angle of the corresponding connected domain, the ship length of 50 meters is taken as an interval to divide real ship data, the average length-width ratio of the ship of each interval is counted, and the length-width ratio of the template foreground is determined according to the interval c where the approximate real length of the connected domain is locatedCalculating the foreground width in the template, wherein the calculation formula of the foreground width is as follows:
in the formula, length represents the foreground length in the template, e represents the number of ships in the ship length interval c in the statistical data, delta represents the ship length-width ratio in the statistical data, res represents the spatial resolution of the remote sensing image,the values of (c) are shown in fig. 3, specifically as follows:
roughly classified image k according to length, width and angle of foreground in template1Generating corresponding template image temples for each connected domain1,1、temple1,2…, obtaining an aggregate TEM1To coarseClassified image k2Generating corresponding template image temples for each connected domain2,1、temple2,2…, obtaining an aggregate TEM2The pixel value of the foreground region in the template is 1, the pixel value of the background region in the template is 0, and the template example of each captain section is shown in fig. 4;
2.4) Using TEM1For the roughly classified image k1Template matching using TEM2For the roughly classified image k2Carrying out template matching, wherein the matching method comprises the following steps: setting a threshold TSAnd (0.8), sliding the template from the origin of the image, sliding one pixel at a time, traversing the whole image, calculating a similarity score S between the template and the coverage area of the template at each position, and if the similarity score is more than TSIf the matching is successful, recording coordinates of four corner points of the template when the matching is successful, marking the coordinates as a ship target area, and if the same connected domain is marked for multiple times, only keeping the highest similarity score once as the ship target area;
wherein, the similarity score S formula is calculated as follows:
in the formula, sample represents a template, X represents a connected domain, and N (-) represents the number of pixels with a pixel value of 1 in a region (-) and;
2.5) expanding the target area of the ship to ensure that the ship is completely contained in the target area of the ship, wherein the expansion formula is as follows:
wherein (x'1,y'1)、(x'2,y'2) Coordinates (x) representing the extended upper left corner point and lower right corner point of the ship target area, respectively1,y1)、(x2,y2) Representing the corresponding coordinates of the target area of the original vessel.
(3) Inputting the four corner coordinates of the extended ship target area into a GrabCT algorithm, and accurately extracting a remote sensing image p1、p2The ship in (1) to obtain the extracted image z1And z2;
The accurate ship extraction process comprises the following steps:
3.1) ships in the ship target area are the foreground to be divided, the seawater and other targets are the background, and p is respectively paired in RGB space1、p2The foreground and the background are modeled by a Gaussian mixture model, pixels outside a ship target area are marked as the background, pixels inside the ship target area are marked as possible foreground or background, the Gaussian mixture model is initialized by using a K-means algorithm, K is taken to be 5, each pixel is distributed with a proper Gaussian component, and the Gaussian component of the nth pixel is expressed as Kn;
3.2) calculating p separately1、p2Gibbs energy E (α, k, θ, z) of the whole image, formula is as follows:
in the formula, α represents opacity, α ∈ {1,0}, θ ═ { pi (α, K), μ (α, K), ∑ (α, K), α ═ 0,1, K ═ 1,. and K }, z represents a video gray value array, U represents a region energy function, pi represents a weight of a gaussian component, μ represents a mean vector of each gaussian component, Σ represents a covariance matrix, V represents a boundary energy function, γ ═ 50, C represents a set of a certain pixel point and an adjacent pixel point, m and n represent two neighborhood pixels, and β represents a contrast between video pixels;
3.3) updating the remote sensing image p1、p2Of each pixel of the imageAnd parameters of the Gaussian mixture matrixUntil convergence, finding the minimum value of the energy function E (alpha, k, theta, z) and obtaining p1、p2Obtaining the accurate extracted image z of the ship by the optimal segmentation boundary of the foreground and the background1、z2An example is shown in fig. 5.
(4) Calculating the extracted image z1、z2The feature vector of each ship in the method comprises the following calculation steps:
calculating z1、z2The minimum bounding rectangle of each ship in the ship, the area of the ship, the length-width ratio lwr, the angle dir and the minimum bounding rectangle area are obtainedMERThereby obtaining a remote sensing image p1、p2Of each ship P1w=(recw,areaw,lwrw,dirw) And P2j=(recj,areaj,lwrj,dirj) Wherein w represents p1The w ships extracted in (j) represents p2Extracting the jth ship, rec represents the rectangular degree;
the calculation formula of the squareness rec is as follows:
(5) remote sensing image p by using ship feature vector1、p2And (5) matching the ships, and outputting a ship matching result.
Wherein, the matching process is as follows:
5.1) calculating p1The feature vector and p of each ship2Establishing a bipartite graph between two image ships according to the similarity between the feature vectors of each ship, wherein the left vertex of the bipartite graph represents p1Middle ship, right vertex denotes p2Of a ship of (1), the similarity is greater than a threshold value TdConnecting the vessels of which the number is 0.6, wherein the weight of the connecting line is the similarity between the feature vectors of the two vessels, and the similarity calculation formula is as follows:
wherein R (P1)w,P2j) Represents p1W of the second ship and p2Similarity between the j-th ship in the middle, 0 ≦ R (P1)w,P2j)≤1,Andrespectively represent P1wAnd P2jThe mean value of (a);
5.2) assigning an initial score to each vertex of the bipartite graph, wherein the initial score of the left vertex is the maximum weight of the side connected with the left vertex, and the initial score of the right vertex is 0, and the constructed bipartite graph is shown in FIG. 6;
5.3) adding the scores of the top points at the left end and the right end of the connecting line, if the added score is more than or equal to the weight of the connecting line, considering that the two sides of the connecting line are the same ship, and when p is greater than or equal to the weight of the connecting line1Two ships are matched to p2When the ship is the same ship, the matching conflicts, a specific value d is set to be 0.1, the left vertex score corresponding to the two conflict connecting lines is reduced by d, and the right vertex score is increased by d;
the case of matching conflict is illustrated: in fig. 6, when a3 selects a connection line with a weight of 0.9 to match b1, the connection line conflicts with a1 with a weight of 0.8, at this time, the scores of a1 and a3 are respectively reduced by 0.1, the score of b1 is increased by 0.1, and the connection line with a weight of 0.75 between a1 and b2 is found to meet the matching requirement, so that a1 is paired with b2, and a3 is paired with b1, so that the conflicts are solved;
5.4) repeating the step 5.3), when the left vertex score corresponding to the conflict connecting line is 0, abandoning the matching of the ship, continuing to match other ships until the matching of all ships is completed, and outputting the ship matching result.
After the matching operation, the scores of the left vertices in fig. 6 become 0.7, 0.75, 0.8, and 0.77, respectively, and the scores of the right vertices in fig. 6 become 0.1, 0, 0.1, and 0, respectively, and the ships that have succeeded in the final matching are (a1, b2), (a2, b4), (a3, b1), and (a4, b 3).
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:基于PCA-UVE-ELM的光谱分类方法