In a wavefront sensing system, the raw data for surface reconstruction, either the slope matrix or curvature matrix, is obtained through centroiding on the focal spot images. Centroiding is to calculate the first moment within a certain area of interest, which encloses the focal spot. As the distribution of focal spots is correlated to the surface sampling condition, while a uniform rectangular grid is good enough to register all the focal spots of a uniformly sampled near flat surface, the focal spots of aspherical or freeform surfaces have varying shapes and sizes depending on the surface geometry. In this case, the normal registration method is not applicable. This paper proposed a dynamic focal spots registration algorithm to automatically analyze the image, identify and register every focal spot for centroiding at one go. Through experiment on a freeform surface with polynomial coefficients up to 10 th order, the feasibility and effectiveness of the proposed algorithm is proved