## 4 Depth Estimation Algorithm
### Processing Steps  
These equations show that the object distance is computed by estimating virtual depth which subsequently depends on the points projected by the micro-lenses. These calculations show how the final depth is estimated, which is achieved by a series of steps. Therefore, modified algorithm is divided into several processing steps: pre-processing, non-parametric transform, best-match computation and consequently depth-evaluation, as depicted by a UML activity diagram in Figure 4.  
During pre-processing, geometric data of the micro-images, including lens-types and corresponding coordinates of its center, is calculated with the help of calibration information. Moreover, valid pixels in the input raw image are defined with respect to the MLA. Raytrix R5 camera [38] used in this study consists of an MLA with three different types of micro-lenses. Figure 5 depicts micro-lenses with distinct focal-lengths that are arranged in a hexagonal order. The center micro-lens and the surrounding micro-lenses are represented by L\({}_{\text{ri}}\) and L\({}_{\text{ij}}\) respectively. The numbers (0-5), which are inscribed on the micro-lenses correspond to the values of \(j\) in L\({}_{\text{ij}}\). Additionally, the radius of micro-lens \(r_{L}\), diameter \(d_{L}\) and baseline distance \(b\) with respect to the L\({}_{\text{ri}}\) are indicated. Since the micro-lenses are arranged in a hexagonal order and their respective diameters are equal, the \(b\) between two micro-lenses is computed by:  
\[b=l_{n}\cdot d_{L}. \tag{10}\]  
Whereby \(l_{n}\) is a positive integer that implies how far is the target micro-lens L\({}_{\text{ij}}\) from the L\({}_{\text{ri}}\) in terms of number of micro-lenses, \(l_{n}\in\{1,2,3\dots\}\). However, it is only valid for the micro-lenses that are located at multiple of \(60^{\circ}\) with respect to the reference micro-lens. It is due to the hexagonal arrangement of the micro-lenses in the MLA grid. For instance, \(b\) of L\({}_{\text{ri}}\) with the adjacent target micro-lens L\({}_{\text{L2}}\) is calculated as:  
\[b=\frac{r_{L}}{\cos(60^{\circ})}=2\cdot r_{L}=1\cdot d_{L}. \tag{11}\]  
The rest values of \(l_{n}\) are calculated by using trigonometric relations. Figure 4: UML activity diagram of the modified depth estimation algorithm. Figure 6 contains two adjacent micro-images. The border \(b_{\mu}\), \(r_{L}\) and \(d_{L}\) of the micro-images are defined in number of pixels. Raytrix R5 [38] camera has the \(b_{\mu}\) of 1 pixel. The modified algorithm defines valid pixels in a micro-image which are those that lie within the border of the micro-lens. The reference pixel \(P_{r}(x,y)\) is placed inside the reference micro-image \(I_{ri}\) whose center is at \(C_{ri}(c_{xi},c_{yi})\). The point \(P_{r}(x,y)\) is considered valid only if this condition holds true:  
\[\|P_{r}(x,y)-C_{ri}(c_{xi},c_{yi})\|\leq\mid r_{L}-b_{\mu}\mid \tag{12}\]  
The following step is to use a non-parametric transform on the input raw image. In the modified algorithm, census transform is employed. It depends on the relative order of the pixel intensities rather than the actual value of an intensity. This property makes it robust to illumination variations in an image. If a reference pixel \(P_{r}(x,y)\) is lying within neighborhood of \(N(P_{r}(x,y))\), where \(P_{r}(x,y)\
otin N(P_{r}(x,y))\), the census transform is formally defined as [39]:  
\[CT\{P_{r}(x,y)\}=\bigotimes\xi(I(P_{r}(x,y)),I(P_{r^{\prime}}(x^{\prime},y^{ \prime}))) \tag{13}\]  
\[\xi(I(P_{r}),I(P_{r^{\prime}}))= \begin{cases}1&\text{if}(I(P_{r})<I(P_{r^{ \prime}}))\\ 0&\text{otherwise}\end{cases}  \tag{14}\]  
Whereby, \(CT\{P_{r}\}\) is the census transformed pixel, \(P_{r^{\prime}}\in N(P_{r})\), \(\xi(I(P_{r}),I(P_{r^{\prime}}))\) is a comparison function and \(\bigotimes\) denotes the bit wise concatenation. Best-match computation (BMC) involves finding the correspondence of valid census transformed reference pixel \(CT\{P_{r}(x,y)\}\) in target micro-images with a minimum error.