# Image-Based Indoor Localization Using Smartphone Camera

Authors: Shuang Li; Baoguo Yu; Yi Jin; Lu Huang; Heng Zhang; Xiaohu Liang
Journal: Wireless Communications and Mobile Computing
 (2021)

---

## Abstract

With the increasing demand for location-based services such as railway stations, airports, and shopping malls, indoor positioning technology has become one of the most attractive research areas. Due to the effects of multipath propagation, wireless-based indoor localization methods such as WiFi, bluetooth, and pseudolite have difficulty achieving high precision position. In this work, we present an image-based localization approach which can get the position just by taking a picture of the surrounding environment. This paper proposes a novel approach which classifies different scenes based on deep belief networks and solves the camera position with several spatial reference points extracted from depth images by the perspective-n-point algorithm. To evaluate the performance, experiments are conducted on public data and real scenes; the result demonstrates that our approach can achieve submeter positioning accuracy. Compared with other methods, image-based indoor localization methods do not require infrastructure and have a wide range of applications that include self-driving, robot navigation, and augmented reality.


---

## Body

## 1. Introduction

According to statistics, more than 80 percent of people’s living time is in an indoor environment such as shopping malls, airports, libraries, campuses, and hospitals. The purpose of the indoor localization system is to provide accurate positions in large buildings. It is vital to applications such as evacuation of trapped people at fire scenes, tracking of valuable assets, and indoor service robot. For these applications to be widely accepted, indoor localization requires an accurate and reliable position estimation scheme [1].In order to provide a stable indoor location service, a large number of technologies are researched including pseudolite, bluetooth, ultrasonic, WiFi, ultra wideband, and LED [2, 3]. It is almost impossible to obtain very accurate results for a radio-based approach in view of the multipath interference through arrival time and arrival angle methods. The time-varying indoor environment and the movement of pedestrians also have adverse effects on the stability of fingerprint information [4–6]. In addition, the high cost of hardware equipment, construction, and installation as well as maintenance and update is also an important factor limiting the development of indoor positioning technology. Besides, these kinds of methods can only output the position (X,Y,andZ coordinates) but not the view angle (pitch, yaw, and roll angles).The vision-based positioning method is a kind of passive positioning technology which can achieve high positioning accuracy and does not need extra infrastructure. Moreover, it can not only output the position but also the view angle at the same time. Therefore, it has gradually become a hotspot of indoor positioning technology [7, 8]. Such methods typically involve four steps: first, establishing an indoor image dataset collected by depth cameras with exact positional information; second, comparing the images collected by a camera to the images in the database which established the last step; third, retrieving some of the most similar pictures, then extracting the feature and matching the points; at last, solving the perspective-n-point problem [9–12]. However, the application of scene recognition to mobile location implies several challenges [13–15]. The complex three-dimensional shape of the environment results in occlusions, overlaps, shadows, and reflections which require a robust description of the scene [16]. To address these issues, we propose a particularly efficient approach based on a deep belief network with local binary pattern feature descriptors. It enables us to find out the most similar pictures quickly. In addition, we restrict the search space according to adaptive visibility constraints which allows us to cope with extensive maps.


## 2. Related Work

Before presenting the proposed approach, we review previous work on image-based localization methods and divide these methods into three categories roughly.Manual mark-based localization methods completely rely on the natural features of the image which lacks robustness, especially under conditions of varying illumination. In order to improve the robustness and accuracy of the reference point, special coding marks are used to meet the higher positioning requirements of the system. There are three benefits: simplify the automatic detection of corresponding points, introduce system dimensions, and distinguish and identify targets by using a unique code for each mark. Common types of marks include concentric rings, QR codes, or patterns composed of colored dots. The advantage is raising the recognition rate and effectively reducing the complexity of positioning methods. The disadvantage is that the installation and maintenance costs are high, some targets are easily obstructed, and the scope of application is limited [17, 18].Natural mark-based localization methods usually detect objects on the image and match them with an existing building database. The database contains the location information of the natural marks in the building. The advantage of this method is that it does not require additional local infrastructure. In other words, the reference object is actually a series of digital reference points (control points in photogrammetry) in the database. Therefore, this type of system is suitable for large-scale coverage without increasing too much cost. The disadvantage is that the recognition algorithm is complex and easy to be affected by the environment, the characteristics are easy to change, and the dataset needs to be updated [19–22].Learning-based localization methods have emerged in the past few years. It is an end-to-end method that directly obtains 6dof pose, which has been proposed to solve loop-closure detection and pose estimation [23]. This method does not require feature extraction, feature matching, and complex geometric calculations and is intuitive and concise. It is robust in weak textures, repeated textures, motion blur, and lighting changes. In the training phase, the calculative scale is very large, and GPU servers are usually required, which cannot run smoothly on mobile platforms [20]. In many scenarios, learning-based features are not as effective as traditional features such as SIFT, and the interpretability is poor [24–27].


## 3. Framework and Method

In this section, first, we introduce the overview of the framework. Then, the key modules are explained in more detail in the subsequent sections.


### 3.1. Framework Overview

The whole pipeline of the visual localization system is shown in Figure1. In the following, we briefly provide an overview of our system.Figure 1
The framework of the visual localization system.In the offline stage, the RGB-D cameras are held to collect enough RGB images and depth images around the indoor environment. At the same time, the pose of the camera and the 3D point cloud are constructed. The RGB image is used as a learning dataset to train the network model, and then, the network model parameters are saved until the loss function value does not decrease. In the online stage, after the previous step is completed, anyone enters the room, downloads the trained network model parameters to the mobile phone, and takes a picture with the mobile phone, and the most similar image is identified according to the deep learning network. The unmatched points are eliminated, and the pixel coordinates of the matched points and the depth of the corresponding points are extracted. According to the pinhole imaging model, then-point perspective projection problem-solving method can be used to calculate the pose of the mobile phone in the world coordinate system. Finally, the posture is converted into a real position and displayed on the map.


### 3.2. Camera Calibration and Image Correction

Due to the processing error and installation error of camera lens, the image has radial distortion and tangential distortion. Therefore, we must calibrate the camera and correct the images in the preprocessing stage. The checkerboard contains some calibration reference points, and the coordinates of each point are disturbed by the same noise. Establishing the functionγ:(1)γ=∑i=1n∑j=1mpij−p∧A,Ri,ti,Pi2,where pij is the coordinate of the projection points on image i for reference point j in the three-dimensional space. Ri and ti are the rotation and translation vectors of image i. Pi is the three-dimensional coordinate of reference point i in the world coordinate system. p^A,Ri,ti,Pi is the two-dimensional coordinate in the image coordinate system.


### 3.3. Scene Recognition

In this section, we use the deep belief network (DBN) to categorize the different indoor scenes. The framework includes image preprocessing, LBP feature extracting, DBN training, and scene classification.


#### 3.3.1. Local Binary Pattern

The improved LBP feature is insensitive to rotation and illumination changes. The LBP operator can be specifically described as the following: the gray values in the window center pixel are defined as the threshold, and the gray values of the surrounding 8 pixels are, respectively, compared with the threshold in a clockwise direction, and if the gray value is bigger than the threshold, then mark the pixel as 1; otherwise, mark 0, and then get an 8-bit binary number through the comparison. After the decimal conversion, get the LBP value of the center pixel in this window. The value reflects the texture information of the point at this position. The calculation process is shown in Figure2.Figure 2
Local binary pattern calculation process.The formula of local binary pattern:(2)LBPxc,yc=∑n=0N−12nsin−ic,sx=1,ifx≥0,0,else,where xc,yc is the horizontal and vertical coordinate of the center pixel; N is number 8; ic,in are the gray values of the center pixel and the neighborhood pixel, respectively; and s⋅ is the two-valued symbol function.The earliest proposed LBP operator can only cover a small range of images, so the optimization and improvement methods for the LBP operator are constantly proposed by researchers. We adopt the method which improves the insufficiency of the window size of the original LBP operator by replacing the traditional square neighborhood with a circular neighborhood and expanding the window size as shown in Figure3.Figure 3
Three types of LBP.
(a)
LBP51(b)
LBP52(c)
LBP162In order to make the LBP operator have rotation invariance, the circular neighborhood is rotated clockwise to obtain a series of binary strings, and the minimum binary value is obtained, and then, the value is converted into decimal, which is the LBP value of the point. The process of obtaining the rotation-invariant LBP operator is shown in Figure4.Figure 4
Rotation-invariant LBP schematic.


#### 3.3.2. Deep Belief Network

The deep belief network consists of a multirestricted Boltzmann machine (RBM) and a backpropagation (BP) neural network. The Boltzmann machine is a neural network based on learning rules. It consists of a visible layer and a hidden layer. The neurons in the same layer and the neurons in different layers are connected to each other. There are two types of neuron output states: active and inactive, represented by numbers 1 and 0. The advantage of the Boltzmann machine is its powerful unsupervised learning ability, which can learn complex rules from a large amount of data; the disadvantages are the huge amount of calculation and the long training time. The restricted Boltzmann machine canceled the connection between neurons in the same layer; each hidden unit and visible layer unit are independent of each other. Roux and Bengio theoretically prove that as long as the number of neurons in the hidden layer and the training samples are sufficient, the arbitrary discrete distribution can be fitted. The structure of BM and RBM is shown in Figure5.Figure 5
Boltzmann machine and restricted Boltzmann machine.v is the visible layer, m indicates the number of input data, h is the hidden layer, and w is the connection weight between two layers,∀i,j,vi∈0,1,hj∈0,1.The joint configuration energy of its visible and hidden layers is defined as(3)Ev,hθ=−∑i=1mbivi−∑j=1ncjhj−∑i=1m∑j=1nviwijhj,where θ=Wij,bi,cj are parameters in RBM, bi is bias of visible layer i, cj is bias of visible layer j, and wij is the weight.The output of the hidden layer unit is(4)hj=∑j=1nviwij+bj.When the parameters are known, based on the above energy function, the joint probability distribution ofv,h(5)Pv,hθ=e−Ev,hθZθ,Zθ=∑v,he−Ev,hθ,where Zθ is the normalization factor. Distribution of v is Pvθ, joint probability distribution Pv,hθ:(6)Pvθ=∑hpv,hθ=1Zθ∑he−Ev,hθ.Since the activation state of each hidden unit and visible unit is conditionally independent, therefore, when the state of the visible and hidden units is given, the activation probability of the first implicit unit and visible elements is(7)Phj=1v,θ=σbj+∑i=1mviwij,Pvi=1h,θ=σci+∑j=1nhjwij,where σx=1/1+e−x is the sigmoid activation function.


### 3.4. Feature Point Detection and Matching

In this paper, we propose a multifeature point fusion algorithm. The combination of the edge detection algorithm and the ORB detection algorithm enables the detection algorithm to extract the edge information, thereby increasing the number of matching points with fewer textures. The feature points of the edge are obtained by the Canny algorithm to ensure that the object with less texture has feature points. ORB have scale and rotation invariance, and the speed is faster than SIFT. The BRIEF description algorithm is used to construct the feature point descriptor [28–31].The Brute force algorithm is adopted as the feature matching strategy. It calculates the Hamming distance between each point of the template image and each feature point of the sample image. Then compare the minimum Hamming distance value with the threshold value; if the distance is less than the threshold value, regard these two points as the matching points; otherwise, they are not matching points. The framework of feature extraction and matching is shown in Figure6.Figure 6
The process of multifeature fusion extraction and matching.


### 3.5. Pose Estimation

The core idea is to select four noncoplanar virtual control points; then, all the spatial reference points are represented by the four virtual control points, and then, the coordinates of the virtual control points are solved by the correspondence between the spatial reference points and the projection points, thereby obtaining the coordinates of all the spatial reference points. Finally, the rotation matrix and the translation vector are solved. The specific algorithm is described as follows.Givenn reference points, the world coordinate is P~iw=xi,yi,ziT, i=1,2,⋯,n. The coordinates of the corresponding projection point in the image coordinate system are u~i=ui,viT, and the corresponding homogeneous coordinates are Piw=xi,yi,zi,1T and ui=ui,vi,1T. The correspondence between the reference point Piw and the projection point ui:(8)λiui=KRtPiw,where λi is the depth of the reference point and K is the internal parameter matrix of the camera:(9)K=f0u00fv0001,where f=fu=fv is the focal length of the camera and u0,v0=0,0 is the optical center coordinate.First, select four noncoplanar virtual control points in the world coordinate system. The relationship between the virtual control points and their projection points is shown in Figure7.Figure 7
Virtual control point and its projection point correspondence.In Figure7, C1w=0,0,0,1T, C2w=1,0,0,1T, C3w=0,1,0,1T, and C4w=0,0,1,1T. Cjc,j=1,2,3,4 are homogeneous coordinates of the virtual control point in the camera coordinate system, C~jc,j=1,2,3,4 is the corresponding nonhomogeneous coordinate, Cj,j=1,2,3,4 is the homogeneous coordinate of the projection point corresponding in the image coordinate system, and C~j,j=1,2,3,4 is the corresponding nonhomogeneous coordinate. Pic,i=1,2,⋯,n is the homogeneous coordinate of the reference point in the camera coordinate system; P~ic,i=1,2,⋯,n is the corresponding nonhomogeneous coordinate. The relationship between the spatial reference points and the control points in the world coordinate is as follows:(10)Piw=∑j=14αijCjw,i=1,2,⋯,n,where vector αi1,αi2,αi3,αi4T is the coordinate of the Euclidean space based on the control point Cic. From the invariance of the linear relationship under the Euclidean transformation,(11)Pic=∑j=14αijCjc,i=1,2,⋯,n,λiui=KP~ic=K∑j=14αijC~jc,i=1,2,⋯,n.AssumeC~jc=xjc,yjc,zjcT, then(12)λi=∑j=14αijzjc.Then, obtain the equation:(13)∑j=14αijfxjc−αijuizjc=0,∑j=14αijfyjc−αijvizjc=0.AssumeZ=Z1cT,Z2cT,Z3cT,Z4cTT,Zjc=fxjc,fyjc,zjcT,j=1,2,3,4, then the equations are obtained from the correspondence between spatial points and image points as follows:(14)MZ=0.The solutionZ is the kernel space of the matrix M:(15)Z=∑i=1NβiWi,where Wi is the eigenvector of MTM, N is the dimension of the kernel, and βi is the undetermined coefficient. For a perspective projection model, the value of N is 1, resulting in(16)Z=βW,where W=w1T,w2T,w3T,w4TT,wj=wj1,wj2,wj3T; then, the image coordinates of the four virtual control points are(17)cj=wj1wj3,wj2wj3,1,j=1,2,3,4.The image coordinates of the four virtual control points obtained by the solution and the camera focal length obtained during the calibration process are taken into the absolute positioning algorithm to obtain the rotation matrix and the translation vector.


## 3.1. Framework Overview

The whole pipeline of the visual localization system is shown in Figure1. In the following, we briefly provide an overview of our system.Figure 1
The framework of the visual localization system.In the offline stage, the RGB-D cameras are held to collect enough RGB images and depth images around the indoor environment. At the same time, the pose of the camera and the 3D point cloud are constructed. The RGB image is used as a learning dataset to train the network model, and then, the network model parameters are saved until the loss function value does not decrease. In the online stage, after the previous step is completed, anyone enters the room, downloads the trained network model parameters to the mobile phone, and takes a picture with the mobile phone, and the most similar image is identified according to the deep learning network. The unmatched points are eliminated, and the pixel coordinates of the matched points and the depth of the corresponding points are extracted. According to the pinhole imaging model, then-point perspective projection problem-solving method can be used to calculate the pose of the mobile phone in the world coordinate system. Finally, the posture is converted into a real position and displayed on the map.


## 3.2. Camera Calibration and Image Correction

Due to the processing error and installation error of camera lens, the image has radial distortion and tangential distortion. Therefore, we must calibrate the camera and correct the images in the preprocessing stage. The checkerboard contains some calibration reference points, and the coordinates of each point are disturbed by the same noise. Establishing the functionγ:(1)γ=∑i=1n∑j=1mpij−p∧A,Ri,ti,Pi2,where pij is the coordinate of the projection points on image i for reference point j in the three-dimensional space. Ri and ti are the rotation and translation vectors of image i. Pi is the three-dimensional coordinate of reference point i in the world coordinate system. p^A,Ri,ti,Pi is the two-dimensional coordinate in the image coordinate system.


## 3.3. Scene Recognition

In this section, we use the deep belief network (DBN) to categorize the different indoor scenes. The framework includes image preprocessing, LBP feature extracting, DBN training, and scene classification.


### 3.3.1. Local Binary Pattern

The improved LBP feature is insensitive to rotation and illumination changes. The LBP operator can be specifically described as the following: the gray values in the window center pixel are defined as the threshold, and the gray values of the surrounding 8 pixels are, respectively, compared with the threshold in a clockwise direction, and if the gray value is bigger than the threshold, then mark the pixel as 1; otherwise, mark 0, and then get an 8-bit binary number through the comparison. After the decimal conversion, get the LBP value of the center pixel in this window. The value reflects the texture information of the point at this position. The calculation process is shown in Figure2.Figure 2
Local binary pattern calculation process.The formula of local binary pattern:(2)LBPxc,yc=∑n=0N−12nsin−ic,sx=1,ifx≥0,0,else,where xc,yc is the horizontal and vertical coordinate of the center pixel; N is number 8; ic,in are the gray values of the center pixel and the neighborhood pixel, respectively; and s⋅ is the two-valued symbol function.The earliest proposed LBP operator can only cover a small range of images, so the optimization and improvement methods for the LBP operator are constantly proposed by researchers. We adopt the method which improves the insufficiency of the window size of the original LBP operator by replacing the traditional square neighborhood with a circular neighborhood and expanding the window size as shown in Figure3.Figure 3
Three types of LBP.
(a)
LBP51(b)
LBP52(c)
LBP162In order to make the LBP operator have rotation invariance, the circular neighborhood is rotated clockwise to obtain a series of binary strings, and the minimum binary value is obtained, and then, the value is converted into decimal, which is the LBP value of the point. The process of obtaining the rotation-invariant LBP operator is shown in Figure4.Figure 4
Rotation-invariant LBP schematic.


### 3.3.2. Deep Belief Network

The deep belief network consists of a multirestricted Boltzmann machine (RBM) and a backpropagation (BP) neural network. The Boltzmann machine is a neural network based on learning rules. It consists of a visible layer and a hidden layer. The neurons in the same layer and the neurons in different layers are connected to each other. There are two types of neuron output states: active and inactive, represented by numbers 1 and 0. The advantage of the Boltzmann machine is its powerful unsupervised learning ability, which can learn complex rules from a large amount of data; the disadvantages are the huge amount of calculation and the long training time. The restricted Boltzmann machine canceled the connection between neurons in the same layer; each hidden unit and visible layer unit are independent of each other. Roux and Bengio theoretically prove that as long as the number of neurons in the hidden layer and the training samples are sufficient, the arbitrary discrete distribution can be fitted. The structure of BM and RBM is shown in Figure5.Figure 5
Boltzmann machine and restricted Boltzmann machine.v is the visible layer, m indicates the number of input data, h is the hidden layer, and w is the connection weight between two layers,∀i,j,vi∈0,1,hj∈0,1.The joint configuration energy of its visible and hidden layers is defined as(3)Ev,hθ=−∑i=1mbivi−∑j=1ncjhj−∑i=1m∑j=1nviwijhj,where θ=Wij,bi,cj are parameters in RBM, bi is bias of visible layer i, cj is bias of visible layer j, and wij is the weight.The output of the hidden layer unit is(4)hj=∑j=1nviwij+bj.When the parameters are known, based on the above energy function, the joint probability distribution ofv,h(5)Pv,hθ=e−Ev,hθZθ,Zθ=∑v,he−Ev,hθ,where Zθ is the normalization factor. Distribution of v is Pvθ, joint probability distribution Pv,hθ:(6)Pvθ=∑hpv,hθ=1Zθ∑he−Ev,hθ.Since the activation state of each hidden unit and visible unit is conditionally independent, therefore, when the state of the visible and hidden units is given, the activation probability of the first implicit unit and visible elements is(7)Phj=1v,θ=σbj+∑i=1mviwij,Pvi=1h,θ=σci+∑j=1nhjwij,where σx=1/1+e−x is the sigmoid activation function.


## 3.3.1. Local Binary Pattern

The improved LBP feature is insensitive to rotation and illumination changes. The LBP operator can be specifically described as the following: the gray values in the window center pixel are defined as the threshold, and the gray values of the surrounding 8 pixels are, respectively, compared with the threshold in a clockwise direction, and if the gray value is bigger than the threshold, then mark the pixel as 1; otherwise, mark 0, and then get an 8-bit binary number through the comparison. After the decimal conversion, get the LBP value of the center pixel in this window. The value reflects the texture information of the point at this position. The calculation process is shown in Figure2.Figure 2
Local binary pattern calculation process.The formula of local binary pattern:(2)LBPxc,yc=∑n=0N−12nsin−ic,sx=1,ifx≥0,0,else,where xc,yc is the horizontal and vertical coordinate of the center pixel; N is number 8; ic,in are the gray values of the center pixel and the neighborhood pixel, respectively; and s⋅ is the two-valued symbol function.The earliest proposed LBP operator can only cover a small range of images, so the optimization and improvement methods for the LBP operator are constantly proposed by researchers. We adopt the method which improves the insufficiency of the window size of the original LBP operator by replacing the traditional square neighborhood with a circular neighborhood and expanding the window size as shown in Figure3.Figure 3
Three types of LBP.
(a)
LBP51(b)
LBP52(c)
LBP162In order to make the LBP operator have rotation invariance, the circular neighborhood is rotated clockwise to obtain a series of binary strings, and the minimum binary value is obtained, and then, the value is converted into decimal, which is the LBP value of the point. The process of obtaining the rotation-invariant LBP operator is shown in Figure4.Figure 4
Rotation-invariant LBP schematic.


## 3.3.2. Deep Belief Network

The deep belief network consists of a multirestricted Boltzmann machine (RBM) and a backpropagation (BP) neural network. The Boltzmann machine is a neural network based on learning rules. It consists of a visible layer and a hidden layer. The neurons in the same layer and the neurons in different layers are connected to each other. There are two types of neuron output states: active and inactive, represented by numbers 1 and 0. The advantage of the Boltzmann machine is its powerful unsupervised learning ability, which can learn complex rules from a large amount of data; the disadvantages are the huge amount of calculation and the long training time. The restricted Boltzmann machine canceled the connection between neurons in the same layer; each hidden unit and visible layer unit are independent of each other. Roux and Bengio theoretically prove that as long as the number of neurons in the hidden layer and the training samples are sufficient, the arbitrary discrete distribution can be fitted. The structure of BM and RBM is shown in Figure5.Figure 5
Boltzmann machine and restricted Boltzmann machine.v is the visible layer, m indicates the number of input data, h is the hidden layer, and w is the connection weight between two layers,∀i,j,vi∈0,1,hj∈0,1.The joint configuration energy of its visible and hidden layers is defined as(3)Ev,hθ=−∑i=1mbivi−∑j=1ncjhj−∑i=1m∑j=1nviwijhj,where θ=Wij,bi,cj are parameters in RBM, bi is bias of visible layer i, cj is bias of visible layer j, and wij is the weight.The output of the hidden layer unit is(4)hj=∑j=1nviwij+bj.When the parameters are known, based on the above energy function, the joint probability distribution ofv,h(5)Pv,hθ=e−Ev,hθZθ,Zθ=∑v,he−Ev,hθ,where Zθ is the normalization factor. Distribution of v is Pvθ, joint probability distribution Pv,hθ:(6)Pvθ=∑hpv,hθ=1Zθ∑he−Ev,hθ.Since the activation state of each hidden unit and visible unit is conditionally independent, therefore, when the state of the visible and hidden units is given, the activation probability of the first implicit unit and visible elements is(7)Phj=1v,θ=σbj+∑i=1mviwij,Pvi=1h,θ=σci+∑j=1nhjwij,where σx=1/1+e−x is the sigmoid activation function.


## 3.4. Feature Point Detection and Matching

In this paper, we propose a multifeature point fusion algorithm. The combination of the edge detection algorithm and the ORB detection algorithm enables the detection algorithm to extract the edge information, thereby increasing the number of matching points with fewer textures. The feature points of the edge are obtained by the Canny algorithm to ensure that the object with less texture has feature points. ORB have scale and rotation invariance, and the speed is faster than SIFT. The BRIEF description algorithm is used to construct the feature point descriptor [28–31].The Brute force algorithm is adopted as the feature matching strategy. It calculates the Hamming distance between each point of the template image and each feature point of the sample image. Then compare the minimum Hamming distance value with the threshold value; if the distance is less than the threshold value, regard these two points as the matching points; otherwise, they are not matching points. The framework of feature extraction and matching is shown in Figure6.Figure 6
The process of multifeature fusion extraction and matching.


## 3.5. Pose Estimation

The core idea is to select four noncoplanar virtual control points; then, all the spatial reference points are represented by the four virtual control points, and then, the coordinates of the virtual control points are solved by the correspondence between the spatial reference points and the projection points, thereby obtaining the coordinates of all the spatial reference points. Finally, the rotation matrix and the translation vector are solved. The specific algorithm is described as follows.Givenn reference points, the world coordinate is P~iw=xi,yi,ziT, i=1,2,⋯,n. The coordinates of the corresponding projection point in the image coordinate system are u~i=ui,viT, and the corresponding homogeneous coordinates are Piw=xi,yi,zi,1T and ui=ui,vi,1T. The correspondence between the reference point Piw and the projection point ui:(8)λiui=KRtPiw,where λi is the depth of the reference point and K is the internal parameter matrix of the camera:(9)K=f0u00fv0001,where f=fu=fv is the focal length of the camera and u0,v0=0,0 is the optical center coordinate.First, select four noncoplanar virtual control points in the world coordinate system. The relationship between the virtual control points and their projection points is shown in Figure7.Figure 7
Virtual control point and its projection point correspondence.In Figure7, C1w=0,0,0,1T, C2w=1,0,0,1T, C3w=0,1,0,1T, and C4w=0,0,1,1T. Cjc,j=1,2,3,4 are homogeneous coordinates of the virtual control point in the camera coordinate system, C~jc,j=1,2,3,4 is the corresponding nonhomogeneous coordinate, Cj,j=1,2,3,4 is the homogeneous coordinate of the projection point corresponding in the image coordinate system, and C~j,j=1,2,3,4 is the corresponding nonhomogeneous coordinate. Pic,i=1,2,⋯,n is the homogeneous coordinate of the reference point in the camera coordinate system; P~ic,i=1,2,⋯,n is the corresponding nonhomogeneous coordinate. The relationship between the spatial reference points and the control points in the world coordinate is as follows:(10)Piw=∑j=14αijCjw,i=1,2,⋯,n,where vector αi1,αi2,αi3,αi4T is the coordinate of the Euclidean space based on the control point Cic. From the invariance of the linear relationship under the Euclidean transformation,(11)Pic=∑j=14αijCjc,i=1,2,⋯,n,λiui=KP~ic=K∑j=14αijC~jc,i=1,2,⋯,n.AssumeC~jc=xjc,yjc,zjcT, then(12)λi=∑j=14αijzjc.Then, obtain the equation:(13)∑j=14αijfxjc−αijuizjc=0,∑j=14αijfyjc−αijvizjc=0.AssumeZ=Z1cT,Z2cT,Z3cT,Z4cTT,Zjc=fxjc,fyjc,zjcT,j=1,2,3,4, then the equations are obtained from the correspondence between spatial points and image points as follows:(14)MZ=0.The solutionZ is the kernel space of the matrix M:(15)Z=∑i=1NβiWi,where Wi is the eigenvector of MTM, N is the dimension of the kernel, and βi is the undetermined coefficient. For a perspective projection model, the value of N is 1, resulting in(16)Z=βW,where W=w1T,w2T,w3T,w4TT,wj=wj1,wj2,wj3T; then, the image coordinates of the four virtual control points are(17)cj=wj1wj3,wj2wj3,1,j=1,2,3,4.The image coordinates of the four virtual control points obtained by the solution and the camera focal length obtained during the calibration process are taken into the absolute positioning algorithm to obtain the rotation matrix and the translation vector.


## 4. Experiments

We conducted two experiments to evaluate the proposed system. In the first experiment, we compare the proposed algorithm with other state-of-the-art algorithms on public datasets and then perform numerical analysis to show the accuracy of our system. The second experiment evaluated the performance of accuracy in the real world.


### 4.1. Experiment Setup

The experimental devices include an Android mobile phone (Lenovo Phab 2 Pro) and a depth camera (Intel RealSense D435) as shown in Figure8. The user interface of the proposed visual positioning system on a smart mobile phone running in an indoor environment is shown in Figure 9.Figure 8
Intel RealSense D435 and Lenovo mobile phone.Figure 9
The user interface of the proposed visual positioning system on a smart mobile phone running in an indoor environment.


### 4.2. Experiment on Public Dataset

In this experiment, we adopted the ICL-NUIM dataset which consists of RGB-D images from camera trajectories from two indoor scenes. The ICL-NUIM dataset is aimed at benchmarking RGB-D, Visual Odometry, and SLAM algorithms [32–34]. Two different scenes (the living room and the office room scene) are provided with ground truth. The living room has 3D surface ground truth together with the depth maps as well as camera poses and as a result perfectly suits not only for benchmarking camera trajectory but also for reconstruction. The office room scene comes with only trajectory data and does not have any explicit 3D model with it. The images were captured at 640∗480 resolutions.Table1 shows localization results for our approach compared with state-of-the-art methods. The proposed localization method is implemented on Intel Core i5-4460 CPU@3.20 GHz. The total procedure from scene recognition to pose estimation takes about 0.17 s to output a location for a single image.Table 1
Comparison of mean error in ICL-NUIM dataset.
MethodLiving roomOffice roomPoseNet0.60 m, 3.64°0.46 m, 2.97°4D PoseNet0.58 m, 3.40°0.44 m, 2.81°CNN+LSTM0.54 m, 3.21°0.41 m, 2.66°Ours0.48 m, 3.07°0.33 m, 2.40°


### 4.3. Experiment on Real Scenes

The images are acquired by a handheld depth camera at a series of locations. The image size is640×480 pixels, and the focal length of the camera is known. Several images of the laboratory are shown in Figure 10.Figure 10
Images captured from different scenes.Using the RTAB-Map algorithm, we get the 3D point cloud of the laboratory. It is shown in Figure11. The blue points are the position of the camera, and the blue line is the trajectory.Figure 11
3D point cloud of laboratory.The 2D map of our laboratory is shown in Figure12. The length and width of the laboratory are 9.7 m and 7.8 m, respectively. First, select a point in the laboratory as the origin of the coordinate system and establish a world coordinate system. Then, hold the mobile phone, walk along different routes, and take photos, respectively, as indicated by the arrows.Figure 12
Environmental map and walking route.In the offline stage, we get a total of 144 images. Due to some images captured at different scenes being similar, we divide them into 18 categories. In the online stage, we captured 45 images at different locations on route 1 and 27 images on route 2. The classification accuracy formula is(18)P=NiN,where Ni is the correct classified number of scene images and N is the total number of scene images. The classification accuracy of our method is 0.925.Most mismatched scenes concentrate in the corner, mainly due to the lack of significant features or mismatches. Several mismatched scenes are shown in Figure13.Figure 13
Mismatched scene.After removing the wrong matched results, the error cumulative distribution function graph is shown in Figure14.Figure 14
Error cumulative distribution function graph.The trajectory of the camera is compared with the predefined route. After calculating the Euclidean distance between the results through our method and the true position, we get the error cumulative distribution function graph (Figure14). It can be seen that the average positioning error is 0.61 m. Approximately 58% point positioning error is less than 0.5 m, about 77% point error is less than 1 m, about 95% point error is less than 2 m, and the maximum error is 2.55 m.Since the original depth images in our experiment are based on RTAB-Map, its accuracy is not accurate. For example, in an indoor environment, intense illumination and strong shadows may lead to inconspicuous local features. It is also difficult to construct a good point cloud model. In the future, we plan to use laser equipment to construct a point cloud.


## 4.1. Experiment Setup

The experimental devices include an Android mobile phone (Lenovo Phab 2 Pro) and a depth camera (Intel RealSense D435) as shown in Figure8. The user interface of the proposed visual positioning system on a smart mobile phone running in an indoor environment is shown in Figure 9.Figure 8
Intel RealSense D435 and Lenovo mobile phone.Figure 9
The user interface of the proposed visual positioning system on a smart mobile phone running in an indoor environment.


## 4.2. Experiment on Public Dataset

In this experiment, we adopted the ICL-NUIM dataset which consists of RGB-D images from camera trajectories from two indoor scenes. The ICL-NUIM dataset is aimed at benchmarking RGB-D, Visual Odometry, and SLAM algorithms [32–34]. Two different scenes (the living room and the office room scene) are provided with ground truth. The living room has 3D surface ground truth together with the depth maps as well as camera poses and as a result perfectly suits not only for benchmarking camera trajectory but also for reconstruction. The office room scene comes with only trajectory data and does not have any explicit 3D model with it. The images were captured at 640∗480 resolutions.Table1 shows localization results for our approach compared with state-of-the-art methods. The proposed localization method is implemented on Intel Core i5-4460 CPU@3.20 GHz. The total procedure from scene recognition to pose estimation takes about 0.17 s to output a location for a single image.Table 1
Comparison of mean error in ICL-NUIM dataset.
MethodLiving roomOffice roomPoseNet0.60 m, 3.64°0.46 m, 2.97°4D PoseNet0.58 m, 3.40°0.44 m, 2.81°CNN+LSTM0.54 m, 3.21°0.41 m, 2.66°Ours0.48 m, 3.07°0.33 m, 2.40°


## 4.3. Experiment on Real Scenes

The images are acquired by a handheld depth camera at a series of locations. The image size is640×480 pixels, and the focal length of the camera is known. Several images of the laboratory are shown in Figure 10.Figure 10
Images captured from different scenes.Using the RTAB-Map algorithm, we get the 3D point cloud of the laboratory. It is shown in Figure11. The blue points are the position of the camera, and the blue line is the trajectory.Figure 11
3D point cloud of laboratory.The 2D map of our laboratory is shown in Figure12. The length and width of the laboratory are 9.7 m and 7.8 m, respectively. First, select a point in the laboratory as the origin of the coordinate system and establish a world coordinate system. Then, hold the mobile phone, walk along different routes, and take photos, respectively, as indicated by the arrows.Figure 12
Environmental map and walking route.In the offline stage, we get a total of 144 images. Due to some images captured at different scenes being similar, we divide them into 18 categories. In the online stage, we captured 45 images at different locations on route 1 and 27 images on route 2. The classification accuracy formula is(18)P=NiN,where Ni is the correct classified number of scene images and N is the total number of scene images. The classification accuracy of our method is 0.925.Most mismatched scenes concentrate in the corner, mainly due to the lack of significant features or mismatches. Several mismatched scenes are shown in Figure13.Figure 13
Mismatched scene.After removing the wrong matched results, the error cumulative distribution function graph is shown in Figure14.Figure 14
Error cumulative distribution function graph.The trajectory of the camera is compared with the predefined route. After calculating the Euclidean distance between the results through our method and the true position, we get the error cumulative distribution function graph (Figure14). It can be seen that the average positioning error is 0.61 m. Approximately 58% point positioning error is less than 0.5 m, about 77% point error is less than 1 m, about 95% point error is less than 2 m, and the maximum error is 2.55 m.Since the original depth images in our experiment are based on RTAB-Map, its accuracy is not accurate. For example, in an indoor environment, intense illumination and strong shadows may lead to inconspicuous local features. It is also difficult to construct a good point cloud model. In the future, we plan to use laser equipment to construct a point cloud.


## 5. Conclusions and Future Work

In this article, we have presented an indoor positioning system based only on cameras. The main work is to use deep learning to identify the category of the scene and use 2D-3D matching feature points to calculate the location. We implemented the proposed approach on a mobile phone and achieved a positioning accuracy of decimeter level. The preliminary indoor positioning experiment result is given in this paper. But the experimental site is a small-scale place. The following work needs to be done in the future: with the rapid development of deep learning, it can generate high-level semantics and effectively solve the limitations caused by artificial design features, use a more robust lightweight image retrieval algorithm, and carry out tests under different lighting and dynamic environments, system tests under large-scale scenarios, and long-term performance tests.



---

*Source: 3279059-2021-07-05.xml*