## 3 Characterization Method
After capturing the image with the CCD camera and before processing the image to convert it into a binary image, we extracted the region of the image that contains the data, i.e., the stripes region. To detect this region, we used fiducial marks. These marks allowed calculating the scale factor introduced, the rotation, and the possible distortion effects produced by the optical setup. The rotation can be corrected by software to prepare the image to extract the data. We applied some processing operations in the captured image to retrieve the information stored. These processing operations were also applied when we proceeded, afterwards, with the characterization of the complete system in conjunction with recording material. Since we used a binary image, we selected the best threshold value to distinguish between the 0 level and the 1 level. For that reason, we thresholded the image by selecting the appropriate value of the gray level to separate the 0s from the 1s. We analyzed various values to select the level that minimizes the detected errors, and for every gray level we calculate the BER. The CCD has a bit depth of 14 bits, which means that we have values from 0 to 16384. One possibility is to calculate the BER by counting directly the falsely detected bits in the image. To this goal, we first applied a thresholding. In this way, we obtained a binary image. Then, we compared the bits in the binary image obtained with the bits in the original data set displayed in the PA-LCoS, which must to be done for every threshold gray level considered. In the thresholded image, the bit is composed of a block of CCD pixels. We considered the value of the central CCD pixel as the value for the bit. By counting the number of errors, we could calculate the BER. This BER was calculated by dividing the number of errors by the total number of bits. The total number of bits depends on the resolution selected, which means that for a 8 \(\times\) 8 bit size we have 64 \(\times\) 64 (4096) bits of information, 128 \(\times\) 128 (16,384) bits for 4 \(\times\) 4 bit size, 170 \(\times\) 170 (28,900) bits for 3 \(\times\) 3 bit size and 256 \(\times\) 256 (65,536) bits for a 2 \(\times\) 2 bit size. This form of calculating the BER can be useful as a first approximation but it depends too much on the specific image captured. Therefore, it is better to calculate the Q-factor, which offers an estimation measure for the quality of the signal-to-noise ratio. This Q-factor is calculated from the probability distribution of 1s and 0s from the unprocessed images. As long as we can infer the positions of the 1s and 0s, we can obtain a histogram of 1s and 0s and calculate this Q-factor that it is typically used in digital systems in fiber optics communications [27; 28; 29]. Q-factor is given by,  
\[Q=\frac{|\mu_{1}-\mu_{0}|}{\sigma_{1}+\sigma_{0}} \tag{1}\]  
where \(\mu_{1}\) and \(\mu_{0}\) are the mean value in the histograms produced for the gray level distribution of ON and OFF bits, respectively, and \(\sigma_{1}\) and \(\sigma_{0}\) are the corresponding standard deviations. If the histograms are approximated as Gaussian distributions, the relation between BER and Q-factor is given by,  
\[BER=\frac{1}{2}\left[1-erf\left(\frac{Q}{\sqrt{2}}\right)\right] \tag{2}\]  
where _erf_ is the error function [27; 28; 29], which is tabulated in various mathematical handbooks [30; 31]. These values show the capacity of the optical system to recover the digital information introduced. We needed a raw BER in the range of 10\({}^{-3}\) to assure a complete information recovery after introducing error correction codes. In Figure 5, we show a thresholded image captured for a data page with a pixel size of 8 \(\times\) 8 (8 \(\times\) 8 pixels in the PA-LCoS for each bit of information). Figure 5 also shows the division of the image in bits, given by the overlain grid pattern.