Acquiring depth information or 3D shape of a scene is an essential task for many computer vision applications such as synthetic focus, autonomous navigation, action recognition, 3DTV and augmented or virtual reality (AR/VR). Shape from focus (SFF) is a monocular technique that employs the image focus as a cue to recover the 3D shape.
SFF can be computed in a number of steps. In the first step, a number of images for the object or scene are captured by gradually varying the focus settings of the camera. At the second step of SFF, the focus quality of each pixel in the image sequence is estimated. For this, an appropriate operator (named as focus measure (FM)) is applied on each pixel in the image sequence. The erroneous focus volume is enhanced in the third step. at the fourth step, an initial map is computed by maximizing the focus measure along z-direction. Finally, initial depth is further improved through machine learning and/or approximation methods.
Guided Image Filtering in Shape from Focus: A Comparative Analysis, Pattern Analysis 2021 [Demo Code]