Geographical Location Estimation based on An Improved Particle Swarm Optimization

This study presents a strategy for determining the relatively accurate geographical location of an object based on a video or a sequence of images taken at regular intervals. On the basis of a series of solar formulas, a precise object’s shadow length model that includes the latitude and longitude of the photographer is built to describe how the shadow changes. Inputting the shadow length of the object and the creation time of the image into the built model, parameters like the latitude or longitude can be estimated by Particle Swarm Optimization (PSO). To solve the problem that PSO is easy to get stuck into local optima, a compression factor and mutation operation are introduced to the algorithm. Through analyzing the instance, the improved PSO algorithm has demonstrated itself with enhancement in convergence and accuracy. In conclusion, the improved PSO is an effective and precise tool to estimate the geographical location of video or images.


Introduction
With the increasing popularity of the camera, more and more people or organizations use camera for multiple purposes, like taking pictures, surveillance, observation of nature scenes, or weather monitoring.On the Internet, there are plenty of videos and photos.Therefore, the methods to determine the location can be improved, actually and potentially, such as identification, intelligence, security, and navigation.Based on the fact, it's significant to determine the geographical location directly through the video or a sequence of images taken at regular intervals.There are some researches about geographical location determination.Jacobs, Satkin, Roman, Speyer and Pless (2007, October) find that a camera can be geo-located by the time course of principal component coefficients without determining correspondences between cameras or explicitly reasoning about weather in the scene.Junejo and Foroosh (2008) present a novel application where, using only three points from the shadow trajectory of the objects, the geo-location of the camera can be determined accurately, and also the date of image can be acquired without using any GPS or other special instruments.Hays and Efros (2008) propose a simple algorithm for estimating a distribution over geographic locations from an individual image using a purely data-driven scene matching approach, through leveraging a dataset of over 6 million GPS-tagged images from the Internet.Wu and Cao (2010) investigate the property of solar shadow trajectories on a planar surface and shows that camera parameters, latitude, longitude can be estimated from two observed shadow trajectories.Sandnes (2010) proposes a strategy for determining the approximate geographical location of a webcam based on a time-stamped image sequence spanning 24 hours.Based on the sunrise and sunset times which can be acquired from the images, both the latitude and longitude of the webcam can be determined.In another paper (Sandnes, 2011), through measuring the relative length of objects and their shadows in image scenes, the elevation of the sun indirectly from the contents of images can be estimated.Next, an approximate geographical location is estimated by inputting the observed sun elevation and the creation time of the image into a celestial model.However, in above papers, geo-location of camera is estimated with lower precision or complicated process.This paper presents an accurate and simple strategy for estimating the geographical location of the photographer only using one object from the video or a sequence of images taken at regular intervals.Firstly, a precise object's shadow length model is built to describe how the shadow changes after analyzing a series of solar formulas that influence the shadow length of the object in the image and considering time difference.Then, the shadow length of an object and the creation time of the images are extracted from the video or a sequence of images.Finally, in order to estimate the parameters like the latitude or longitude of the object in the shadow length model, an objective function based on least square method is built, the shadow length and time are input into the function, and the best geographical location can be determined by the optimization algorithm.As an efficient and simple algorithm, the PSO can be applied to non-linear, multi-peak and non-differential complicated optimization problems.So, in this paper PSO is applied to estimate the latitude and longitude of the camera.

The Construction of Object's Shadow Length Model
In this section, factors influencing the shadow length of object are the object height and the elevation angle of sun.After analyzing a series of related solar formulas, a precise object's shadow length model is built to describe how the shadow changes in the day.

The Relationship of Length of Object's Shadow and the Sun Elevation Angle
We can define the sun elevation angle between the sun's rays and the ground plane when the sunlight irradiates toward the ground as parallel beam.It is widely accepted that the sun elevation angle becomes the largest angle and the object's shadow reaches the shortest length when it was about at noon.Similarly, the sun elevation angle is relatively small in the morning and evening while the object's shadow is longer.Thus, the length of the object's shadow is related to the sun elevation angle.Obviously, the length of the object's shadow is related to the height of its own as well.Here, the equation between the length of object's shadow and the sun elevation angle is given below.We assume that the height of the object is H and the length of the object's shadow is L, therefore, the sun elevation angle can be expressed as:

The Formula of the Sun Elevation Angle
From the globe equatorial coordinate system, the sun elevation angle is the angle between the sun's rays and the tangent which is tangential to the surface with the line connected with the earth's center.We do a preliminary analysis in Figure 2, which shows that the subsolar point, the latitude of object as well as local time will affect the sun elevation angle.
Next, it can be shown that the relationship between the elevation of the sun h and the geographical location of the observer is given by: sin sin sin cos cos cos h Where δ represents solar declination; φ is the latitude of the object; Ω represents solar hour angle.
Figure 2. The sun elevation angle h in globe equatorial coordinate system

The Solar Declination
The solar declination angle is the angle between the rays of the sun and the plane of the earth's equator.Shown in Figure 2, the solar declination is the latitude δ of the subsolar point, the unit of which is degree (º).In this paper, we define positive sign (+) as the Northern Hemisphere, and negative sign (-) as the Southern Hemisphere.Therefore, the value ranges of the solar declination are [-23.5º, 23.5º].Solar declination varies with the seasons and is a sign of seasonal change, so its value only related to date.According to the study of scholars (CHEN & ZHENG, 2011), the changes of the solar declination in one day can be ignored and a more accurate formula can be given as below: Where r is solar angle, which equals to r=2π n/365.2422and n is consisted of two parts: In the formula above, N is day of year, which is the sequence of the date of the year, for example, the day of year of January 1 st is 1.And N 0 can be expressed as: Where INT represents integer and y represents the year.

The Solar Hour Angle
Observing the sun from the earth, the solar hour angle is an expression of time, expressed in angular measurement from solar noon.On the earth, for the people in the same moment and same longitude but different latitude, the corresponding solar hour angle is identical.ω represents the spin angular velocity of the earth and we specify the hour angle at noon is 0, so the time before solar noon expressed as negative degrees, and the local time after solar noon expressed as positive degrees.
When the earth rotate around its axis，the corresponding time is 24 hour and each hour correspond to 15 degrees.
The solar hour angle is calculated as follows： Where AST represents the apparent solar time.
Different from the apparent solar time (AST), the mean solar time (MST) is time usually referred as time that seen in the clock of video or pictures in countries and regions.In geographical location determining problem, we need to transform the mean solar time into more meaningful apparent solar time.
Since the distance and the relative position between the sun and the earth are changing over time and the earth's equator is inconsistent with its orbit plane around the sun, therefore, the apparent solar time always have some difference with the standard time shown at the clock, namely mean solar time.The discrepancy between them is the equation of time (ET).Referring to relative literature (Hejun, 2006), we give a more accurate calculation of the equation of time as follow: ET 0.0172 0.4281cos 7.3515sin 3.3495cos 2 9.3619sin 2 , N is date of year, for example, Jan 1 st is 0, Jan 2 nd is 1 and so on, the unit of ET is minute.
Then, take the time difference in different regions into account and the apparent solar time of a place can be expressed as follow: Where, AST and MST represent the local apparent solar time and local mean solar time respectively.λ is the longitude of the local place, while L st is the corresponding longitude of the standard time used on the video or in the pictures; The value of east longitude is set as positive and west longitude is negative.

The Object's Shadow Length Model
Taking the formulas from ( 2) to ( 7) into (1), a more accurate calculative formula of the object's shadow length can be acquired through integrating all relevant formulas.

{ }
tan arcsin sin sin cos cos cos 15MST 15ET 180 Where H represents the height of the object; δ represents the solar declination; φ and λ represent the latitude and the longitude of the object; L st is the corresponding longitude of the standard time; MST denotes the mean solar time of the local place, as well as ET denotes the Equation of time.
From the above formulas, it can be seen that there are many factors can affect the length of the object's shadow, such as the height of the object, the object's latitude and longitude and the solar declination as well as the equation of time, etc. Analyzing each factor further, the solar declination and the equation of time are only determined by the date.Thus, the date is used here to represent the effects of the solar declination and the equation of time toward object's length.MST is the local mean solar time, which we always see in normal.More intuitive to express, t is used to represents MST.
Thus, in case of knowing the longitude which determines the local standard time, the length of the shadow of object can be more simply defined as L (t, H, D, φ, λ).Namely, the length of object's shadow is affected by the local mean solar time, the height of the object and date as well as the latitude and longitude of the place where the object is located.

The Objective Function
In order to locate the spot based on the video or continuous images, the corresponding length of shadow of the object in video and continuous images in different time of day is extracted and calculated.In the condition that the date, object height, and parameters such as longitude and latitude determined by the local time settled, we can use the sample data to estimate the latitude and longitude where the object is located.The specific method is using Particle Swarm Optimization to the estimate parameters which can make the sum of squares of deviations of observed values and calculated values of the shadow length minimized (least square method), so that the objective function can be expressed as: Where L i represents the observed shadow length of the object at time i; i L′ is the calculated shadow length at time i which can be calculated from formula (9); φ and λ are parameters to be estimated, which are the latitude and the longitude of the object; i is the sequences of time and 1, 2, , i N =  .

The Standard Particle Swarm Optimization
Originating from the simulation of social behavior of birds and fish, Particle Swarm Optimization (PSO), first proposed by Eberhart and Kennedy (1995) in 1995, is a swarm intelligence-based evolutionary computing.With few parameters and simple structure, the algorithm has the advantage of producing and high-quality solutions in limiting time.
In PSO, the basic individual is called particle and each one has an adaptive value determined by the optimization function.Besides, having a velocity that determines its flying direction and distance, each particle will search in the solution space on the basis of the current optimum particles.We define N as the particle size, m as the dimension of solution space.So the position of particle i can be expressed as X i ( x i1 , x i2 , ⋯ , x im ), and the velocity of particle i can be expressed as V i ( v i1 , v i2 , ⋯ , v im ).The best solution achieved so far by particle i itself is P i ( p i1 , p i2 , ⋯ , p im ), and the best solution achieved so far by the whole swarm is represented by P g ( p g1 , p g2 , ⋯ , p gm ).
After finding the two solutions above, every particle can use the following formulas to update its velocity and position. ( Where i represents the i th particle; j is the j th dimension of the particle; t represents the t th iteration; c 1 and c 2 are two positive constants, called cognitive learning rate and social learning rate respectively; rand ( ) is a random function in the range [0, 1]; ω is inertia factor.
As the number of iterations increases, the inertia factor decreasing linearly (Shi & Eberhart, 1998) is a kind of method widely used to control inertia weight in PSO algorithm.
( ) Where ω i (t) is the inertia weight in the t th iteration; t max is the maximum number of iteration defined beforehand; t is the current iteration; ω max is maximum value of inertia weight, the classic value of which is 0.95; ω min is minimum value of inertia weight and the classic value is 0.4.

The Improved Particle Swarm Optimization
It has been proved that Particle Swarm Optimization is highly effective in solving some complex optimization problems.However, like other evolutionary algorithms, the premature phenomenon also exists in PSO.In order to improve the performance in reaching the global optimum of PSO, many studies the improvement of it parameters.Shi and Eberhart (2001) propose a fuzzy adaptive Particle Swarm Optimization.Clerc and Kennedy (2002) analyze the convergence of PSO and introduce the compression factor into the algorithm, which improves convergence rate and guarantees of the precision of convergence.To improve the ability of PSO in breaking away from the local optimum, Lu and Hou (2004) present an adaptive mutation particle swarm optimizer.Guimin, Jianyuan, and Qi (2006) research different kinds of strategies of nonlinear decreasing inertia weight.Iwasaki, Yasuda, and Ueno (2006) propose a dynamic inertia weight strategy that can change according to the search state.
Based on the researches above, this paper improves PSO in the following aspects to avoid local optimum.

The Uniform Distribution Initial Particle
In order to let the particle search in the whole feasible space and increase the probability of finding the optimum solution, particles can be considered evenly distributed throughout the search space.N is the number of particles.
[a, b] m is the search space, and m is the dimension of search space.So the initial position of each particle can be expressed as:

The Introduction of Compression Factor
The introduction of compression factor can greatly improve the convergence of PSO.In this strategy, the velocity equation is changed as: ) )

The Introduction of Adaptive Mutation
Mutation can enhance PSO's ability to jump out of local optimal solution and avoid the premature problem effectively.In this paper, we reference relevant research (Lu & Hou, 2004) and determine the probability of mutation based on the variance of the population's fitness and the current optimal solution.
Since the position of each particle can be reflected through the fitness value, we can quantitatively describe the aggregation degree of particles by analyzing the overall change of fitness values of all particles.The variance of the population's fitness is used to describe the aggregation degree and can be expressed as: Where N is the number of particles; f i represents the fitness value of particle i; f avg is the average fitness value of particle swarm; σ 2 is the variance of the particle swarm's fitness value; f is the normalized scale factor, which can be expressed as: It is indicated from the expression above that σ 2 reflects the convergence of particle swarm.When σ 2 decreases, the particle swarm tends to constriction.Conversely, they are in the stage of random search.
The probability of mutation is affected by the variance of the particle swarm's fitness value.
Where P k is the mutation probability of globally optimal solution in k th iteration; σ is the variance of the population's fitness in k th iteration; P max and P min are the maximum and the minimum of mutation probability respectively.
The stochastic disturbance is used to carry out mutation, and the specific expression is (1 0.5 ) Where η is the random variable obeyed Guass (0, 1) distribution.

The Algorithm Flow of Improved PSO
The algorithm flow of Improved Particle Swarm Optimization (IPSO) is designed as: Step 1: Initialize the particle swarm and the number of particles is N. Determine the positions of initial particles according to formula (14).Set the initial velocity v i at random; Step 2: Select the fitness function of IPSO, which is the objective function about shadow length built above.
Calculate the fitness value of each particle and determine the best position of each particle P i and the best global position P g .
Step 3: Update the velocity and position of particle according to formula (15) and formula (12).
Step 4: Operate the mutation.Calculate the variance of the population's fitness according to formula (16).Calculate the probability of mutation according to formula (18).Produce random number r ∈ [0, 1].If r < P k , carry out the mutation according to formula (19).Otherwise, turn to Step 5.
Step 5: If reach the maximum number of iterations, end the algorithm.Otherwise, turn to Step 2.
Step 6: Output the best global position P g and the corresponding parameter combination.

The Data of Example
In this paper, the measurements are performed and measurement data is used to test our method.The date of the measurement is November 18, 2015 and the time of day is from 13:08 to 14:02 (Chinese Standard Time).The location is 22°15'08"N and 113°31'47"E.The height of a bar used in the measurement is 0.848m.The shadow length of the bar every 3 minute is recorded and the data is shown in the table below.According to the existing information, the solar declination angle is calculated as -19.1118º from formula (3) , ( 4) and ( 5).The calculated ET is 14.5391 minute according to formula (7).Since the time of day is recorded in Chinese Standard Time, L st is 120º.Also, the height of the bar H is 0.848m.Put the calculate results above into the formula (9) and a specific object's shadow length model can be acquired: Where φ and λ represent the latitude and the longitude of the bar respectively; t is the time of day in Chinese Standard Time; L is the height of the bar.
Based on the least square method from formula (10), the latitude φ and the longitude λ are considered as parameters to be estimated, and a series of data of time and shadow length are considered as sample data.Then PSO and IPSO are used to search the minimum value of the objective function f (φ, λ).The corresponding φ and λ are the optimal solutions of geographical location.
Next, MATLAB is used to realize process above and work out the results.

The Optimization Results of PSO and IPSO
The parameters of Particle Swarm Optimization are set up firstly.The given number of particles N is 100.The maximum number of iterations is 500.The number of parameters to be estimated m is 2. The range of latitude is [-90, 90] and the range of longitude is [-180, 180] (the Northern and Western Hemisphere are represented as negative while the Eastern and Southern Hemisphere are represented as positive).Use the PSO and IPSO to calculate the geographical location 100 times respectively, hence the average solution and the optimal solution can be acquired.
The results are shown in the Table 2.The optimal solutions of PSO and IPSO are the same, both of which are 22°45'00"N, 112°36'13"E.Compared with the actual location (22°15'08"N, 113°31'47"E), the error is negligible.So it can be concluded that the optimal solution is relatively accurate.
However, it can be observed that the average solution of PSO have considerable errors (the error of latitude is 51°27'07" and the error of longitude is 09°16'13").The reason is that the result of PSO is easy to get stuck into local optima (57°10'22"S, 128°17'25"E), which is far away from the real location.It indicates that there is a problem of falling into local optimum as the standard Particle Swarm Optimization (PSO) is applied in the geographical location estimation model of this paper.By comparison, average solution of the Improved Particle Swarm Optimization (IPSO) is better than PSO (the errors of IPSO are 01°53'59" in latitude and 00°28'14" in longitude).So we can consider that the result of IPSO is more reliable.Next, the convergence rate of PSO and IPSO are compared.When the error between estimated value and truth value is less than 1º, the convergence is considered succeeds.Otherwise, the convergence is failing.Define the ratio between the number of successful convergence and the total test number as rate of convergence.The number of particles is set as 30, 60, 100 and 200.The maximum number of iterations is 500.The algorithms with different particle number are run 100 times respectively and the results are in the Table 3.It is indicate from Table 3 that as the number of particles increases, the convergence rate of PSO rises gradually.But overall, the rate is still at a lower level, which means that in most cases, PSO traps into local optima easily when it is applied to this problem.By contrast, the convergence rate of IPSO can reach 96% when the particle number is 200.Although both PSO and IPSO cannot fully converge, the rate of convergence of IPSO is much higher than that of PSO.It can be concluded from the comparison that the improvement of PSO can solve the problem of falling into the local optimum, allowing more reasonable and actual result.
To demonstrate the validity of IPSO intuitively, the iterative process of PSO and IPSO are compared.The data is from the sample above.Particle numbers is 100 and maximum numbers of iterations is 100 for both algorithms.PSO and IPSO are run 20 times respectively and the average fitness value is obtained in Figure 3.It can be seen that the average fitness curve of PSO drops rapidly during the initial stage of iterations, declines steadily from the 20th iteration to the 50th iteration and is easy to converge to local optimal solution eventually.
The average fitness curve of IPSO decreases much slower than that of PSO at the beginning, and then it fluctuates because of the adaptive mutation.Finally, it remains steady at the minimum value that is less than the value of PSO, which means that IPSO can avoid of the local beat solution through a series of improvement and is more suitable for solving geographical location estimation problems in this paper.

Conclusion
In this paper, we propose a strategy for determining the geographical location of an object based on a video or a sequence of images taken at regular intervals.Based on the information that can be acquired from the video or images such as date, time of a day, the height of the object and so forth, the relatively accurate location of the object can be estimated.The conclusions and highlights of this article are that: (1) A precise object's shadow length model based on a series of solar formulas is built, which can describe the change of shadow precisely and increase the accuracy of results; (2) PSO has a disadvantage of falling into the local optimum when applied in this problem; (3) the compression factor and adaptive mutation are introduced to the IPSO and through the analysis of an example, and it can be demonstrated that IPSO can avoid of local optimal solution and has good convergence as well as high precision.In conclusion, this paper proposes an original and efficient method to estimate the geographic location of video or pictures based on the Improved Particle Swarm Optimization.

Figure 1 .
Figure 1.The relationship between the sun elevation angle h, object height H and shadow length L.

Figure 3 .
Figure 3.The iteration processes of PSO and IPSO

Table 1 .
The shadow length of a bar in different time

Table 2 .
The average solution and optimal solution of PSO and IPSO

Table 3 .
Comparison of convergence rate between PSO and improved PSO