Skip to content

Instantly share code, notes, and snippets.

@Praveen76
Created April 16, 2022 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Praveen76/03b706e0a343fd53a3b3094e6f500763 to your computer and use it in GitHub Desktop.
Save Praveen76/03b706e0a343fd53a3b3094e6f500763 to your computer and use it in GitHub Desktop.
haar_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
faces_rect=haar_cascade.detectMultiScale(grayscale,scaleFactor=1.1,minNeighbours=3,minSize=(30,30))
print('Number of images found :', len(faces_rect))
for (x,y,w,h) in faces_rect:
cv.rectangle(img,(x,y),(x+w,y+h),(0,255,0),thickness=1)
cv.imshow('detected faces',img)
cv.imwrite('DetectedFaces.jpg',img)
cv.waitKey()
cv.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment