## 2 Theory  
When our proposed method starts, the LED-ID recognition algorithm first finds the LED utilizing the image sensor, then the ID of the LED will be recognized. The details of the LED-ID recognition algorithm was deeply researched in our previous works [18; 19]. Our proposed method utilizes the rolling shutter mechanism of the Complementary Metal Oxide Semiconductor (CMOS) image sensor. The exposure and data readout are performed row by row. The data of one row read out immediately when the exposure of this row is finished. The working principle of the rolling shutter mechanism is shown in Figure 1. Instead of employing traditional LED-ID encoding and decoding methods, the process of LED-ID detection and recognition is regarded as a classifying problem regarding machine learning in our algorithm. Through off-line training for the classifiers and on-line recognition for LED-ID, high-speed and robust LED-ID recognition was realized. The LED-ID algorithm will not be detailed in this article. For readers interested in LED-ID recognition, please refer to our previous article [19]. After the LED-ID is recognized, the world's coordinate of the LED is known. Then through single-light positioning technology, the initial real-world position of the positioning terminal can be obtained. Next, the mean shift algorithm and UKF dynamically track the LED in the image sequence, through which the relative position in the pixel coordinates between LED in the current frame and LED in the initial frame can be calculated. Utilizing different coordinate systems and the geometric relationships between the LED and the image sensor, linear mapping from the pixel coordinates to the world's coordinates can be established. With the information above, the relative relationship between the LED's current position and its initial frame in the pixel coordinate plane can be transformed to the relative position relationship in the world's coordinate space. Finally, by combining the positioning terminal's initial position with its relative position relationship in the subsequent frames, the location of the positioning terminal in the real world can be obtained. Figure 1: The working principle of the rolling shutter mechanism. Hence, by dynamically tracking the LED in the two-dimensional plane of the IS in the captured image sequences, indoor dynamic positioning can be accomplished. Because the processing time of our lightweight target tracking algorithm is much shorter than that of most static positioning systems, the real-time ability of our algorithm is also good. The steps of our whole algorithm are as follow:  
First, the LED-ID recognition algorithm obtains the LED's initial world coordinates and pixel coordinates. The latter also initializes MS and UKF. Then the predicted position of UKF is treated as the starting position of iteration in MS. When \(\texttt{c}_{\texttt{b}}\), the ratio of the target's area factor \(\texttt{a}_{\texttt{p}}\) to its initial value, is smaller than the threshold in 5 frames, which means LED is lost in the previous tracking process, the LED-ID recognition algorithm plays its role again to search for the initial position of the LED to start the next tracking cycle. After the LED is tracked and positioned in the pixel coordinate plane, the positioning terminal's world coordinates can be calculated by the proposed algorithm. The flow of the whole algorithm is shown in Figure 2. In the following parts, these processes will be analyzed mathematically, and formulations will be given. After the procedures of LED-ID recognition, the initial position of the LED is obtained, which also initializes MS and UKF. Meanwhile, different coordinate systems, shown in Figure 3, and the geometrical relationship between the LED and image sensor, shown in Figure 4, are utilized to get the location of the positioning terminal in the real world. Define L\({}^{\texttt{t}}\) as the set of pixels belonging to LED at time t in the image, and (x\({}_{\texttt{i}}^{\texttt{t}},y_{\texttt{i}}^{\texttt{t}}\))\(\in\) L\({}^{\texttt{t}}\).