1. A method for real-time wavefront sensing of an optical system comprising the following steps: (a) acquiring a first centroid image and determining the positions of the centroids in said first centroid image using a first centroid determining algorithm; (b) acquiring a next centroid image and determining the positions of the centroids in the next centroid image using a second centroid determining algorithm, wherein said second centroid determining algorithm determines the position of each centroid with reference to the position of the respective centroid in the first centroid image, wherein the second centroid determining algorithm is an algorithm faster than the first centroid determining algorithm.