Quite surprising the focus of an image is a subjective measure.
What is focused for one person is still blurred for another.
Eyesight is a topic and Illumination plays an important role too.
But even software is a subjective thing. One algorithm may just be good enough to detect a slightly blurred edge while the other algorithm just can’t.
A certain measure of focus is the local contrast .
The result is a value that leaves the impression of objectivity. But the Threshold for the value above which the image is regarded as focused is to be discussed.
A lot of sudden changes from black to white (a barcode for example) is more focused than a blurry image through a milky glass plate.