Text this: The development of a predictive autofocus algorithm using a general image formation model