"Image Sharpness" which is the clarity of the fine structure in the image can be measured using the image sharpness tool.
As an application, the autofocus technology is realized by measuring image sharpness while scanning the fixed-focus camera focal position. For example, when measuring the tip position of the needle to point toward the camera, the image sharpness value changes with respect to the camera focal position as shown below. There are detected two peaks, and the peak (▼) at the highest position shows needle tip.
We have original technology on image autofocus.
(Patent pending: JP-A-2017-224923)