# Flickering-Free Distance-Independent Modulation Scheme for OCC
## 3 Theoretical Description of the Proposed Modulation
### Theoretical Fundamentals  
When a rolling shutter digital image sensor is employed, one scan-line of photosensors is exposed to the light simultaneously during a given time window (exposure time) and the output is immediately read-out. Therefore, the first line starts its exposure at \(T_{0}\) and the next scan-line is shifted by a fixed period \(T_{1}\), acquiring different light information. For this reason, if a light source is switching on and off at a frequency \(f_{\text{SW}}\) greater than the camera's frame rate \(f_{\text{CAM}}\), the resulting image will include dark and light bands, as shown in Figure 6. The pixel's intensity in those bands depends on the environmental conditions (background illumination), the emitter's optical power, and the camera's settings. Furthermore, the width of the light strips depends on the camera's characteristics and the transmitter's switching frequency. Figure 4: Inverse images with \(PCC=-1\). Figure 5: Images with low linear correlation presenting \(PCC=0.1605\). Figure 6: Rolling shutter effect: ROI of images containing an LED-based lamp switching at 1500 Hz, acquired with a rolling shutter camera at 25 fps with different frame resolution and environmental lighting conditions. It is important to deduce an equation for calculating the width of the light bands obtained due to the rolling shutter effect. At first, the light source's location is determined and the corresponding Region of Interest (ROI) is extracted. Regardless of the emitters shape, the ROI is considered as a rectangle within the light source containing the maximum number of available rows. In this way, the resulting image only contains the light and dark lines eliminating the background and therefore limiting possible elements that could affect system performance. From the definition of the camera's frame rate, it is deduced that each frame is acquired over the same time \(T_{\text{CAM}}\). Therefore, the total amount of exposed lines, pixels' resolution in that direction (\(N_{y}\)), correspond to that time. In the same way, the switching signal period \(T_{\text{SW}}\) is related to the amount of pixels in a dark band and a light strip combined. Assuming that the switching signal has a 50% duty cycle, the band's pixel resolution, \(N_{\text{BAND}}\), is approximately the same for dark and light strips and it is related to half the time \(T_{\text{SW}}\), as shown in Equation (2). \[\left. \begin{array}{c}N_{y}\to T_{\text{CAM}}\\ N_{\text{BAND}}\to T_{\text{SW}}/2\end{array} \right\}\implies N_{\text{BAND}}= \frac{N_{y}T_{\text{SW}}/2}{T_{\text{CAM}}} \tag{2}\]  
Since \(T_{\text{CAM}}=1/f_{\text{CAM}}\) and \(T_{\text{SW}}=1/f_{\text{SW}}\), the band's pixel resolution can be calculated in function of the camera's frame rate and the switching signal's frequency, well-known values, using Equation (3). \[N_{\text{BAND}}=\frac{N_{y}f_{\text{CAM}}}{2\,f_{\text{SW}}} \tag{3}\]  
Additionally, depending on the relation between the switching frequency and the camera's frame rate, the relation between the lighter and darker bands on consecutive frames change. These changes will be used as the data codification scheme in the proposed flickering free, distance independent modulation. Since, the relation between the bands on consecutive frames can be calculated using the PCC, the switching frequency can be deduced from this value. There are three possible cases for the relation between the switching frequency and the camera's frame rate:  
1. The signal frequency is a multiple of the camera's frame rate. \[f_{\text{SW}}=\pi f_{\text{CAM}}\]
2. The signal frequency is perfectly uncoupled. \[f_{\text{SW}}=(\alpha+0.5)f_{\text{CAM}}\]
3. The signal frequency is between the previous values. \[\alpha f_{\text{CAM}}<f_{\text{SW}}<(\alpha+0.5)f_{\text{CAM}}\]  
In the first case, the signal's period will repeat exactly \(\alpha\) times during the frame's acquisition.