Skip to main content
Log in

An autofocus heuristic for digital cameras based on supervised machine learning

  • Published:
Journal of Heuristics Aims and scope Submit manuscript

Abstract

Digital cameras are equipped with passive autofocus mechanisms where a lens is focused using only the camera’s optical system and an algorithm for controlling the lens. The speed and accuracy of the autofocus algorithm are crucial to user satisfaction. In this paper, we address the problems of identifying the global optimum and significant local optima (or peaks) when focusing an image. We show that supervised machine learning techniques can be used to construct a passive autofocus heuristic for these problems that out-performs an existing hand-crafted heuristic and other baseline methods. In our approach, training and test data were produced using an offline simulation on a suite of 25 benchmarks and correctly labeled in a semi-automated manner. A decision tree learning algorithm was then used to induce an autofocus heuristic from the data. The automatically constructed machine-learning-based (ml-based) heuristic was compared against a previously proposed hand-crafted heuristic for autofocusing and other baseline methods. In our experiments, the ml-based heuristic had improved speed—reducing the number of iterations needed to focus by 37.9 % on average in common photography settings and 22.9 % on average in a more difficult focus stacking setting—while maintaining accuracy.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3

Similar content being viewed by others

Notes

  1. The software and data are available at: https://cs.uwaterloo.ca/~vanbeek/research.

References

  • Alpaydin, E.: Introduction to Machine Learning, 2nd edn. MIT, Cambridge (2010)

    MATH  Google Scholar 

  • Chen, C., Hong, C., Chuang, H.: Efficient auto-focus algorithm utilizing discrete difference equation prediction model for digital still cameras. IEEE Trans. Consum. Electron. 52, 1135–1143 (2006)

    Article  Google Scholar 

  • Chen, C.Y., Hwang, R.C., Chen, Y.J.: A passive auto-focus camera control system. Appl. Soft Comput. 10, 296–303 (2010)

    Article  Google Scholar 

  • Cicala, R.: Autofocus reality. http://www.lensrentals.com/blog/2012/07 (2012). Accessed April 5, 2014

  • Gamadia, M., Kehtarnavaz, N.: Real-time implementation of single-shot passive auto focus on DM350 digital camera processor. In: Real-Time Image and Video Processing (SPIE), vol. 7244 (2009)

  • Groen, F., Young, I., Ligthart, G.: A comparison of different focus functions for use in autofocus algorithms. Cytometry 6, 81–91 (1985)

    Article  Google Scholar 

  • Guyon, I., Elisseeff, A.: An introduction to variable and feature selection. J. Mach. Learn. Res. 3, 1157–1182 (2003)

    MATH  Google Scholar 

  • Hall, M., Frank, E., Holmes, G., Pfahringer, B., Reutemann, P., Witten, I.H.: The WEKA data mining software: an update. SIGKDD Explor. 11, 10–18 (2009)

    Article  Google Scholar 

  • Han, J.W., Kim, J.H., Lee, H.T., Ko, S.J.: A novel training based auto-focus for mobile-phone cameras. IEEE Trans. Consum. Electron. 57, 232–238 (2011)

    Article  Google Scholar 

  • Hastie, T., Tibshirani, R., Friedman, J.: The Elements of Statistical Learning: Data Mining, Inference and Prediction, 2nd edn. Springer, Berlin (2009)

    Book  Google Scholar 

  • He, J., Zhou, R., Hong, Z.: Modified fast climbing search auto-focus algorithm with adaptive step size searching technique for digital camera. IEEE Trans. Consum. Electron. 49, 257–262 (2003)

    Article  Google Scholar 

  • Japkowicz, N., Shah, M.: Evaluating Learning Algorithms: A Classification Perspective. Cambridge University Press, Cambridge (2011)

    Book  Google Scholar 

  • Kehtarnavaz, N., Oh, H.J.: Development and real-time implementation of a rule-based auto-focus algorithm. Real Time Imaging 9, 197–203 (2003)

    Article  Google Scholar 

  • Kiefer, J.: Sequential minimax search for a maximum. Proceedings of American Mathematical Society Fibonacci algorithm; see also Donald E. Knuth, The Art of Computer Programming, 2nd edn, vol. 3, p. 418 (1953)

  • Lee, S.Y., Kumar, Y., Cho, J.M., Lee, S.W., Kim, S.W.: Enhanced autofocus algorithm using robust focus measure and fuzzy reasoning. IEEE Trans. Circuits Syst. Video Technol. 18, 1237–1246 (2008)

    Article  Google Scholar 

  • Li, J.: Autofocus searching algorithm considering human visual system limitations. Opt. Eng. 44(113), 201–204 (2005)

    Google Scholar 

  • Mir, H., Xu, P., van Beek, P.: An extensive empirical evaluation of focus measures for digital photography. In: Proceedings of SPIE 9023, Digital Photography X (2014)

  • Morgan-Mar, D., Arnison, M.R.: Focus finding using scale invariant patterns. In: Proceedings of SPIE 8660, Digital Photography IX (2013)

  • Peddigari, V., Gamadia, M., Kehtarnavaz, N.: Real-time implementation issues in passive automatic focusing for digital still cameras. J. Imaging Sci. Technol. 49(2), 114–123 (2005)

    Google Scholar 

  • Quinlan, J.R.: C4.5: Programs for Machine Learning. Morgan Kaufmann, San Fransico (1993)

    Google Scholar 

  • Rahman, M., Kehtarnavaz, N.: Real-time face-priority auto focus for digital and cell-phone cameras. IEEE Trans. Consum. Electron. 54, 1506–1513 (2008)

    Article  Google Scholar 

  • Santos, A., Ortiz de Solórzano, C., Vaquero, J.J., Peña, J.M., Malpica, N., del Pozo, F.: Evaluation of autofocus functions in molecular cytogenetic analysis. J. Microsc. 188, 264–272 (1997)

    Article  Google Scholar 

  • Subbarao, M., Tyan, J.K.: Selecting the optimal focus measure for autofocusing and depth-from-focus. IEEE Trans. Pattern Anal. Mach. Intell. 20, 864–870 (1998)

    Article  Google Scholar 

  • Van Hulse, J., Khoshgoftaar, T.M., Napolitano, A.: Experimental perspectives on learning from imbalanced data. In: Proceedings of the 24th International Conference on Machine Learning, pp. 935–942 (2007)

  • Vaquero, D., Gelfand, N., Tico, M., Pulli, K., Turk, M.: Generalized autofocus. In: IEEE Workshop on Applications of Computer Vision (2011)

  • Witten, I.H., Frank, E.: Data Mining. Morgan Kaufmann, San Francisco (2000)

    Google Scholar 

  • Zografos, V., Lenz, R., Felsberg, M.: The Weibull manifold in low-level image processing: an application to automatic image focusing. Image Vis. Comput. 31, 401–417 (2013)

    Article  Google Scholar 

Download references

Acknowledgments

This work was supported in part by a University of Waterloo President’s Scholarship of Distinction, an NSERC USRA award, and an NSERC Discovery Grant.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Peter van Beek.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Mir, H., Xu, P., Chen, R. et al. An autofocus heuristic for digital cameras based on supervised machine learning . J Heuristics 21, 599–616 (2015). https://doi.org/10.1007/s10732-015-9291-4

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10732-015-9291-4

Keywords

Navigation