Kalman/Map Filtering-Aided Fast Normalized Cross Correlation-Based Wi-Fi Fingerprinting Location Sensing

A Kalman/map filtering (KMF)-aided fast normalized cross correlation (FNCC)-based Wi-Fi fingerprinting location sensing system is proposed in this paper. Compared with conventional neighbor selection algorithms that calculate localization results with received signal strength (RSS) mean samples, the proposed FNCC algorithm makes use of all the on-line RSS samples and reference point RSS variations to achieve higher fingerprinting accuracy. The FNCC computes efficiently while maintaining the same accuracy as the basic normalized cross correlation. Additionally, a KMF is also proposed to process fingerprinting localization results. It employs a new map matching algorithm to nonlinearize the linear location prediction process of Kalman filtering (KF) that takes advantage of spatial proximities of consecutive localization results. With a calibration model integrated into an indoor map, the map matching algorithm corrects unreasonable prediction locations of the KF according to the building interior structure. Thus, more accurate prediction locations are obtained. Using these locations, the KMF considerably improves fingerprinting algorithm performance. Experimental results demonstrate that the FNCC algorithm with reduced computational complexity outperforms other neighbor selection algorithms and the KMF effectively improves location sensing accuracy by using indoor map information and spatial proximities of consecutive localization results.


Introduction
As the development and integration of mobile computing and sensing technologies, ubiquitous computing integrates the physical world and information space and offers widely available computing and information services [1]. In ubiquitous computing, location-sensing computing is becoming increasingly important due to most services are location-based services (LBSs) [2], such as vehicular and asset management, emergency rescue, pedestrian navigation, and proximity marketing. These services are relative to mobile terminal locations. Outdoor users can obtain accurate location information through satellite localization systems [3], but satellite localization system performance is limited in indoor environments owing to signal attenuation and complex radio propagation. Cellular localization also cannot achieve the needed accuracy for indoor LBSs [4]. In this light, numerous indoor location sensing systems have been developed by employing different technologies, such as Bluetooth [5], infrared [6], radio-frequency identification [7], ultra wideband [8], ultrasound [9], and Wi-Fi received signal strength (RSS) [10,11]. Currently, Wi-Fi RSS fingerprinting location sensing is specially preferred and extensively researched because RSS samples are easily sensed and collected by commonly used Wi-Fi mobile terminals from pervasively deployed access points (APs) without additional hardware being required [12].
The RSS fingerprinting method exploits a nonlinear mapping relationship between physical locations and RSS samples from multiple APs. In the off-line phase of the fingerprinting method, specific locations called reference points (RPs) are labeled and RSS samples collected at these RPs are recorded in a database called radiomap. In the on-line phase, on-line RSS data are collected by a Wi-Fi mobile terminal and matched with the RSS data in the radiomap to estimate localization results [13]. So far, many algorithms have been used for RSS fingerprinting. These fingerprinting algorithms are mainly classified as: machine learning and neighbor selection algorithms [14]. The machine learning algorithms, such as artificial neural network (ANN) [15], adaptive neural-fuzzy inference system (ANFIS) [16] and support vector machine (SVM) [17], need an off-line training to model the nonlinear mapping relationship between RSS data and RP location coordinates. Localization coordinates are estimated by the trained nonlinear mapping function with on-line RSS mean samples. Nearest neighbor, K nearest neighbors (KNN) and weighted KNN (WKNN) algorithms are conventional neighbor selection algorithms [11,14]. They select RPs according to RSS distances between the on-line RSS mean sample and RSS mean samples of all the RPs and then estimate localization coordinates with the selected RP coordinates.
However, using the existing fingerprinting algorithms, multiple on-line RSS samples collected at one location are averaged to compute an RSS mean sample, so useful on-line RSS information is lost in the RSS mean computation. These fingerprinting algorithms fail to make full use of all the on-line RSS information [11,[15][16][17]. Additionally, some other available information can also be employed for location-sensing computing, like RSS variations of RPs, indoor map information and spatial proximities of consecutive localization results.
Thus, to take advantage of all this information for accuracy improvement, the contributions of this paper are summarized as follows: First, a fast normalized cross correlation (FNCC) fingerprinting algorithm is proposed to calculate localization coordinates with all the collected on-line RSS samples. It also regards RSS variations of RPs as weights for correlation coefficient computations to precisely select RPs. Compared with the basic normalized cross correlation (NCC) algorithm, which is computationally expensive, the proposed FNCC algorithm greatly reduces computational complexity while maintaining the same accuracy as the NCC, which is higher than those of conventional neighbor selection algorithms.
Second, indoor map information is used by a proposed map matching algorithm. A calibration model that represents pedestrian walkways is integrated into an indoor map. Then a map image matrix is created for the map matching algorithm. Based on the building interior structure, unreasonable location coordinates are corrected by the map matching algorithm to the calibration model and therefore more accurate location coordinates are obtained.
Third, based on the map matching algorithm, a Kalman/map filtering (KMF) is proposed to process fingerprinting results using indoor map information and spatial proximities of consecutive localization results. Through nonlinearizing the linear prediction process of Kalman filtering (KF) by the map matching algorithm, more accurate prediction locations are obtained for the KMF. This greatly improves the KMF performance of increasing location sensing accuracy.
The remainder of this paper is structured as follows: in Section 2, related work is discussed. The proposed FNCC fingerprinting algorithm, map matching algorithm and KMF are described in detail in Section 3. Section 4 gives the experimental setup, results and analyses. Finally, the paper is concluded in Section 5.

Related Work
To the best of our knowledge, NCC has not been applied as an RSS fingerprinting algorithm for location-sensing computing. However, Xiao et al. used correlation coefficients to quantify similarities between observed and stored channel state information to measure the distances between a mobile terminal and RPs [18]. Liu et al. computed spatial correlation between an RP and scanning points (SPs) in the same micro cell [19]. The measured RSS samples at the SPs were used to estimate the RSS data of the RP for a micro-cell radiomap construction.
In the area of image similarity measurements, NCC has been used extensively [20,21]. Because the basic NCC algorithm is time-consuming and is not suitable for time-critical applications, several fast NCC algorithms have been developed to improve computational efficiency. Lewis proposed a fast NCC algorithm based on a sum table approach [22]. But the sum table approach could only efficiently calculate the NCC denominator. It could not be directly applied to calculate the numerator. Yoo et al. proposed a fast NCC algorithm without using multiplication operations [23]. Under an assumption made for the fast algorithm, the simplified method saved computational complexity at the expense of degrading algorithm performance. When their proposed simplified method was applied to the NCC-based fingerprinting algorithm in this paper, it could not precisely measure similarities between on-line RSS data and RSS data in the radiomap. Wei et al. employed another improved NCC for image template matching [24]. The basic NCC equation was rewritten with the image mean substitution operations. The computational efficiency of the rewritten NCC was limitedly increased. Therefore, based on the RSS fingerprinting theory, the proposed FNCC fingerprinting algorithm is able to achieve the same high accuracy as the basic NCC algorithm with greatly reduced computational complexity.
Regarding the filtering algorithms for processing Wi-Fi fingerprinting results, particle filtering (PF) and KF are commonly used. As a linear filtering algorithm, KF processed the localization results of the ANN, nearest neighbor and propagation model [25][26][27] by using spatial proximities of consecutive localization results. But the KF linear state prediction is usually not accurate, which limits its performance. With measurement data from sensors, like electronic compasses, accelerometers or odometers, nonlinear PF improved localization results with the fused sensor data [28,29]. Moreover, indoor map information was also combined with PF-based location sensing systems to further improve system accuracy. Leppakoski et al. employed a PF to fuse Wi-Fi fingerprinting location estimates with pedestrian dead reckoning (PDR) sensor data and map information for pedestrian indoor navigation [30]. Their experimental results indicated that even the poor quality Wi-Fi fingerprinting location estimates still included useful information and fusing them with the sensor data and map information improved their system performance. Beauregard et al. developed a backtracking PF combined with wall information and PDR sensor data to correct the heading direction of a user [31]. With the wall information, particles tried to go across walls were abandoned. The previous state estimate was recalculated without these invalid particle trajectories, so a better estimate was produced. Ascher et al. proposed a map matching algorithm based on PF for 3D map matching [32]. Accurate height estimation from inertial measurement unit and barometer measurements was used for particle constraints to match the estimated trajectory to a multi-floor map.
However, PF-based algorithms are usually time-consuming, especially when the number of particles is considerable. Compared with the PF-based algorithms, the KF computes much faster. Because it works iteratively and just requires a prediction state and measurement data. Thus, through combining a presented map matching algorithm and the KF, a KMF is proposed in this paper. The KF linear prediction process is nonlinearized by the map matching algorithm. With the advantages of both the map matching algorithm and KF, the proposed KMF effectively improves location sensing accuracy with only Wi-Fi fingerprinting results as measurement data. Regarding the limited hardware resources and power of Wi-Fi mobile terminals, the KMF is suitable to be embedded into the Wi-Fi mobile terminals for practical applications.

Kalman/Map Filtering-Aided Fast Normalized Cross Correlation-Based Wi-Fi Fingerprinting Location Sensing
In Section 3.1, the proposed FNCC fingerprinting algorithm is described in detail. The FNCC not only makes full use of off-line and on-line RSS information, but also greatly reduces computational complexity, especially for calculating the NCC denominator, while maintaining high fingerprinting accuracy. A map matching algorithm is presented in Section 3.2. An indoor map is processed and converted into an image matrix with a calibration model for coordinate corrections. With the image matrix, the map matching algorithm can be used as an independent algorithm to correct unreasonable location coordinates. With the integration of the map matching algorithm into the KF, the proposed KMF algorithm is detailed in Section 3.3. The KMF effectively improves location sensing accuracy with indoor map information and spatial proximities of consecutive localization results. For convenience, key symbols used in this paper are listed in Table 1.

Fast Normalized Cross Correlation-Based Fingerprinting Algorithm
NCC has been widely used for many image processing applications because of its abilities to cope with noisy images. In this paper, it is applied to measure the correlation degree between collected on-line RSS data and RSS data of an RP using a correlation coefficient, which ranges from −1 to 1. The correlation coefficient is equal to −1 in the case of a perfect negative correlation, 0 no correlation and 1 a perfect positive correlation [23]. The closer the correlation coefficient approaches to −1 or 1, the stronger the correlation degree between the two RSS data sets. Compared with existing fingerprinting algorithms that calculate localization results with RSS mean samples, the NCC-based fingerprinting algorithm takes advantage of all the available on-line RSS samples to avoid losing useful RSS information in the process of computing an RSS mean sample. In addition, the algorithm also integrates RSS variations of RPs into correlation computations. Thus, the RPs that have more similar RSS characteristics with the collected on-line RSS data can be precisely selected for location-sensing computing. However, the basic NCC algorithm is computationally expensive, so an FNCC fingerprinting algorithm is presented to reduce computational complexity and speed up correlation computations. The correlation coefficient r l of the basic NCC between the on-line RSS matrix rss and the RSS matrix RSS l of l th RP can be calculated by: where parameters μ rss and μ l are the means of the RSS matrices rss and RSS l , respectively. They are computed by Equation (2) (2) After all these L correlation coefficients are obtained, they are sorted in descending order. The RPs that correspond to the first K maximum correlation coefficients are selected to compute localization coordinates through averaging the selected RP location coordinates, which is denoted by: where loc i is the coordinate vector of the selected RP i, {MAX_K(r 1 ,…, r L )} is the set of the first K maximum correlation coefficients and   As we know, it is much faster for a computer to execute a multiplication operation than to execute a square root operation, so Equation (4) is squared to substitute the square root operation in denominator with a multiplication operation in numerator. The squared correlation coefficient 2 l r is computed by: Compared with the basic NCC computation denoted by Equation (1) , , For calculating one squared correlation coefficient 2 l r , Equation (6) executes 2 × N × M − 2 less addition/subtraction operations and 2 more multiplication/division operations than Equation (5). Usually, Equation (6) computes faster than Equation (5), especially under conditions when the numbers of deployed APs M and collected on-line RSS samples N are considerable.

Indoor Map Matching for Coordinate Corrections
To improve location sensing performance, an indoor map integrated with a calibration model is processed for the proposed map matching algorithm. The indoor map is derived from an indoor building plan of computer aided design (CAD) and the calibration model is comprised of straight lines that represent pedestrian walkways. According to the building interior structure, unreasonable localization results are corrected to the calibration model for accuracy improvement.
First, the original indoor map and the indoor map integrated with the calibration model are saved as two JPEG gray-scale images G model and G no_model , respectively. Using Equation (7), the two images are converted into two binary images I model and I no_model , respectively. The size of the binary image matrices is proportionally adapted according to the size of the building plan.
where T threshold is the threshold. In the two binary images I model and I no_model , the pixel points of the calibration model and building structure are represented by 0 and the pixel points of people activity areas are represented by 1. To distinguish the calibration model from the building structure, a new image matrix I match is created by Equation (8) where  is exclusive-or operation.
In the new image matrix I match , the pixel points of people activity areas and building structure are still represented by 1 and by 0, respectively, but the pixel points of calibration model are represented by −1. So the calibration model is recognized by −1 and unreasonable localization results can be corrected to the calibration model. The flow chart of the map matching algorithm is shown in Figure 1 and the algorithm can be generally divided into six steps as follows: (1) Process the available indoor map information and create accurate building plan image matrix I match for map matching. , then go to step 5, otherwise go to step 6.

Kalman/Map Filtering for Wi-Fi Fingerprinting Location Sensing
In the area of Wi-Fi fingerprinting location sensing, KF has been applied to process localization results calculated by fingerprinting algorithms. The KF firstly predicts a user's movement state at the present time step by using the previous movement state. When a present measurement result that is a fingerprinting result is obtained, the measurement result is used to correct the predicted movement state. In this process, spatial proximities of consecutive localization results are employed by the KF. However, one drawback of the KF is its linear prediction model cannot precisely predict people movement in indoor environments, so the map matching algorithm is employed by the KMF to nonlinearize the linear prediction process.
The general KF linear process and measurement equations are as follows:     where X n is the state vector, A is the state transition matrix, Z n is the measurement vector, H is the measurement design matrix, w n is the process noise, v n is the measurement noise, and Q and R are the noise covariance matrices. The KF operates in two distinct phases: the time update and measurement update. In the time update phase, the new state vector and its uncertainty at the present time step are predicted, which is given by: In the measurement update phase, the predicted vector is corrected and the KF parameters are updated for the next iteration when a measurement result is obtained. The process is denoted by: where ˆn X is the a priori estimate of the process, ˆn X is the a posteriori estimate of the process, n P is the covariance matrix of the a priori estimate, P n is the covariance matrix of the a posteriori estimate, K n is the Kalman gain, and I is the identity matrix. The KF linear prediction denoted by Equation (10) causes considerable errors between the predicted locations and actual locations because people move randomly in indoor environments. To predict a user's location more precisely, the proposed map matching algorithm is integrated into the KF prediction process for the nonlinearity of the process. The map matching process for correcting location coordinates is described by a nonlinear function Setting the a priori estimate of the process ˆn X as follows: is the velocity vector, v x and v y are the velocities in X axis and Y axis, respectively. So after the prediction process is nonlinearized by the map matching algorithm, Equation (13) is changed to: Subsequently, the formula for calculating the a posteriori estimate in Equation (11) is changed to:  ˆ     n n n n n X X K Z HX (15) The diagram of the proposed KMF is shown in Figure 2 as follows.

Experimental Setup
The experimental floor is a rectangular area of 24.9 m × 66.4 m. For communication purposes on the floor, nine Linksys WAP54G APs were deployed. As shown in Figure 3, only four of them were deployed in the 24.9 m × 28.0 m experimental area.

Localization Results of Fast Normalized Cross Correlation-Based Fingerprinting Algorithm
The performance of the FNCC algorithm is evaluated with the collected RSS testing data. For comparison, the mean errors of the FNCC and conventional KNN algorithms are calculated with the numbers of on-line RSS samples N and selected RPs K varying from 1 to 20, respectively. As shown in Figure 4, the FNCC algorithm outperforms the KNN algorithm. Compared with the KNN algorithm that computes RSS distances between RSS mean samples, the FNCC algorithm makes full use of the available RSS information through exploiting all the on-line RSS samples to avoid useful RSS information loss in RSS mean sample calculations and incorporating RSS variations of RPs in the radiomap denoted by the term into correlation calculations as weights. As parameter K increases, the FNCC algorithm performance is more stable than that of the KNN algorithm. When no information is available for setting parameter K, it is easier to set a proper parameter K for the FNCC algorithm to achieve a comparable accuracy. Considering the number and distribution of RPs as well as computational complexity, parameter N and parameter K are set equal to 2 and 7, respectively. To simulate the condition that a user moves at a speed of 0.6 m/s along the experimental trajectory, only two RSS testing samples were employed at each TP. The localization results calculated by the KNN, WKNN and FNCC algorithms are shown in Figure 5. The localization results calculated by the FNCC algorithm in Room 1211 and the corridor corners are more accurate than those calculated by the KNN and WKNN algorithms. In this experiment, the mean errors of the KNN, WKNN and FNCC algorithms are 3.00 m, 2.96 m and 2.71 m, respectively. With all these 6,500 RSS testing samples, the mean errors, standard deviations and cumulative probabilities of these fingerprinting algorithms are calculated and listed in Table 2. The FNCC algorithm performance is the same as that of the basic NCC algorithm, which is better than the

Computational Complexity of Fast Normalized Cross Correlation-Based Fingerprinting Algorithm
Regarding the on-line computational complexity, some terms in both the denominators and numerators of Equations (1), (5) and (6) to be calculated once for computing one correlation coefficient. Thus, for calculating one localization result, the computational complexities of these algorithms are quantified and listed in Table 3. As mentioned previously, numbers of labeled RPs L, deployed APs M, on-line RSS samples N, and selected RPs K are equal to 91, 9, 2, and 7, respectively, so the addition/subtraction operation numbers of the KNN, WKNN, NCC with Equation (1) (6) are about three times more than those of the KNN, the KNN needs to calculate 91 square root operations, which is much more complex than the other mathematical operations. Therefore, because of its high accuracy and low computational complexity, the proposed FNCC algorithm is suitable for practical applications.

Map Matching Correction Results
In this paper, the threshold T threshold for converting the gray-scale images into the binary images is set equal to 0.55. The same mobile user experiment shown in Figure 5 is used to verify the effectiveness of the map matching algorithm. The localization results of both the KNN and FNCC algorithms, their corrected results by the map matching algorithm, the building structure, and the calibration model are converted from image matrices and shown in Figure 6 below.  Table 4. The mean errors of the KNN, WKNN and FNCC algorithms are reduced to 2.62 m, 2.57 m and 2.39 m, respectively, and their standard deviations are reduced to 1.90 m, 1.89 m and 1.85 m, respectively. After the map matching corrections, the cumulative probabilities of all these algorithms increase. As shown in Table 2 in Section 4.2.1, the cumulative probability of the FNCC within 2 m and 3 m errors are 45.9% and 68.9%, respectively, which are still better than those of the KNN + Map that are 43.5% and 67.4%, respectively. The FNCC localization results corrected by the map matching algorithm are apparently more accurate than the results of the other algorithms. These experimental results indicate that the proposed map matching algorithm is effective to correct localization results with the indoor map. With the map matching algorithm, the KF linear prediction process is nonlinearized by the proposed KMF. Accurate prediction locations corrected by the map matching algorithm increase the accuracy of the KMF estimates after measurement corrections. Based on the KF theory, the proposed KMF process equation is set as follows: where a x and a y are the accelerations in X axis and Y axis, respectively. They are set equal to 0.05 m/s 2 . w n ~ N(0,Q) is the process noise and T    nn E Q w w is computed by the w n .
The KMF measurement equation is given by:  (17) where z x and z y are the measurement coordinates in X axis and Y axis, respectively. v n ~ N(0,R) Figure 7 shows the experimental results of the KNN and FNCC mentioned in Section 4.2 and their processed results by the KMF. The processed results by the KMF are more consecutive and reasonable than those of the KNN and FNCC because they are corrected with the indoor map and spatial proximities of consecutive localization results. This illustrates that the KMF has the advantages of both the map matching algorithm and KF. Thus, the KMF outperforms each of the two algorithms. In the experiment shown by Figure 7, the mean errors of the FNCC + KMF and KNN + KMF are 1.59 m and 1.73 m, respectively, which is better than the map matching results mentioned in Section 4.3.1 and also better than the mean errors of the results processed by the KF that are 2.55 m and 2.83 m, respectively.  Table 2 in Section 4.2.1 and Table 4 in Section 4.3.1, the results of the KNN, WKNN, FNCC, and their processed results by the proposed map matching and KMF algorithms are listed in Table 5. With the proposed KMF algorithm, the mean errors of the KNN, WKNN and FNCC decrease 32.1%, 30.7% and 28.1%, respectively. The cumulative probability curves of all these algorithms are also shown in Figure 8. The cumulative probabilities of the localization results processed by the KMF are much higher than those of the other algorithms. Specifically, the cumulative probabilities of the FNCC + KMF within 2 m and 3 m errors reach 61.3% and 85.1%, respectively. These results demonstrate that the proposed KMF is remarkably effective to improve location sensing accuracy by making use of indoor map information and spatial proximities of consecutive localization results.

Conclusions
In this paper, a KMF-aided FNCC Wi-Fi fingerprinting indoor location sensing system is proposed. Because the NCC is able to make full use of off-line RSS variations of RPs and all the collected on-line RSS samples, the NCC fingerprinting algorithm outperforms the conventional KNN and WKNN fingerprinting algorithms that calculate a localization result with only an on-line RSS mean sample. However, the computational cost of the basic NCC algorithm is very expensive, so an FNCC algorithm is developed. It greatly reduces computational complexity while maintaining the same high accuracy as the basic NCC algorithm. Through integrating a proposed map matching algorithm into the KF, a KMF is proposed to improve location sensing accuracy. Using available indoor map information, the proposed map matching algorithm corrects unreasonable locations computed by the KF linear state prediction process to a calibration model, which represents pedestrian walkways. Based on the corrected locations, the KMF can calculate more accurate localization results using measurement data than the KF. The experimental results confirm both that the FNCC significantly reduces computational complexity of correlation computations without accuracy decreases and that KMF effectively improves location sensing accuracy by using indoor map information and spatial proximities of consecutive localization results.