Focus stacking and high dynamic range (HDR) imaging are two paradigms of computational photography. Focus
stacking aims to produce an image with greater depth of field (DOF) from a set of images taken with different focus
distances, whereas HDR imaging aims to produce an image with higher dynamic range from a set of images taken
with different exposure settings. In this paper, we present an algorithm which combines focus stacking and HDR
imaging in order to produce an image with both higher dynamic range and greater DOF than any of the input
images. The proposed algorithm includes two main parts: (i) joint photometric and geometric registration and (ii)
joint focus stacking and HDR image creation. In the first part, images are first photometrically registered using an
algorithm that is insensitive to small geometric variations, and then geometrically registered using an optical flow
algorithm. In the second part, images are merged through weighted averaging, where the weights depend on both
local sharpness and exposure information. We provide experimental results with real data to illustrate the algorithm.
The algorithm is also implemented on a smartphone with Android operating system.