Techniques are described for generating an all-in focus image with a capability to refocus. One example includes obtaining a first depth map associated with a plurality of captured images of a scene. The plurality of captured images may include images having different focal lengths. The method further includes obtaining a second depth map associated with the plurality of captured images, generating a composite image showing different portions of the scene in focus (based on the plurality of captured images and the first depth map), and generating a refocused image showing a selected portion of the scene in focus (based on the composite image and the second depth map).