# Camera Geolocation Using Digital Elevation Models in Hilly Area
## 4 Propose Method
### Enhanced Angle Chain Code  
Chain code [25] and BAS (Beam Angle Statistics) [26] are common methods for curve feature, but both methods have certain shortcomings. The use of chain code to represent a skyline is unsatisfactory, because the chain code method is sensitive to noise and is not rotation invariant. When a curve is rotated by a small angle, the encoding of the curve will have a certain change, and any noise on in the curve will also have a large interference to the resulting chain code. The BAS method, on the other hand, samples n points on the closed curve, and calculates the angle between each point and the k-order adjacent points on the left and right sides of a point. Since determining the geolocation of a photo skyline is essentially a matching between a partial curve (an open curve in the photo skyline with width related to FoV, e.g., 24\({}^{\circ}\) as illustrated in Figure 8) and an overall curve (360\({}^{\circ}\) in DEM), it cannot be applied directly. Figure 7: Overview of the proposed method for geolocalization by skyline. In this paper, a new method of representing skyline, named Enhanced Angle Chain code, was proposed based on the combination of chain code and BAS, as follows. First, the 360\({}^{\circ}\) DEM skyline is regarded as the standard length, and the skyline of the image is normalized and scaled according to its FoV. Second, set the position of sampled points in the curve (e.g., four sampled points per 1\({}^{\circ}\)). Finally, the angle between a sampled point and an adjacent sampled point is calculated. For example, the 1\({}^{\circ}\)-order angle is the angle between the current sampled point and the sampled points to its left and right that differ by 1\({}^{\circ}\). Let the current point be P\({}_{\text{centre}}\), the reference point on its left be P\({}_{\text{left}}\), and the reference point on its right be P\({}_{\text{right}}\) (as illustrated in Figure 9). The length of the three sides of a triangle, i.e., \(a\), \(b\), and \(c\), are given by the Euclidean distance. According to the cosine theorem, the angle \(\theta\) between P\({}_{\text{centre}}\) and the left and right reference points is  
\[\theta=\arccos\left(\frac{c^{2}-a^{2}-b^{2}}{2 ab}\right). \tag{5}\]  
Considering the triangle parameters corresponding to mountain and valley are the same, the \(\theta\) value can be calculated and limited according to Table 1.  
Figure 8: Skyline with FoV of 24\({}^{\circ}\). Figure 9: Peaks and valleys have the same calculation results. P\({}_{\text{centre}}\) is the selected point, V\({}_{\text{left}}\) and V\({}_{\text{right}}\) are adjacent points of the selected point, and a, b, and c are lengths of three sides of a triangle. Note that the angles of the triangle are related to the length of three sides. In order to facilitate the comparison, we used the 32-based chain code to encode the feature angles of skylines and transformed the curve matching into a string matching. A 32-neighbour representation was proposed by dividing the 360\({}^{\circ}\) into 32 subintervals (as illustrated in Figure 10) that are represented by \"0-9\" and \"A-V\", and each subinterval corresponds to 11.25\({}^{\circ}\). The enhanced angle chain code is a more accurate descriptor. Since the 32-base encoding was adopted, the encoding corresponding to the \(\theta\) angle at P\({}_{\text{centre}}\) is given by  
\[\text{Code}_{\theta}=\left\lfloor\frac{\theta}{\frac{\pi}{16}}\right\rfloor. \tag{6}\]  
In order to reduce the likelihood of coding different tilted versions of the same skyline, the normal vector of the curve was recorded at each sampled point of skyline (as illustrated in Figure 11), and 32-bit chain code was used for coding. Given the slope of P\({}_{\text{left}}\overset{\rightarrow}{\cdot}\text{P}_{\text{right}}\),  
\[\text{Slope}_{\text{chord}}=\text{atan}\left(\frac{y_{right}-y_{left}}{x_{ right}-x_{left}}\right). \tag{7}\]  
and  
\[\text{Slope}_{\text{curve}}=\left\{