ImageFocusCombine
ImageFocusCombine[{image1, image2, ...}] combines differently focused images of the same scene to obtain a single well-focused image.
Examples
Combine focus-stacked images:
images = {nearFocus, midFocus, farFocus};
ImageFocusCombine[images]Focus stacking for macro photography:
ImageFocusCombine[Import /@ FileNames["focus*.jpg"]]Please visit the official Wolfram Language Reference for more details.