1. A method of generating a focus stack, comprising: receiving initial focus data that identifies a plurality of target depths; positioning a lens at a first position to capture a first image at a first target depth of the plurality of target depths; determining, in response to capturing the first image and prior to capturing additional images, a sharpness metric for the first image; capturing, in response to determining that the sharpness metric for the first image is an unacceptable value, a second image at a second position based on the sharpness metric, wherein the second position is not included in the plurality of target depths; determining that a sharpness metric for the second image is an acceptable value; and generating a focus stack using the second image.