## 2 Materials and Methods
### Horizontal Calibration Method  
Working distance and spatial location of the target object are the main confounding factors of horizontal measurements. Circular grids provide an effective way for the spatial sampling of the location inside the FOV. This information can be utilized for determining the dependence of horizontal measurements on the spatial location. Additionally, the grids can be recorded at multiple working distances. This information may be utilized for determining the dependence of horizontal measurements on the working distance. To that end, all circles from Set 1 were segmented. Obviously, depending on the working distance different numbers of circles will fall inside the FOV, and hence will be recorded. The segmentation process of all 65 recordings resulted in 612 different data points. Let w, r\({}_{\text{P}}\)(w), and r\({}_{\text{mm}}\)(w) denote the working distance, pixel radius, and mm radius of a circle, respectively, recorded at w mm. Then, a statistical model can be trained using w and r\({}_{\text{P}}\) as the predictor variables and r\({}_{\text{mm}}\) as the outcome variable. Let \(\mathcal{F}_{\text{M,N}}\) denote a polynomial model in two variables, w and r\({}_{\text{P}}\), with maximum degrees of M and N, respectively. Equations (3) and (4) show the model, where a\({}_{\text{l,k}}\) are some constants determined during the training process:  
\[\text{r}_{\text{mm}}=\mathcal{F}_{\text{M,N}}\big{(}\text{w},\text{r}_{\text {P}}\big{)} \tag{3}\]  
\[\mathcal{F}_{\text{M,N}}\big{(}\text{w},\text{r}_{\text{P}}\big{)}=\sum_{\text {k}=1}^{\text{M}}\sum_{1=1}^{\text{N}}a_{\text{l,k}}\cdot\text{w}^{\text{k}} \cdot\text{r}_{\text{P}}^{\text{l}} \tag{4}\]  
To select the best model, polynomial models with different degrees were evaluated using 10-fold cross-validation. The cost function was defined as the mean absolute error (MAE) over all testing samples from all 10 folds. The \(\mathcal{F}_{5,5}\) resulted in the MAE of 0.025 mm, which was the lowest value. This model will be referred to as the non-uniform model in the rest of this paper. Figure 5A presents the trained non-uniform model.  
To highlight the effect of spatial location on horizontal measurements, a second model was trained where all pixels in the FOV had similar pixel sizes. This scenario mimics horizontal measurement from a parallel-laser projection system. Let, R\({}_{\text{P}}\)(w) and R\({}_{\text{mm}}\)(w)  
Figure 4: Segmentation of a circular grid: (**A**) strips parallel to axes with their respective summations. The red \(\times\) marks denote the detected local minima, (**B**) final segmented circles after the fine-tuning stage.  
denote the pixel radius and mm radius of the largest circle visible in the FOV recorded at the working distance of w mm. The uniform pixel size \(\gamma(\mathrm{w})\) is defined as  
\[\gamma(\mathrm{w})=\frac{\mathrm{R}_{\mathrm{mm}}(\mathrm{w})}{\mathrm{R}_{ \mathrm{P}}(\mathrm{w})} \tag{5}\]  
The uniform pixel size was computed for all recordings in Set 1. Then, a statistical model was trained using the working distance as the predictor variable and \(\gamma\) as the outcome variable. Investigating the relationship between working distance and \(\gamma\) revealed a linear model. This model is shown in Figure 5B and it will be referred to as the uniform model in the rest of this paper.