Shack-Hartmann wavefront sensing is the most widely used technique for the measurement of wavefront distortion in adaptive optics (AO). Assembly errors decrease the accuracy of the Shack-Hartmann wavefront sensor and degrade the quality of the AO system. The slant correction method based on principal component analysis (PCA), which has its origin in the digital graphic discipline, is introduced in an AO system. The slant correction method based on PCA and the results of this method for adaptive optics system are investigated experimentally. The experiment results show that the AO system becomes less sensitive to noise, and no high assembly precision is required with the slant correction based on PCA.