FACE_DETECTION USING PYTHON
import cv2
# python -m pip install --upgrade pip
#load the cascade
face_cascade=cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
#read the input image
img=cv2.imread('Madhurima.jpg')
#convery into grayscale
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GREY)
#detect faces
faces=face_cascade.detectMultiScale(gray,1.1,4)
#draw rectangle around the face
for(x,y,w,h)in faces:
cv2.ectangle(img,(x,y),(x+w,y+h),(255,0,0),0)
#display the output
cv2.imshow('img',img)
cv2.waitKey()
Comments
Post a Comment