We propose the use of the Mach Bands (MB) appearing as a visual effect in t
he neighborhood of intensity variations as a tool to assess defocusing. A m
odified version of the Cornsweet and Yellott constant volume summation mode
l is implemented to measure the area under MB's to provide a criterion for
the choice of best focus position in sets of images with variable defocusin
g. The method is non linear and adaptive to noise. It was tested in numeric
al simulations, in actual images of a plane object and in 3D scenes using s
tructured illumination.