Autofocusing in microscopy based on the OTF and sampling