An autofocus system includes an imaging device, a lens system and a focus control actuator that is configured to change a focus position of the imaging device in relation to a stage. The electronic control unit is configured to control the focus control actuator to a plurality of predetermined focus positions, and activate the imaging device to obtain an image at predetermined positions and then apply a spatial filter to the obtained images. This generates a filtered image for the obtained images. The control unit determines a focus score for the filtered images such that the focus score corresponds to a degree of focus in the obtained images. The control unit identifies a best focus position by comparing the focus score of the filtered images, and controls the focus control actuator to the best focus position corresponding to the highest focus score.
STATEMENT REGARDING FEDERAL RIGHTS
 This invention was made with government support under Contract No. DE-AC52-06NA25946 and was awarded by the U.S. Department of Energy, National Nuclear Security Administration. The government has certain rights in the invention.