When a 3D specimen is inspected using a microscope, the distance between stage and lens is varied. Images are taken at several distances. For each distance some image areas are in focus, some are not.
Are there any standard algorithms for finding focused areas or standard formulas for focus evaluation? Are there Matlab scripts for detecting focused areas?