# Design of OCC Indoor Positioning System Based on Flat Panel Light and Angle Sensor Assistance
## 4 Precise Positioning Assisted by Angle Sensors
There is a mapping relationship between real-world coordinates and camera imaging plane coordinates, because only the case of the mobile terminal parallel to the lamp plane is considered in this chapter, so the simple schematic diagram is shown in Figure 9. The height of the cell phone is h, the height of the flat lamp from the ground is fixed as H (H = 200 cm), the pitch angle of the cell phone is \(\alpha\), which can be obtained by the built-in sensor of the cell phone, and the absolute horizontal distance of the cell phone from the point O of the flat lamp is d. a can be expressed as:  
\[\tan\alpha\ =\ \frac{H-h}{d} \tag{7}\]  
As shown in Figure 10, the yellow area is a flat lamp. Let the terminal coordinates P be (x,y,h). h is a known quantity; x, y coordinates are received by the camera plane to determine the intersection of the projection of A, O points. A, O points are the centers of the circles, and the absolute horizontal distance between the receiving end and A, O points forms the radius of a circle. The two circles intersect at two points P\({}_{1}\) and P\({}_{2}\), the relationship is  
\[ \begin{cases}\left(x-x_{O}\right)^{2}+\left(y-y_{O}\right)^{2}&=\ d_{O}^{2}\\ \left(x-x_{A}\right)^{2}+\left(y-y_{A}\right)^{2}&=\ d_{A}^{2}\end{cases}  \tag{8}\]  
If the measured distance is less than the true distance, this will lead to no solution to the system of equations, and the coordinates of point P can be approximated as the midpoint of A and O. In the normal case, the equation has roots, then the two projected circles intersect at two points P1 and P2, which then need to be screened to determine the true coordinates. In the positioning process, assuming that the front end of the phone faces due north and the vertical position is on the north side of point A and point O, the y-value of the P point is greater than the y-value of point A and point O, and the flat light is located in the upper part of the image. Conversely, when the y-value of the phone is less than the  
Figure 10: Schematic diagram of the pseudo-twin light positioning algorithm. Figure 9: Experimental schematic of precise positioning. y-value of the AO point, the flat light is located in the lower part of the image. The same is true for the east side and west side. The algorithm for filtering coordinates can be summarized in two steps [25]. * Step 1: Using the midpoint of the image as the origin, a right-angle coordinate system is established. The coordinates of individual points of the image are solved using the pixel points as the point locations, and the polar coordinate system (\(\rho\), \(\theta\)) is used for the specific calculation because of the tilt rotation of the image. * Step 2: Determine the horizontal coordinates of point P. As shown in Figure 11, in a polar coordinate system, assume the angles of point A and point O with the polar axis are \(\theta_{1}\), \(\theta_{2}\), respectively, and set \(\Delta\theta\ =|\theta_{2}-\theta_{1}|\). 1. \(\Delta\theta<180^{\circ}\), \(x\ =\ min(x_{A},x_{O}),y\ =\ min(x_{A},x_{O})\);  
2. \(\Delta\theta>180^{\circ}\), \(x\ =\ max(x_{A},x_{O}),y\ =\ max(x_{A},x_{O})\). By this method, the coordinates of the actual position of point P are determined.