move dirs

This commit is contained in:
2023-09-26 22:05:13 +03:00
parent 5414fa8538
commit 55d774e7d5
190 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python3
import cv2
def face_detect(capture):
gray_image = cv2.cvtColor(capture, cv2.COLOR_BGR2GRAY)
faces = face_classifier.detectMultiScale(
gray_image, scaleFactor=1.1, minNeighbors=5, minSize=(40, 40)
)
for x, y, w, h in faces:
cv2.rectangle(capture, (x, y), (x + w, y + h), (0, 255, 0), 2)
return faces
if __name__ == '__main__':
camera = cv2.VideoCapture(2)
face_classifier = cv2.CascadeClassifier(
cv2.data.haarcascades + 'haarcascade_frontalface_default.xml'
)
while True:
if cv2.waitKey(1) & 0xFF == ord('q'):
break
result, image = camera.read()
faces = face_detect(image)
cv2.imshow('Face Realtime Detector', image)
camera.release()
cv2.destroyAllWindows()