Due to the affect of illumination conditions when taking face image, the traditional algorithm effect of face recognition in practice is unsatisfied. Thus, in order to reduce the affect of illumination conditions, the pretreatment of illumination compensation to face image is needed. The common illumination compensation algorithms have two kinds: linear compensation and nonlinear compensation, such as histogram equalization method, log algorithm, and so on, but those algorithms only perform localized enhancement for image and they cannot really reflect the original image. In this paper, a kind of illumination compensation algorithm based on color constant theory is put forward. An image is mainly made of reflection image and incident image convolution. With color constancy, the incident image is not subject to the influence of illumination conditions and reflection image weakens image effect. Thus, if the incident image is found, the image is enhanced. Firstly, the acquisition method of incident image is analyzed. By the decomposition of Gaussian function, the incident image can be obtained, which provides a theoretical basis for the obtainment of incident image. Then, the expression of Retinex is analyzed. Secondly, we analyze the algorithm based on Retinex. In the horizontal direction and vertical direction of image, compensation is performed and the image after compensation is expanded, so that the compensation image is obtained. Lastly, the illumination compensation results of face image by face image database CMU are given. Compared with the original image, the results show that there is obvious enhancement effect. The recognition rate of face image in complex illumination conditions is improved.