Refocusing Photos using Depth from Defocus

39 10


The process of refocusing images during post-processing is a powerful tool for photography and video. Professional photographers and cinematographers could employ such methods to be able to adjust the focus after capturing the images, yielding greater artistic control in the post-processing stage.

Focus and blur of a scene from a given viewpoint depends on the depth of the scene, and physical camera blur can be reconstructed using convolution with a blur kernel whose size depends on the depth of that pixel[1]. Therefore a depth image of the scene is needed to perform refocusing. The idea of estimating a depth map of the scene using the focus and defocus characteristics of images is called depth from defocus.

This paper will describe a method for refocusing photos taken with a regular camera. By capturing a series of images from the same viewpoint with varying focal depth, a depth metric for the scene can be calculated and used to artificially blur the photo in a realistic way to emulate a new focal depth.

Sample image in test image

Sample image in test image


Refocused image of keyboard

Refocused image of keyboard



[1] Michael Potmesil and Indranil Chakravarty. A lens and aperture camera model for synthetic image generation. SIGGRAPH Comput. Graph., 15(3):297–305, August 1981.

C++ code for merging two separate photos to create a single, multi-person photo

Python code for merging two separate photos to create a single, multi-person photo


There are no reviews yet.

Be the first to review “Refocusing Photos using Depth from Defocus”

Your email address will not be published. Required fields are marked *