Face image evaluation

I am doing Near Infrared image face detection (video based). But I want to save the detected image with a good quality only; here I think I will focus on sharpness and illumination of the detected face. Any idea on how to this with OpenCV?