In the visual inspection of industrial products using a microscope with a shallow depth of field, it is difficult to capture an all-in-focus image. This paper presents a method to generate an all-in-focus image from a large focal stack, which can be applied to visual inspection. The proposed method adds two improvements to a deep learning method [M. Maximov et al., CVPR, (2020) 1068] that leverages defocus cues in depth estimation. First, it interpolates an index map (a collection of in-focus image indices at all pixels) after the forward pass. It generates an all-in-focus image using all images in focal stacks while reducing the number of images input to the network. Second, the network is trained with synthetic datasets to which a random texture with high-frequency components is added. It helps the network to learn the degree of defocus blur. Experiments using synthetic images and real microscope images show that interpolating the index map and adding texture improves the accuracy of all-in-focus image generation.
Read full abstract