Algorithm Determines Focus Error in Eyes and Cameras