A deflectometric method for the characterization of optical systems is presented. It is based on the use of a CCD camera and a subpixel resolution algorithm for the measurement of the deflection of a laser beam that propagates through the system. To obtain accurate results, three different algorithms for measuring the position of the deflected beam are tested and compared. Based on this comparison, an algorithm based on the calculation of the phase of the fast Fourier transform (FFT) is selected, and an accuracy of 0.024 pixels is obtained on the determination of the beam position in our setup. Using an XY scanning stage, the proposed method is completely automated and applied for the characterization of ophthalmic lenses. In this application, the gradients of the wavefront refracted by the lens are measured directly, and from them, the thickness and the local power of the lens are computed.