Abstract
We present a new depth from defocus method based on the assumption that a per pixel blur estimate (related with the circle of confusion), while ambiguous for a single image, behaves in a consistent way when applied over a focal stack of two or more images. This allows us to fit a simple analytical description of the circle of confusion to the different per pixel measures to obtain approximate depth values up to a scale. Our results are comparable to previous work while offering a faster and flexible pipeline.









Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.References
Bae, S., Durand, F.: Defocus magnification. Comput. Graph. Forum 26(3), 571–579 (2007)
Bauszat, P., Eisemann, M., Magnor, M.: Guided image filtering for interactive high-quality global illumination. Comput. Graph. Forum 30(4), 1361–1368 (2011)
Calderero, F., Caselles, V.: Recovering relative depth from low-level features without explicit t-junction detection and interpretation. Int. J. Comput. Vis. 104, 1–31 (2013)
Cao, Y., Fang, S., Wang, F.: Single image multi-focusing based on local blur estimation. In: Image and graphics (ICIG), 2011 Sixth International Conference on, pp. 168–175 (2011)
Cao, Y., Fang, S., Wang, Z.: Digital multi-focusing from a single photograph taken with an uncalibrated conventional camera. Image Process. IEEE Trans. 22(9), 3703–3714 (2013). doi:10.1109/TIP.2013.2270086
Favaro, P.: Recovering thin structures via nonlocal-means regularization with application to depth from defocus. In: Computer vision and pattern recognition (CVPR), 2010 IEEE Conference on, pp. 1133–1140 (2010)
Favaro, P., Soatto, S.: 3-D Shape Estimation and Image Restoration: Exploiting Defocus and Motion-Blur. Springer-Verlag New York Inc, Secaucus (2006)
Favaro, P., Soatto, S., Burger, M., Osher, S.J.: Shape from defocus via diffusion. Pattern Anal. Mach. Intel. IEEE Trans. 30(3), 518–531 (2008)
Hasinoff, S.W., Kutulakos, K.N.: Confocal stereo. Int. J. Comput. Vis. 81(1), 82–104 (2009)
He, K., Sun, J., Tang, X.: Guided image filtering. In: Proceedings of the 11th European conference on Computer vision: Part I. ECCV’10, pp. 1–14. Springer, Berlin, Heidelberg (2010)
Hecht, E.: Optics, Addison-Wesley world student series, 3rd edn. Addison-Wesley (1997)
Hu, H., De Haan, G.: Adaptive image restoration based on local robust blur estimation. In: Proceedings of the 9th international conference on Advanced concepts for intelligent vision systems. ACIVS’07, pp. 461–472. Springer, Berlin, Heidelberg (2007)
Knutsson, H., Westin, C.F.: Normalized and differential convolution: Methods for interpolation and filtering of incomplete and uncertain data. In: Proceedings of Computer vision and pattern recognition (‘93), pp. 515–523. New York City, USA (1993)
Lee, I.H., Shim, S.O., Choi, T.S.: Improving focus measurement via variable window shape on surface radiance distribution for 3d shape reconstruction. Optics Lasers Eng. 51(5), 520–526 (2013)
Levin, A., Fergus, R., Durand, F., Freeman, W.: Image and depth from a conventional camera with a coded aperture. ACM Transactions on Graphics, SIGGRAPH 2007 Conference Proceedings, San Diego, CA (2007)
Li, C., Su, S., Matsushita, Y., Zhou, K., Lin, S.: Bayesian depth-from-defocus with shading constraints. In: Computer Vision and Pattern Recognition (CVPR), 2013 IEEE Conference on, pp. 217–224 (2013). doi:10.1109/CVPR.2013.35
Lin, X., Suo, J., Wetzstein, G., Dai, Q., Raskar, R.: Coded focal stack photography. In: IEEE International Conference on Computational photography (2013)
Mahmood, M.T., Choi, T.S.: Nonlinear approach for enhancement of image focus volume in shape from focus. Image Process. IEEE Trans. 21(5), 2866–2873 (2012)
Malik, A.: Selection of window size for focus measure processing. In: Imaging systems and techniques (IST), 2010 IEEE International Conference on, pp. 431–435 (2010)
Moreno-Noguer, F., Belhumeur, P.N., Nayar, S.K.: Active refocusing of images and videos. In: ACM SIGGRAPH 2007 papers, SIGGRAPH ‘07. ACM, New York, NY, USA (2007)
Namboodiri, V., Chaudhuri, S.: Recovery of relative depth from a single observation using an uncalibrated (real-aperture) camera. In: Computer vision and pattern recognition, 2008. CVPR 2008. IEEE Conference on, pp. 1–6 (2008)
Nayar, S., Nakagawa, Y.: Shape from focus. Pattern Anal. Mach. Intel. IEEE Trans. 16(8), 824–831 (1994)
Pentland, A.P.: A new sense for depth of field. Pattern Anal. Mach. Intel. IEEE Trans. PAMI 9(4), 523–531 (1987)
Pertuz, S., Puig, D., Garcia, M.A.: Analysis of focus measure operators for shape-from-focus. Pattern Recognit. 46(5), 1415–1432 (2013)
Petschnigg, G., Szeliski, R., Agrawala, M., Cohen, M., Hoppe, H., Toyama, K.: Digital photography with flash and no-flash image pairs. ACM SIGGRAPH 2004 Papers. SIGGRAPH ‘04, pp. 664–672. ACM, New York, NY, USA (2004)
Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P.: Numerical Recipes: The Art of Scientific Computing, 3rd edn. Cambridge University Press (2007)
Shim, S.O., Choi, T.S.: A fast and robust depth estimation method for 3d cameras. In: Consumer Electronics (ICCE), 2012 IEEE International Conference on, pp. 321–322 (2012)
Subbarao, M., Choi, T.: Accurate recovery of three-dimensional shape from image focus. Pattern Anal. Mach. Intel. IEEE Trans. 17(3), 266–274 (1995)
Vaquero, D., Gelfand, N., Tico, M., Pulli, K., Turk, M.: Generalized autofocus. In: IEEE Workshop on Applications of Computer Vision (WACV’11). Kona, Hawaii (2011)
Watanabe, M., Nayar, S.: Rational filters for passive depth from defocus. Int. J. Comput. Vis. 27(3), 203–225 (1998)
Zhao, Q., Tan, P., Dai, Q., Shen, L., Wu, E., Lin, S.: A closed-form solution to retinex with nonlocal texture constraints. Pattern Anal. Mach. Intel. IEEE Trans. 34(7), 1437–1444 (2012)
Zhou, C., Cossairt, O., Nayar, S.: Depth from diffusion. In: IEEE Conference on Computer vision and pattern recognition (CVPR) (2010)
Zhuo, S., Sim, T.: On the recovery of depth from a single defocused image. In: X. Jiang, N. Petkov (eds.) Computer Analysis of Images and Patterns, Lecture Notes in Computer Science, vol. 5702, pp. 889–897. Springer, Berlin Heidelberg (2009). doi:10.1007/978-3-642-03767-2_108.
Zhuo, S., Sim, T.: Defocus map estimation from a single image. Pattern Recognit. 44(9), 1852–1858 (2011)
Acknowledgments
The authors thank T. S. Choi and Paolo Favaro for sharing their data sets. This work has been supported by the European Union through the projects GOLEM (grant agreement no.: 251415) and VERVE (grant agreement no.: 288914), as well as by the Gobierno de Aragon through the TAMA project. This material is based upon work supported by the National Science Foundation under Grant Nos. 0705863 and 1116988.
Author information
Authors and Affiliations
Corresponding author
Appendix A: Least squares function analysis
Appendix A: Least squares function analysis
In this appendix, we show how to cast the depth estimation problem as an optimization problem. Consider the optimization problem for a single signal with \(n\) blur estimates, and each \(c_i\) is captured with a focal position \(S_1^i\). Let
The function \(g_i(x)\) has a critical point at \(S_1^i\) because the derivative at \(S_1^i\) of \(g_i(x)\) does not exist due to the term \(|x-S_1^i|\) in the function. Furthermore, if the blur estimate \(c_i\) is less than the circle of confusion size
for a depth \(x\) at infinity, then the function will have two local minimizers, as shown in Fig. 10, at the points \(g(x)=0\) where
and
However, if \(c_i=0\) then the function will have one minimizer at \(x=S_1^i\), and similarly if \(x\) is larger than the circle of confusion size for a depth at infinity, then \(g_i(x)\) will have only one minimizer somewhere within the interval \((0,S_1^i)\).
For the purposes of optimization, we assume that
This assumption introduces the restriction that the depth of a signal in the focal stack cannot be too close to the lens.
A further restriction for the depth \(x\) is that \(S_1^1<x<S_1^n\) where \(0<S_1^1<S_1^2<\cdots <S_1^n\). This restriction limits the depth of any point in the focal stack to be between the closest focal position of the lens and the farthest focal position.
With these assumptions, we can now look at the least squares optimization equation
Because each \(g_i'(x)\) is undefined at \(x=S_1^i\) for all \(i=1,\ldots ,n\), the function \(z(x)\) has critical points at \(S_1^1,\ldots ,S_1^n\). Furthermore, \(z(x)\) is continuous everywhere else for \(x>0\) because the functions \(g_i(x)\) are continuous where \(x>0\) and \(x \ne S_1^i\). Because \(g_i(x)\) has a local maximizer at \(S_1^i\), this point may be a local maximizer for \(z(x)\). This gives us \(n-1\) intervals on which \(z(x)\) is continuous for \(S_1^1<x<S_1^n\), and these intervals are \((S_1^1,S_1^2),(S_1^2,S_1^3),\ldots ,(S_1^{n-1},S_1^n)\). These open intervals may or may not contain a local minimizer, and if an interval does contain a local minimizer, it might be the global minimizer of \(z(x)\) on the interval \((S_1^1,S_1^n)\).
Under certain conditions, \(z(x)\) is convex within the interval \((S_1^1,S_1^{i+1})\) for all \(i=1,\ldots ,n-1\). Note that \(g_j(x)\) is convex within the open interval for all \(j=1,\ldots ,n\). To see this, assume that Eq. 11 holds and that the focus position of the lens is always greater than the focal length \(f\) of the lens so that \(r>0\). We also assume that
If \(x<S_1^j\) then the absolute value term \(|x-S_1^j|\) in \(g_i(x)\) becomes \(-x+S_1^j\). From this, we know that
from Relation 11 and because \(x\) and \(S_1^j\) are positive. Rearranging the relation, we get
Since \(x<S_1^j\), \(2rx<2rS_1^j\) and \(2rS_1^j-2rx>0\). Therefore,
Furthermore, since \(x>0\), \(r>0\), and \(S_1^j>0\), we know that
Therefore, we know that
for \(0<x<S_1^j\).
If \(x>S_1^j\), then
from Eq. 19 and that \(x<S_1^n\). Since \(c_j>0\), we can multiply the relation by \(2c_j\) to get
From relation (11), we can say that
Therefore,
Distributing \(x\) in the above relation, we get
Rearranging the terms, we get
Multiplying by the left-hand side of (23), we get
for \(S_1^j < x < S_1^n\).
As shown above, the second derivative of \(g_j(x)\) is always positive on the interval \((S_1^1,S_1^n)\) except at the point \(S_1^j\) for all \(j=1,\ldots ,n\). Since \(z(x)\) is the summation of all \(g_j(x)\), \(z(x)\) is also convex on the interval except at the points \(S_1^1,S_1^2,\ldots ,S_1^n\). Therefore, \(z(x)\) is convex in the intervals \((S_1^i, S_1^{i+1})\) for all \(i=1,2,\ldots ,n-1\). As a consequence, if \(S_1^i\), and \(S_1^{i+1}\) are local maximizers, then there is some local minimizer within the open interval \((S_1^1,S_1^n)\). From this, a global minimizer can be identified which gives the best depth estimate for the given signal on the interval \((S_1^1,S_1^n)\). Figure 11 shows an example of \(z(x)\) with the local maximizers and minimizers.
Plot of \(z(x)\) shown in show dark blue with \(g_1(x)\), \(g_2(x)\), and \(g_3(x)\) shown in red, light blue, and green, respectively. This shows \(z(x)\) with local maximizers at \(S_1^1=0.75\), \(S_1^2=1\), and \(S_1^3=1.5\) and local minimizers in the intervals \((S_1^1, S_1^2)\) and \((S_1^2,S_1^3)\)
Rights and permissions
About this article
Cite this article
Bailey, S.W., Echevarria, J.I., Bodenheimer, B. et al. Fast depth from defocus from focal stacks. Vis Comput 31, 1697–1708 (2015). https://doi.org/10.1007/s00371-014-1050-2
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00371-014-1050-2