summaryrefslogtreecommitdiff
path: root/face-detection/faceDetection.py
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-03-18 00:54:40 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-03-18 00:54:40 +0530
commit58e7026a200249ba8f13fc174414bcae7791b17a (patch)
tree27f26a3b3ca64196c2dcac54afb28b170d33ac6f /face-detection/faceDetection.py
parent275edecf5f32dfdeaae4e7a056f192319475368e (diff)
Adding haarcascader xml file + prelimfaceDetection script(same as camtest)
Diffstat (limited to 'face-detection/faceDetection.py')
-rw-r--r--face-detection/faceDetection.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/face-detection/faceDetection.py b/face-detection/faceDetection.py
new file mode 100644
index 0000000..e8f3414
--- /dev/null
+++ b/face-detection/faceDetection.py
@@ -0,0 +1,18 @@
+import numpy as np
+import cv2
+cap = cv2.VideoCapture(0)
+cap.set(3,640) # set Width
+cap.set(4,480) # set Height
+while(True):
+ ret, frame = cap.read()
+ #frame = cv2.flip(frame, -1) # Flip camera vertically
+ gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
+
+ cv2.imshow('frame', frame)
+ cv2.imshow('gray', gray)
+
+ k = cv2.waitKey(30) & 0xff
+ if k == 27: # press 'ESC' to quit
+ break
+cap.release()
+cv2.destroyAllWindows()