The cascade Haar classifier is used to detect faces in an image. Please make sure that you have the OpenCV library for Java installed and the file is downloaded. haarcascade_frontalface_default.xml , which contains a trained model for face recognition.