# A Novel Ranging Technique Based on Optical Camera Communications and Time Difference of Arrival
## 5 Statistical Analysis of the OCC Subsystem  
As mentioned in Section 3, error-less distance estimation could be achieved if Equation (6) were satisfied. However, there still exists an uncertainty given by the time resolution \(\delta t\) of the RS sensor. This resolution corresponds to the row-sweeping time and is presented in Equation (7). \[\delta t=\left(f_{frame}\cdot N_{y}\right)^{-1} \tag{7}\]  
Therefore, all distance measurements are subject to an uncertainty of \(v_{2}(T)\cdot\delta t\). Hereinafter, for simplicity but without loss of generality, this uncertainty is neglected. Furthermore, the pulse  
Figure 7: Critical distance shown as the intersection between the pulse period (on time plus guard, black curve) and the maximum allowed period given the object’s projected height (red curve). The curves correspond to both sides of the inequality in Equation (6) divided by \(f_{frame}\cdot N_{y}\) resulting in time units. \(\gamma=1\), \(T_{guard}\ =\ 1\,\text{ms}\), \(H=1\,\text{ m}\), \(f_{frame}=60\,\text{fps}\), and \(FOV_{v}=\pi/3\,\text{rad}\). duration is calculated as the maximum size of all the detected pulses within the Region Of Interest (ROI) corresponding to the light source. Figure 8 illustrates the procedure on a scenario in which several pulses are allocated, and another in which there is not enough space to detect a complete pulse. It must be taken into account that, if the ROI were smaller than \(n_{pulse}\), it would be impossible to estimate distance properly, establishing a measurable-distance upper bound. In this section, a statistical analysis of the distance estimation error is presented. Furthermore, the implications of the proposed error-mitigation technique on the measurement time are also analyzed. First, let us consider \(M\) runs of the presented pulse detection algorithm. For each measurement, the illuminated row count \(n\) (or detected pulse duration) would follow a probability density function (pdf) determined by \(D_{y}\), \(n_{pulse}\), and \(n_{guard}\). This pdf \(f_{n}(n)\) is discrete and is governed by Equation (8). It was assumed that the starting point of the pulsed signal follows a uniform distribution. The pdf was calculated analyzing the amount of cases for each number of rows \(n\) within a determined window of height \(D_{y}\). \[f_{n}(n)=\left\{ \begin{array}{ll}\frac{D_{y}-n_{pulse}+1}{n_{pulse}+n_{guard }}&n=n_{pulse}\\ \frac{2}{n_{pulse}+n_{guard}}&n=n_{pulse}-i&/i\in\left[1,\lfloor n_{pulse}/2 \rfloor\right]\\ \frac{1}{n_{pulse}+n_{guard}}&n=n_{pulse}/2&/D_{y}-n_{guard}\text{ even}\end{array} \right. \tag{8}\]  
where \(\lfloor\cdot\rfloor\) is the floor operation. Note that the pdf can be roughly approximated by a Dirac's delta at \(n_{pulse}\) plus a uniformly distributed function at the rest of possibilities. After this pdf, a row-count error pdf \(f_{r}(r)\) could be derived from the difference between the correct detection (\(n_{pulse}\)) and the performed measurement (Equation (9)). In this case, the change of variable \(r=n_{pulse}-n\) was applied and the pdf from Equation (8) appropriately modified. \[f_{r}(r)=\left\{ \begin{array}{ll}\frac{D_{y}-n_{pulse}+1}{n_{pulse}+n_{guard }}&r=0\\ \frac{2}{n_{pulse}+n_{guard}}&r=i&/i\in\left[1,\lfloor n_{pulse}/2\rfloor \right]\\ \frac{1}{n_{pulse}+n_{guard}}&r=n_{pulse}/2&/D_{y}-n_{guard}\text{ even}\end{array} \right. \tag{9}\]  
This error can be scaled to distance error using Equations (1) and (7), yielding the final distance-measurement error pdf \(f_{e}(e)\) (Equation (10)). This error is the difference between the actual distance (\(d\)) and the estimated one (\(\bar{d}\)). The estimated distance depends on the number of detected rows (\(n\)), the sound speed (\(v_{2}(T)\)), and the time resolution (\(\delta t\)). Figure 8: Example of detected OCC signal. (**a**) A closer object would blink at a higher frequency, and its projected image would be large. (**b**) A further object would be projected in a smaller ROI and the period of the transmitted signal would increase. \[f_{e}(e)=\left\{