Non-frontal illumination of objects may cause specular reflections and strong self-shadowing. Those phenomena change the appearance of objects to such an extent that they may not be recognized properly. We propose a method to automatically discard the areas of the image which are degraded beyond recovery by adverse illumination conditions. The method is based on a comparison between local variances of image gradient and is computationally efficient. We show that proposed method, implemented with a face verification system based on local DCTmod2 features and a GMM classifier, reduces total recognition errors in the presence of changing directional illumination conditions. Consequently, we show that proposed segmentation method can be used as an automatic estimator of mismatch between the illumination conditions present during the acquisition of training and testing images. We propose an adaptive thresholding scheme that uses the mismatch estimate to further reduce the recognition error.