# A Novel Ship-Tracking Method for GF-4 Satellite Sequential Images
## 2 Proposed Method Framework
### Position Correction
#### 2.2.2 Ship Association  
Before ship association between AIS data and GF-4 detections, a time projection step for AIS data should be implemented as AIS transmissions occur continuously. In the paper, the positions of AIS data are linearly interpolated or extrapolated to derive ship positions at GF-4 satellite image acquisition time. As there is an approximate 40 s time lag between the acquisition time of the image in NIR band and the acquisition time given in the metadata file [3], the delay should be added in the time projection of AIS data. A position \(y_{i}\) of AIS data in the image coordinates can be obtained by inverse transformation of Equation (3) and the provided RPCs. As global nearest neighbor (GNN) is one of the most prevailing algorithms for data association, we use it for ship association. GNN assignment seeks the best association with the lowest global cost and allows each point to be assigned to only one track. During the GNN association process, the statistical distance \(d_{ij}\) from a AIS position \(y_{i}\) to a GF-4 detection point \(x_{j}\) as cost function would be calculated. The weighted sum of distances should be minimized,  
\[\min\sum_{j=1}^{N_{GF4}}\sum_{i=1}^{N_{AIS}}d_{ij}T_{ij},\ d_{ij}=\left\|y_{i}- x_{j}\right\| \tag{7}\]  
and the following constraints should be met:  
\[\left\{\begin{array}{l}d_{ij}\leq\epsilon,i\leftrightarrow j\\ \sum\limits_{i=1}^{N_{AIS}}T_{ij}\leq 1,\sum\limits_{j=1}^{N_{GF4}}T_{ij}\leq 1,T_{ij}\in\{0,1\}\end{array}\right. \tag{8}\]  
where \(N_{GF4}\) and \(N_{AIS}\) are the number of GF-4 detections and AIS tracks, respectively. \(\epsilon\) is the maximum distance and \(T_{ij}\) is the associated variable. If the distance between two points is less than \(\epsilon\), the target is said to be validated for a given point. \(T_{ij}=1\) means point-to-point association while \(T_{ij}=0\) means no association. The Munkres (also known as Hungarian) algorithm is an efficient algorithm to solve the assignment problem, and it is the easiest one to implement and optimality is guaranteed comparing to other optimal searching methods such as Jonker-Volgenant-Castano (JVC) and Auction algorithms. Therefore, the corresponding relationship in GNN assignment is obtained by Munkres algorithm.  
As the error correction model of ship position is an affine transformation function, only 3 pairs of matching points can solve the affine parameters, and more point pairs can be used by least squares (LS). However, many point pairs obtained by ship association are incorrect. If all the input data are treated indiscriminately directly for solving the affine transformation parameters, there will be a large parameter estimation error. Therefore, a matching subset suitable for estimating the affine transformation must be automatically selected. To robustly estimate the parameters in system error, this paper uses the random sample consensus (RANSAC) algorithm to remove the erroneously associated point pairs, and robust estimation of affine parameters is achieved through LS. The steps are as follows:  
1. Each time 3 pairs of matching points are randomly selected to calculate the affine transformation parameters, and then obtain the error of other point pairs under the current transformation. The point pair whose error is smaller than a certain threshold is used as the interior point, and the interior point set is saved;
2. Repeat random sampling to get the maximum interior point set;
3. The LS algorithm is used to solve the affine transformation parameters for the maximum interior point set. When solving the affine transformation parameters, a point position of AIS is referred \((l^{\prime},s^{\prime})\), and the corresponding matching point of GF-4 detection is referred \((l,s)\).  
After the offset compensation of RPCs model is achieved, the forward transform of GF-4 detection is used to realize the transformation from image coordinates to geographic coordinates in a single frame image.