Size and shape of dispersed objects defines properties of suspensions, emulsions, and foams, such as stability, texture, and flow. Accordingly, a rational product design requires reliable size distribution analysis. This is particularly challenging in dense foams. An endoscopic setup was optimized for bubble imaging minimizing light reflections, uneven illumination, and foam distortion. A software tool was developed detecting large quantities of foam bubbles at dispersed phase fractions up to 93 % from images with spatially varying contrast within minutes based on the template matching algorithm. Reliability of the method is also illustrated for a bimodal glass bead mixture, anisotropic nanocrystals, and emulsion droplets during freezing.