# A Novel Indoor Localization Method Based on Image Retrieval and Dead Reckoning
## 4 Vision-Aided PDR System Design
### Vision-Aided PDR Fusing  
In the case where the PDR positioning result is accurate in a short period and there is a cumulative error in long-term use, we can trust the PDR positioning information and only correct the position by VPR after the person has walked for a while. Since PDR and VPR are two independent systems, the purpose of fusion is to use VPR positioning results to provide absolute position reference information for PDR, without involving the exchange of internal information between the two systems. Therefore, loose coupling is adopted to achieve the fusion positioning of PDR and VPR. The architecture of the proposed V-PDR system is exhibited in Figure 4. The system consists of three parts: data obtain and process, location and fusion. The first part is a layer of raw data acquisition and processing. In this part, input images shot by cameras on the smartphone cannot be used directly. Since these images are too large, it would take a long time to process them in neural networks directly. Besides, the images would be affected by the ambient light, thus other preprocessing is needed. These images are sent to the VPR system after some operations: resizing, translating and reversing. In this way, the images are suitable for neural network processing and some environmental impacts are reduced. The data of sensors acquired by accelerometer, gyroscope and magnetometer in the smartphone are passed to PDR system after being filtered. The second part is called location, which means using the input data to finish positioning. Obviously, it is the most important part of V-PDR. The algorithm for location by PDR and VPR is shown in Sections 3 and 4.1, respectively. Fusion is the third part and optimization and improvement of positioning results are achieved in this stage. Figure 7: Image Acquisition Method. When positioning, the VPR system and the PDR system independently produce positioning results. The PDR position result is \(p_{j}=[x_{j}\quad y_{j}\quad z_{j}]^{T}\), while the VPR position result is \(p_{v}=[x_{v}\quad y_{v}\quad z_{v}]^{T}\). Due to the PDR making no correction to changes in floors, the weighted average of the positions obtained is:  
\[p_{f}=\omega_{j}p_{j}+\omega_{v}p_{v}=[\omega_{j1}\quad\omega_{j2}\quad 0] \begin{bmatrix}x_{j}\\ y_{j}\\ z_{j}\end{bmatrix} +[\omega_{v1}\quad\omega_{v2}\quad 1] \begin{bmatrix}x_{v}\\ y_{v}\\ z_{v}\end{bmatrix}  \tag{13}\]  
where \(\omega_{j}\) and \(\omega_{v}\) obey the rules:  
\[\left\{ \begin{array}{l}\omega_{j1}+\omega_{v1}=1\\ \omega_{j2}+\omega_{v2}=1\end{array} \right. \tag{14}\]  
The weight selection method related to the positioning errors of the PDR and VPR systems determines the weighting factors in the weighted average fusion algorithm by analyzing the positioning errors of the PDR and VPR systems. Subsystems with larger positioning errors have lower reliability and have less weight in the fusion system; subsystems with smaller positioning errors have higher reliability and have greater weight in the fusion system. In the indoor environment, the positioning error of PDR is about 3%. The positioning error of VPR is related to the construction of the local dataset. The distance between each location is about 1 m, and the positioning error of VPR is within 0.5 m. Therefore, the value of the weight in the weighted average algorithm is determined by the positioning performance of PDR and VPR. \[\left\{ \begin{array}{l}\omega_{j}=\left[\frac{|p_{k}^{k}-p_{0x}^{\prime}| \cdot 0.03}{|p_{x}^{k}-p_{0x}^{\prime}|\cdot 0.03+1}\quad\frac{|p_{hy}^{k}-p_{0y}^{ \prime}|\cdot 0.03}{|p_{hy}^{k}-p_{0y}^{\prime}|\cdot 0.03+1}\quad 0\right]\\ \omega_{v}=\left[\frac{|p_{k}^{k}-p_{0x}^{\prime}|\cdot 0.03}{|p_{x}^{k}-p_{0x}^{ \prime}|\cdot 0.03+1}\quad\frac{|p_{hy}^{k}-p_{0y}^{\prime}|\cdot 0.03}{|p_{hy}^{k}-p_{0y}^{ \prime}|\cdot 0.03+1}\quad 1\right]\end{array} \right. \tag{15}\]  
where \(p_{j}^{k}\) is the PDR position result at K and \(p_{0}^{\prime}\) is the start or the last correction location.