How this AI Learned to Refocus Any Photo

· Source: Jia-Bin Huang · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Computer Vision · Depth: Intermediate, long

Summary

AI Refocusing enables post-capture manipulation of photographic focus, allowing users to add or remove defocus blur, or shift focus to different subjects within a single image. The underlying technology builds upon traditional camera optics, explaining concepts like pinhole cameras, lenses, Gaussian lens formula, and the circle of confusion. The system trains two AI models: one to predict an all-in-focus image from a single-size defocused input, and another to generate desired defocus blur from an all-in-focus image and a target defocus map. This second model is fine-tuned using a pre-trained text-to-image model and real-world defocused images to ensure realistic blur effects. Applications include adjusting aperture size, changing the focus plane in group photos, sharpening small subjects, and even altering aperture shape for creative bokeh effects, offering significant creative freedom compared to traditional photography.

Key takeaway

For AI Engineers developing image manipulation tools, this refocusing model offers a robust approach to post-capture focus adjustment. You should consider integrating depth map estimation and a two-model architecture, leveraging pre-trained generative models for realistic blur synthesis. This can significantly enhance creative control in photographic applications, allowing users to correct focus errors or achieve artistic effects that were previously only possible during capture.

Key insights

AI refocusing allows dynamic post-capture adjustment of photographic focus and depth of field from a single image.

Principles

Method

The method involves estimating depth and defocus maps from an input image, then training two models: one to deblur to an all-in-focus image, and another to apply desired defocus blur using a pre-trained text-to-image model.

In practice

Topics

Best for: AI Engineer, Machine Learning Engineer, AI Student

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Jia-Bin Huang.