@@ -0,0 +1,1028 @@
+import cv2%0Aimport sys%0Aimport os%0A%0A%0Aclass FaceRecognition(object):%0A%0A%09def __init__(self, imagePath, cascadePath, scaleFactor, minNeighbors, minSize, flags):%0A%09%09self.imagePath = imagePath%0A%09%09self.cascadePath = cascadePath%0A%09%09self.scaleFactor = scaleFactor%0A%09%09self.minNeighbors = minNeighbors%0A%09%09self.minSize = minSize%0A%09%09self.flags = flags%0A%0A%09def createCascade(self):%0A%09%09return cv2.CascadeClassifier(self.cascadePath)%0A%0A%09def readImage(self):%0A%09%09return cv2.imread(self.imagePath)%0A%0A%09def convertToGrayScale(self):%0A%09%09return cv2.cvtColor(self.readImage(), cv2.COLOR_BGR2GRAY)%0A%0A%09def getFaces(self):%0A%09%09return self.createCascade().detectMultiScale(%0A%09%09%09self.convertToGrayScale(),%0A%09%09%09scaleFactor=self.scaleFactor,%0A%09%09%09minNeighbors=self.minNeighbors,%0A%09%09%09minSize=self.minSize,%0A%09%09%09flags=self.flags,%0A%09%09)%0A%0A%09def drawFaceRectangles(self, color, borderWidth):%0A%09%09faces = self.getFaces()%0A%09%09image = self.readImage()%0A%09%09for (x, y, w, h) in faces:%0A%09%09%09cv2.rectangle(image, (x, y), (x+w, y+h), color, borderWidth)%0A%09%09cv2.imshow(%22Resulted image%22, image)%0A%09%09cv2.waitKey(0)%0A

add file that contains the main class