Skip to content

Instantly share code, notes, and snippets.

View poudyalanil's full-sized avatar
👋
Hey there how you doin?

Anil Poudyal poudyalanil

👋
Hey there how you doin?
View GitHub Profile
# detect faces
face_cordinates = trained_data.detectMultiScale(greyscale_frame)
#x and y is the upper left corner coordinate and w and h are the corresponding width and height of the rectangle
for (x,y,w,h) in face_cordinates:
cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)
# convert to black and white
greyscale_frame = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
while True:
#reading webcam frames
frame_read,frame = webcam.read()
@poudyalanil
poudyalanil / detect1.py
Last active July 18, 2020 11:35
face-detection1
import cv2
#loading pre trained face data from opencv
trained_data = cv2.CascadeClassifier('frontal-face-data.xml')
#grabbing webcam
webcam = cv2.VideoCapture(0)