## 2 Discovery Algorithm  
The developed algorithm carries out transmitter detection by considering the main spatial-temporal characteristics that allow distinguishing a pixel associated with a transmitter from any other pixel. The four aspects considered for detection are pixel brightness, the size of the illuminated region, luminosity variation, and the patterns that follow these luminosity changes. Due to the high number of tasks to be performed, the algorithm was implemented through four phases, which will be discussed later in this section. Both the minimum luminosity presented by transmitter pixels in the ON intervals (\(L_{min}\)) and the maximum size of the luminous regions associated with transmitters (Maximum Region of Interest or \(ROI_{max}\)) follow a dependent relationship with the average luminosity of the image. To evaluate this dependency, Equations (3) and (4) have been followed. To obtain these equations, a large number of samples of the parameters to be related were taken in different scenarios, and a script was developed to find a polynomial expression that would relate them. Therefore, the algorithm takes into account that while the projection of the transmitter on the image sensor is less than one pixel according to the formulas seen in (1) and (2), the luminous energy can affect several pixels due to the PSF. On the other hand, luminosity variation is generally close to zero in the case of non-transmitter pixels, while it takes a high value in the case of transmitters, which constantly oscillate between the ON and OFF states. \[L_{\text{min}}=\sum_{i=0}^{4}a_{i}\cdot x^{i} \tag{3}\]  
where the coefficients are \(a_{4}=7.331\cdot 10^{-7}\), \(a_{3}=-3.561\cdot 10^{-4}\), \(a_{2}=0.052\), \(a_{1}=-2.297\), and \(a_{0}=164.8\). \[ROI_{\text{max}}=\sum_{i=0}^{3}b\cdot x^{i} \tag{4}\]  
where the coefficients are \(b_{3}=-9.148\cdot 10^{-6}\), \(b_{2}=6.749\cdot 10^{-3}\), \(b_{1}=-1.558\), and \(b_{0}=142.1\). In order to evaluate the patterns by which transmitter luminosity could vary, as well as the minimum number of images to study to detect at least one bit as 1, it was necessary to first define the data frame to work with. The chosen frame was designed and evaluated in [14], and it favors the punctual and brief transmission of data to enhance its use in sensor networks. As observed in Figure 2, it only works with one byte of payload, and the situation where there are more than four consecutive bits set to 1 in the header to facilitate their detection can occur. To implement the algorithm, Python was chosen as the programming language due to its wide range of resources available. Libraries such as Open Source Computer Vision (OpenCV) and scikit-image were used for image processing, while NumPy stood out for data  
Figure 2: Communications data frame. structure handling. Resources related to multiprocessing were especially crucial for executing multiple processes in parallel. These resources were used to work with the images as they were captured as well as to reduce the processing times for those more complex tasks. For the first objective, a Queue object was used, and for the second, a Pool object was employed, allowing the creation of a group of processes. Additionally, the map function was utilized to execute a function multiple times on a list of iterables. This latter method was only employed in Phase 2, which had the highest computational complexity. A general outline of the four phases comprising the image can be observed in Figure 3. As depicted, the first phase involves image extraction. In this phase, the images associated with a 4-s video segment are extracted one by one, taking into account the frames per second (FPS) rate at which the video camera operates. As the images are extracted, they are converted to grayscale and added to the Queue object to be concurrently processed in the next phase. The algorithm does not work with the RGB components because it needs to operate independently of the transmitter's working length.