face detection face detection is one of the fascinating applications of computer vision which makes it more realistic as well as futuristic opencv has built-in facility to perform face detection we are going to use the haar cascade classifier for face detection haar cascade data we need data to use the haar cascade classifier you can find this data in our opencv package after installing opencvyou can see the folder name haarcascades there would be xml files for different application nowcopy all of them for different use and paste then in new folder under the current project example the following is the python code using haar cascade to detect the face of amitabh bachan shown in the following imageimport the opencv package as shownimport cv import numpy as np nowuse the haarcascadeclassifier for detecting faceface_detection cv cascadeclassifier(' :/programdata/cascadeclassifier/haarcascade_frontalface _default xml'nowfor reading particular imageuse the imread(functionimg cv imread('ab jpg'nowconvert it into grayscale because it would accept gray imagesgray cv cvtcolor(imgcv color_bgr gray