ImageFocusCombine

ImageFocusCombine[{image1,image2,}]

combines differently focused images imagei of the same scene to obtain a single well-focused image.

Details and Options

  • ImageFocusCombine is also known as focus stacking or Z-stacking. It is typically used for combining multiple images of the same scene taken at different focus distances and creates an image with a higher depth of field (DOF).
  • ImageFocusCombine assumes all imagei are aligned.
  • ImageFocusCombine takes a PerformanceGoal option. Possible settings include:
  • "Quality"optimize for quality of final results
    "Speed"optimize for speed of getting results

Examples

open allclose all

Basic Examples  (1)

Combine images of a scene with two different regions in focus:

Scope  (1)

Combine a stack of images with different focal planes:

Options  (2)

PerformanceGoal  (2)

Use PerformanceGoal->"Quality" to emphasize quality of the result:

Use PerformanceGoal->"Speed" to emphasize speed of computation:

Applications  (1)

Inverse tilt-shift effect on three images with three different regions in focus:

Compare with the starting image:

Properties & Relations  (1)

Areas in focus are defined by the location of high frequencies in the image:

Combine the image with a high-frequency, rich, random image:

Combine the image with a lowpass-filtered, random image:

Possible Issues  (2)

ImageFocusCombine does not correct for misalignment:

Use ImageAlign to align the images before combining them:

In some cases the misalignment is too large and cannot be corrected automatically:

This usually results in a ghosting effect:

Manually remove the most misaligned images from the stack to mitigate the ghosting effect:

Wolfram Research (2015), ImageFocusCombine, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageFocusCombine.html.

Text

Wolfram Research (2015), ImageFocusCombine, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageFocusCombine.html.

CMS

Wolfram Language. 2015. "ImageFocusCombine." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageFocusCombine.html.

APA

Wolfram Language. (2015). ImageFocusCombine. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageFocusCombine.html

BibTeX

@misc{reference.wolfram_2024_imagefocuscombine, author="Wolfram Research", title="{ImageFocusCombine}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/ImageFocusCombine.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagefocuscombine, organization={Wolfram Research}, title={ImageFocusCombine}, year={2015}, url={https://reference.wolfram.com/language/ref/ImageFocusCombine.html}, note=[Accessed: 21-November-2024 ]}