Corentin Cou
email: corentin.cou@inria.fr

Gaël Guennebaud
email: gael.guennebaud@inria.fr

Depth from Focus using Windowed Linear Least Squares Regressions

Keywords:

We present a novel depth from focus technique. Following prior work, our pipeline starts with a focal stack and an estimation of the amount of defocus as given by, for instance, the Ring Difference Filter. To improve robustness to outliers while avoiding to rely on costly non-linear optimizations, we propose an original scheme that linearly scans the profile over a fixed size window, searching for the best peak within each window using a linearized least-squares Laplace regression. As a post-process, depth estimates with low confidence are reconstructed though an adaptive Moving Least Squares filter. We show how to objectively evaluate the performance of our approach by generating synthetic focal stacks from which the reconstructed depth maps can be compared to ground truth. Our results show that our method achieves higher accuracy than previous non-linear Laplace regression technique, while being orders of magnitude faster.

Introduction

Capturing the 3D structure of real world scenes is a long standing problem in the computer vision and computer graphics community. A wide range of techniques have been proposed so far such as photogrammetry, laser scan or structured lights. When targeting micro-scale reliefs, however, such triangulation based optical systems become impracticable because the depth-of-field decreases quadratically with the field of view. For instance, when targeting a resolution of one pixel per micrometer with a classical digital camera, the typical depth of field will range between 5 and 50 micrometers only.

In this context, depth-from-focus methods become particularly appealing. Those techniques strive to recover 2.5D depth information from a focal stack by estimating, for each pixel, the depth of the focus plane. Most depth from focus methods start by applying a focus measure on the input focal stack, and then estimate the depth by seeking, for each pixel, a robust peak of this focus measure profile along the z direction. Most techniques manage to recover a discrete depth information with reasonably high accuracy, and the relative depth accuracy of the reconstruction is thus expected to increase as the field of view decrease. However, their performance at recovering continuous depth information remains unclear yet.

In this paper we propose a novel peak estimation method that strives to address this shortcoming. This paper makes the following four key contributions:

1. Sliding window. To improve robustness to outliers while avoiding costly non-linear optimizations, we propose an original scheme that linearly scans the profile over a fixed size window, searching for the best peak within each window (Section 4.1). 2. Linear least-Squares Laplace regression. Within each window, we identify the peak by fitting a Laplace distribution over the data. We greatly improve the computation cost by proposing a linearization scheme (Section 4.2). 3. Adaptive smoothing. As a post-process, we present an adaptive and feature preserving smoothing scheme based on a per pixel confidence value and Moving-Least-Squares like regressions (Section 5). 4. Quantitative evaluation. We objectively evaluate the performance of our method by generating synthetic focal stacks from which the reconstructed depth maps can be compared to ground truth (Section 6).

Related Works

Depth from defocus. Exploiting depth of field information to reconstruct depth information was first proposed by Pentland [START_REF] Pentland | Depth of scene from depth of field[END_REF]. Their Depth from defocus methods estimate the depth from the amount of defocus estimated from a pair of images taken at different focal lengths, and many variants of this approach have been proposed so far [START_REF] Kulkarni | Depth estimation from defocused images: A survey[END_REF]. Using a coded aperture, Levin et al. [START_REF] Levin | Image and depth from a conventional camera with a coded aperture[END_REF] even showed how to get rid of the back and front ambiguity when working on a single image. However, since it is extremely difficult to estimate the amount of defocus independently of the texture frequency of the scene itself, those Depth from defocus methods can only recover very coarse depth information that can only be used for simple tasks such as autofocus, foreground/background segmentation and the likes, but unlikely for 3D scanning.

Depth from focal stack. A focal stack is a sequence of images taken for different focal planes. It can be obtained by either moving the camera along a translation unit, or by changing the focal length of the optics. Usually, each point of the scene is in focus in one and only one slice such that an all-in-focus image can be reconstructed by peaking the sharpest pixel along each view direction [START_REF] Pertuz | Generation of all-in-focus images by noise-robust selective fusion of limited depthof-field images[END_REF]. A discrete depth map can be jointly obtained by assigning to each selected pixel the depth of its respective focal plane [START_REF] Grossmann | Depth from focus[END_REF]. Depth from focal stack can be then used alone to determine depth, or in conjunction with Depth from Defocus and other methods [START_REF] Lee | Complex-valued disparity: Unified depth model of depth from stereo, depth from focus, and depth from defocus based on the light field gradient[END_REF].

Focus measure. In such depth from focus approaches, a central ingredient is the so called focus measure, whose goal is to estimate the level of sharpness of every pixel of the stack. Dozens of heuristics have been proposed, either based on differential operators, contrast estimator, or frequency analysis [START_REF] Sun | Autofocusing in computer microscopy: selecting the optimal focus algorithm[END_REF]. According to Pertuz et al [START_REF] Pertuz | Analysis of focus measure operators for shape-fromfocus[END_REF]'s study, Laplacian-based operators turned out to be the best performing. This is confirmed by more recent works improving upon classical Laplacian operators such as the Ring Difference Filter (RDF) [START_REF] Surh | Noise robust depth from focus using a ring difference filter[END_REF]. Other methods tried to learn optimal combinations of different measures [START_REF] Mahmood | Optimal depth estimation by combining focus measures using genetic programming[END_REF][START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF].

Depth estimation. Simply taking the extrema of the focus measure to recover depth information [START_REF] Grossmann | Depth from focus[END_REF] is fast but subject to high noise and limited to discrete depth values. Higher accuracy and robustness is achieved through fitting methods using either local Gaussian [START_REF] Billiot | 3d image acquisition system based on shape from focus technique[END_REF] or global Laplacian [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF] distributions. Some recent work have also experimented with neural networks for this task [START_REF] Hazirbas | Deep depth from focus[END_REF], but they face the hunger for data for the learning stage. Nonetheless, the raw output of such estimators still have to be post-processed to reduce the noise and complete incorrect parts, for instance using cost-aggregation techniques [START_REF] Surh | Noise robust depth from focus using a ring difference filter[END_REF] or cost-volume methods based on a reliability map [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF]. Javidnia et al. [START_REF] Javidnia | Application of preconditioned alternating direction method of multipliers in depth from focal stack[END_REF] globally optimize both the depth and in-focus color of each pixel by minimizing the difference between the input reference stack and a procedurally generated stack from the current depth map.

Overview of the pipeline

As most depth-from-focal-stack methods, our approach relies on the three main steps identified in the previous section: focus measure, peak extraction, and post-processing. Our pipeline is depicted in Figure 1. More precisely, we start from a stack I of n images where each pixel is denoted I k i,j , with i, j the pixel indices within the slice number k ∈ [1, n], each slice corresponding to a focal plane depth z k . We assume that the focal planes are uniformly sampled, with a constant For each pixel, we perform our Peak Estimation procedure (d), yielding a depth map D (e) and a reliability map R (f). Finally, we apply an adaptive MLS filter from these two maps to obtain our final depth map (g) giving a 3D profile (h).

sampling interval δ z = z k+1 -z k . Each slice of the stack are also assumed to be pre-aligned such that for each spatial indices i, j, the 1D profile {I k i,j } k corresponds to the same point of the scene.

Then we apply a Focus-Measure (FM) independently on each pixel of the stack yielding a FM stack F (Fig. 1b). The rest of our pipeline can work with any FM producing sharp profiles resembling to a Laplace distribution (Fig. 1d). This is the case of all Laplacian-like differential operators, including the recent composite FM [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF]. From our experiments, we found the 5 × 5 Ring Difference Filter (RDF) [START_REF] Surh | Noise robust depth from focus using a ring difference filter[END_REF] to be the best performing, especially in areas of low contrast, while being simple and fast. To reduce the sensitivity to spatial noise, we apply a 2D Gaussian filter on each slice of the FM stack, yielding a smoothed version denoted F (Fig. 1c).

The crucial step then consists in extracting from F the depth D i,j of each pixel (i, j). In our approach, this step is carried out independently for each pixel (i, j), so that it boils down to a continuous peak estimation problem from the discrete 1D signal f k = Fk i,j (Fig. 1d). This is the main part of our contribution and it is detailed in Section 4. In addition to the depth map D (Fig. 1e), in this step we jointly compute a reliability map R (Fig. 1f) that is used to drive an adaptive denoising procedure detailed in Section 5 (Fig. 1g).

Peak estimation using Linearized Sliding-window

This section focuses on computing, for each pixel (i, j), its depth value z from its 1D discrete focus measure profile f k . In the following, it is assumed that z can be recovered as the location of the maximum value of some continuous reconstruction f of f k , that is: z = argmax x f (x). Sakurikar et al. [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF] showed that the Laplace distribution

L µ,b (x) = 1 2b e -∥x-µ∥ b (1) b z k n w = 6 µ f k z Fig. 3
Illustration of our sliding window strategy. The FM profile is shown as blue crosses and three position of the window are depicted in yellow, red, and green respectively. The window size nw is constant, and each window starts at a position z k .

was a good proxy model to reconstruct f for a variety of focus measures. They compute the mean µ and average absolute deviation (AAD) b parameters through the global minimization of the following non-linear energy:

E 0 = k (L µ,b (z k ) -f ′ k ) 2 , (2)
where f ′ is the normalized version of the f k so that it integrates to 1. Then, we directly get the sought for depth as z = µ, and the AAD value b, or rather its inverse b -1 , gives us an estimation of its reliability: the finer and higher the peak of the distribution, the sharper and more reliable it is. This non-linear regression procedure exhibits two major issues. First, it involves an iterative and computationally expensive minimization. Second, since the regression is carried out on the whole signal in a simple least-squares sense, it is highly sensitive to outliers and noise far away the expected peak. Here we are referring to outliers and noise that might be produced by the focus measure, and not directly to outliers that would be present in the images themselves. For instance, in the presence of strongly visible bokeh artefacts, the focus measure signal f k might exhibit two peaks leading to an estimated depth located in-between the two peaks.

We alleviate both issues through linearization (Sec. 4.2) and localized regressions (Sec. 4.1) respectively.

Sliding-window estimation

To deal with outliers, we localize the Laplace regression through a basic sliding window strategy described in Algorithm 4.1, and illustrated in Figure 3. The idea is to perform a full peak estimation (e.g., through a Laplace fitting) independently for each sub range {f k , . . . , f k+nw-1 } of the stack, with n w the width of the window. Depth estimations falling outside the current window are rejected, and finally we retain the one associated with the best reliability.

Algorithm 1 Sliding window algorithm r ← 0 ▷ reliability for k ∈ [1, n -n w + 1] do µ, b ← Laplace regression(f [k, k + n w -1]) if b -1 > r and z k < µ < z k + n w δ z then r ← b -1 z ← µ end if end for return z, r

Linearization as a Triangle function

Running a non-linear regression on each subwindow would be prohibitively expensive. To speed up computation, we thus linearize the energy E 0 by taking the logarithm of both the focus measure f and the Laplace distribution. However, doing so directly on the Laplace distribution yields a triangle function of the form: log( 1 2b ) -∥x-µ∥ b , which unfortunately still exhibit a non linear relationship between the slopes and constant terms. To address this issue, we relax the somewhat arbitrary constraint of L being strictly a probabilistic distribution by making its amplitude 1 2b in Eq. 1 a free parameter, say a, yielding a triangle function with three degrees of freedom of the form: log(a) -∥x-µ∥ b . This equation is advantageously rewritten as two piecewise linear functions:

T α,β,γ (x) = α • x + β if x < µ -α • x + γ if x ≥ µ , (3)
where the position µ of the line intersection and AAD parameter of the initial Laplace distribution are recovered by:

µ = γ -β 2α , b = γ + β 2 .
To efficiently deal with the absolute value, or piecewise nature of T , we first enforce the window size n z to be an even number, and then assume that µ is located somewhere in-between the two slices surrounding the window center z c = (z k+nw/2-1 + z k+nw/2 )/2. This way we can partition the current window's samples into two groups,

W 1 = [k, k + n w /2 -1] and W 2 = [k + n w /2, k + n w -1]
, each group being associated to one side of the triangle.

The three parameters α, β, and γ are then easily obtained by minimizing the following quadratic least-squares energy:

E 1 = k∈W1 (αz k + β -log(f k )) 2 (4) + k∈W2 (-αz k + γ -log(f k )) 2 . (5)
Let us emphasize that thanks to the sliding window strategy, our a priori partitioning with respect to the center of the window is not really an issue because all possible locations of this cut will be tested anyways. Nonetheless, nothing in E 1 prevents the two lines to cross at a position µ within the two slices surrounding z c . Whereas this constraint could be achieved through a pair of linear inequalities, this would not be desirable as this would simply snap the eccentric estimations on discrete values. Instead, we rather tighten the acceptance test in Algorithm 4.1 to accept only the candidate µ within the sub range centred on the window and of width 3δ z . We chose an acceptance width of 3δ z to be tolerant to slightly eccentric estimates to prevent the risk of entirely missing a peak.

In the rest of this paper, we will refer to this method as the Triangle method. Let us note that this linearization would not be possible without our sliding window strategy, and inversely, our sliding window strategy would be prohibitively expensive without our linearization.

Post-correction using MLS

From the depth map D and reliability map R, we apply an adaptive low pass filter in order to both denoise the depth map and fix low reliability values from its surrounding. To preserve the depth map features, we designed a filter inspired by the Moving Least Squares filter [START_REF] Bose | Superresolution and noise filtering using moving least squares[END_REF]. For each pixel (i, j), the idea consists in approximating its neighborhood by a bivariate polynomial g, and replace its depth value by the value of g at the pixel location q i,j . We take into account the reliability map R by introducing it as additional weights within the regression. More formally, the polynomial g is obtained as the minimization of the following quadratic energy:

x,y∈Ni,j R x,y θ(∥q-q x,y ∥) g(q x,y ) -D x,y 2 , (6

)
where θ is a compactly supported weighting function of radius h, and N i,j denotes the neighborhood of the pixel (i, j) within a distance h. In our implementation, we used a quadratic polynomials g, and for the weight function θ

(t) = 1 -t 2 h 2 2
which is a classic in the MLS reconstruction literature [START_REF] Ledergerber | Volume MLS ray casting[END_REF], but in our discrete filtering context, any Gaussian-like function would perform equally well. Compared to a simple weighted average, the use of a degree two polynomial allows to much better preserve the features of the data. In the presence of uneven sampling or holes as implied here by the reliability map, such high order polynomials also allow to much better preserve the slopes, whereas a simple weighted average would be strongly biased toward the more reliable and more numerous depth values.

Mean error

Fig. 5 Average absolute error over 20 synthetic stacks as a function of the window size nw.

Experiments and Results

We implemented a prototype of our pipeline within Matlab. For the spatial smoothing pass of the focus measures, we used a Gaussian filter size of 7 pixels, and a MLS filter size of 5 pixels for the post processing pass. The sliding window size n w should be adapted to the ratio between the sampling interval δ z , and the depth-of-focus of the actual setup. For an ideal setup where the twos are roughly equal, we found n w = 6 to be the best performing according to our experiments (see Figure 5). With super-sampling, however, n w should be enlarged accordingly to ensure the window to be large enough to fully contain the typical Laplace-shaped peaks. It might be possible to automatically estimate the ideal window size of a stack by analyzing a few noise-free pixel profiles, but we left this as future work.

Evaluation on synthetic stacks

To objectively evaluate the performance of our different contributions, we procedurally generated image stacks from several reference depth and texture maps. To this end, we implemented a simple splatting approach spreading the contribution of each pixel of the input depth and texture maps to each image of the stack as a Gaussian splat approximating the true Airy disk. The radius of the splat is adjusted with respect to the size c of the circle of confusion computed as:

c = A • ∥S 2 -S 1 ∥ S 2 • f ∥S 1 -f ∥ ,
with A the aperture, f the focal length, S 1 the distance to the focal plane, and S 2 the distance to the current scene point.

With this procedure, we generated 80 stacks from 4 base depth maps, each being perturbed with 5 levels of low frequency noise mimicking surface details. Some combinations are shown in Figure 7, first column. Those 20 depth-maps are then combined with 4 different grey-level textures shown in Figure 6. Each stack is formed by images of 400 × 400 pixels. We compare our Triangle method against two other peak estimations borrowed from the literature. The first one, called Laplace, is the global non-linear regression of a Laplace distribution coming from the the method of Sakurikar et al. [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF] and that we recalled in Section 4. Implementation-wise, we used the lsqnonlin Matlab's function parametrized to use a Levenberg-Marquardt algorithm with low tolerance values (i.e, TolX=TolFun=1e-4) to make the multiple non-linear solves as fast as possible. The second one, called 3 pts, comes from the three-points method of Billiot et al. [START_REF] Billiot | 3d image acquisition system based on shape from focus technique[END_REF]. Their method estimates the depth as the location µ of the peak of a generalized Gaussian a • e -x-µ 2σ whose three parameters are computed such that it passes through the sample having the maximal focus measure, and its two neighbors. Likewise, we compute the reliability as the height of the respective normalized Gaussian. We also added results from the RDF method [START_REF] Surh | Noise robust depth from focus using a ring difference filter[END_REF] using the implementation provided by the authors, and the full pipeline of Sakurikar et al. [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF] which is similar to the "Laplace" pipeline described above but using their composite focus measure and a bilateral filter instead of our MLS pass.

Tables 1, and 2 show global statistics for the 80 stacks of the Mean Absolute Error (MAE) computed against the reference depth maps for each of the three methods. The reported MAE is normalized such that it should be interpreted as if the distance between two focal planes δ z is 1. One can notice that the RDF pipeline produces the worst statistics: this is expected as it produces discrete depth values whereas all others produces continuous ones. Not surprisingly, Sakurikar et al. [START_REF] Sakurikar | Composite focus measure for high quality depth maps[END_REF] pipeline exhibits statistics in par with our Laplace pipeline. Now focusing on our three pipeline variants, we can see that the MLS post-correction step provides an average of a 20% to 30% reduction of the MAE. Its visual effect is depicted in Figure 8. Furthermore, all precision-related indicators lead to the same hierarchy, with the 3-pts method being significantly less accurate than the other two peak-estimators, and our Triangle method being the most accurate. Overall, compared to the non-linear Laplace method, our Triangle method provides a 10% reduction of the MAE while being more than ×60 times faster, and only three times more expensive than the simplest 3-pts method.

Those 10% gains, however, does not tell everything about the quality improvement in general. In Figure 9 we report the repartition of the computed depth values for each of the three methods, assuming δ z = 1. Those histograms reveal a clear bias toward a discrete set of predetermined values corresponding to the discrete input sample depths for the 3-pts method, and their middle for the other twos. Our linearized Triangle method exhibits a much lower bias though. In practice, this bias produces depth maps with plateau-like artefacts that can be observed in the results of before after [START_REF] Pentland | Depth of scene from depth of field[END_REF][START_REF] Pentland | Depth of scene from depth of field[END_REF]. Applying this post-correction to the raw depth outputs (i.e., prior to MLS smoothing) permits to reduce the MAE of the 3 pts and Laplace methods to 0.322 and 0.211 respectively which are both still clearly larger than the MAE of our Triangle method. This post-correction has no effect to our Triangle method as the magnitude of this bias effect is already very low, and lower than the amount of noise.

Depth from focus at micrometer scale

To evaluate our approach in a real-world context, we strived to acquire the relief of prehistoric engraved stones exhibiting groove widths ranging from 50 to 100 µm. The precision of the depthfrom-focus pipeline is greatly influenced by the design of the acquisition setup [START_REF] Blayvas | Role of optics in the accuracy of depth-from-defocus systems[END_REF]. To achieve a ×2 magnification while minimizing the depth of field, we stacked together a 100 mm lens with an inverted 50 mm lense playing the role of a close-up lens. To minimize the depth of field, both lenses are fully opened (respectively 1:2.8 and 1:1.4).

With this setup we found that a step size δ z of 20 µm to be a good tradeoff. Automatic staking is achieved through a motorized rail, while the resulting images are aligned with the Enfuse software prior to depth estimation with our pipeline. Figure 10 shows one result at the crossing of three strokes. Despite the depth of the strokes (about 40 µm) being of same order as the sampling depth δ z , we can clearly see the stroke order.

As we can see in Fig. 5, the engravings are visible and visually separable by their depths. In addition, we notice the different grooves in the same engravings, made by the fact that the tool used has been passed several times. Our method therefore makes it possible to produce a sufficiently robust 3D profile on macroscopic images to observe the details of engravings that are impossible to digitize with a laser scan or by photogrammetry. Other practical results can be found in this paper [START_REF] Cou | Noninvasive on-site method for thickness measurement of transparent ceramic glazes based on depth from focus[END_REF], where our method has been used to accurately measure the absolute thickness of thin glaze of ancient ceramics in a non destructive manner.

Discussions and Conclusion

In this paper we showed how a classical depthfrom-focus reconstruction pipeline can be greatly improved, both in terms of precision, robustness, and computation speed, using a localized and fully linear regression scheme. Our naive Mat-Lab implementation, processing one pixel a time, achieves about 1.5s per image stack, and we believe a compiled and vectorized implementation could cut down the computation time by one or two orders of magnitude. Moreover, as our approach boils down to the regression of simple linear polynomials, it would be interesting to investigate the use of more advanced regression schemes such as total-least-squares and statistically robust methods that might be implemented at a reasonable computation time overhead. One of the main limitation of our pipeline is that the underlying depth map is implicitly assumed to be continuous. A related limitation is that our pipeline processes each pixel independently. As future work, it would thus be interesting to extend our peak estimator with a more global view as well as with some mechanisms to handle discontinuities produced by occlusions.

Fig. 1

 1 Fig. 1 Our depth from focus pipeline. Starting from the acquired focal stack I (a), we compute a Focus Measure map F (b) and a low-pass version F (c) through Gaussian smoothing.For each pixel, we perform our Peak Estimation procedure (d), yielding a depth map D (e) and a reliability map R (f). Finally, we apply an adaptive MLS filter from these two maps to obtain our final depth map (g) giving a 3D profile (h).

Fig. 2

 2 Fig. 2 Demonstration of the importance of the Gaussian filter. Left: curve of FM of one pixel as a function of depth z, on an FM where the Gaussian filter is not applied. Right: curve of FM of the same pixel as a function of depth z, on an FM where the Gaussian filter has a width of 20.

y = αx + β w 1 w 2 yFig. 4

 24 Fig.4Illustration of the Triangle method. In log space, the current window [28, 31] is partitioned within two parts. Each part is approximated by a piece-wise linear function having opposite slopes.

Fig. 6

 6 Fig.6The four textures used to generate our 80 stacks.

Fig. 7

 7 Fig. 7 Qualitative comparison of 3-pts, Laplacian, and Triangle methods on some generated image stacks.

Fig. 8

 8 Fig. 8 Reconstruction of a very smooth initial 3D profile (top-left inset), before and after our MLS adaptive postcorrection.

Figure 7 .

 7 Figure 7. Our Triangle result thus appears significantly less noisy even-though the MAE differs by 10% only with Laplace. From those observations, one might though about correcting this bias by applying to the decimal part of the estimated depths a precomputed transfert function. As show in this figure (right column), this systematic bias is well captured by a cubic polynomial function constrained to pass trough (0, 0) and (1, 1). Applying this post-correction to the raw depth outputs (i.e., prior to MLS smoothing) permits to reduce the MAE of the 3 pts and Laplace methods to 0.322 and 0.211 respectively which are both still clearly larger than the MAE of our Triangle method.This post-correction has no effect to our Triangle method as the magnitude of this bias effect is already very low, and lower than the amount of noise.

Fig. 9

 9 Fig. 9 For each of the three methods, the left histograms show the distributions of the computed depth values for the 80 depth maps D, and the right scatter plots show the ground truth decimal depth values as a function of the decimal of the computed depth values. Those plots also include least-squares cubic approximations of this function (blue curve), and the ideal identity relation in red.

Fig. 10

 10 Fig. 10 Results get on a real-word stack from an engraved stone. Top: 3D profile of the acquired engraving area. Bottom left: blurry image obtained on the image stack. Bottom right: reconstituted clear image of the engraving.

Table 1

 1 Statistics of absolute error prior to MLS post-correction. The 4th to 6th columns report the worst error for the given percentiles.

	Method Mean Std-dev 25% 50% 75% Time
	3 pts	0.360	0.354 0.135 0.288 0.497 0.6s
	Laplace	0.219	0.256 0.075 0.163 0.292 90.1s
	Triangle 0.196	0.257 0.065 0.141 0.259 1.5s

Table 2

 2 Statistics of the absolute error and running time for the full pipelines (i.e., including MLS post-correction).

	Method Mean Std-dev 25% 50% 75% Time
	3 pts	0.237	0.223 0.089 0.189 0.331 17.7s
	Laplace	0.171	0.181 0.060 0.130 0.232 107.2s
	Triangle	0.159	0.184 0.054 0.117 0.213 18.6s
	RDF[9]	0.827	0.921 0.246 0.534 1.067 14.8s
	Comp.[11] 0.236	0.414 0.072 0.157 0.288 94.5s

Declarations

Data availability

The source code of our method and the stacks used to conduct our evaluations and to produce Figure 10 are publicly available on this github repository: https://github.com/corentincou/D epth-f rom-Focus-using-Windowed-Linear-Lea st-Squares-Regressions. The source code used to generate the procedural stacks and to compare the different methods can be obtained from the authors on demand.