Shape from focus

Shape from focus or shape from defocus is a method of 3D reconstruction which consists of the use of information about the focus of an optical system to provide a means of measurement for 3D information. One of the simplest forms of this method can be found in most autofocus cameras today. In its most simple form, the methods analyze an image based upon overall contrast from a histogram, the width of edges, or more commonly, the frequency spectrum derived from a fast Fourier transform of the image. That information might be used to drive a servo mechanism in the lens, focusing it until the quantity measured on one of the earlier parameters is optimized.