Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml
- #pip install opencv-python
- #py 3.9
- import cv2
- found1= "--"
- found2= "--"
- face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
- image = cv2.imread("notthom.jpg")
- gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
- faces = face_cascade.detectMultiScale(gray_image,1.1, 10)
- for (x, y, width, height) in faces:
- cv2.rectangle(image, (x, y,), (x+width, x+height),(0, 255, 255), 10)
- found1 = "--notthom.jpg--"
- cv2.imshow("Detected Faces", image)
- cv2.waitKey()
- face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
- image = cv2.imread("thom.jpg")
- gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
- faces = face_cascade.detectMultiScale(gray_image,1.1, 10)
- for (x, y, width, height) in faces:
- cv2.rectangle(image, (x, y,), (x+width, x+height),(0, 255, 255), 10)
- found2 = "--thom.jpg--"
- cv2.imshow("Detected Faces", image)
- cv2.waitKey()
- Final = found1 + found2
- print("Pictures with faces =",Final)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement