This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert to black and white | |
greyscale_frame = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
#reading webcam frames | |
frame_read,frame = webcam.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
#loading pre trained face data from opencv | |
trained_data = cv2.CascadeClassifier('frontal-face-data.xml') | |
#grabbing webcam | |
webcam = cv2.VideoCapture(0) |
NewerOlder