diff --git a/Image-Processing/Face_detection/Face_detection.py b/Image-Processing/Face_detection/Face_detection.py new file mode 100644 index 00000000..0d9218d6 --- /dev/null +++ b/Image-Processing/Face_detection/Face_detection.py @@ -0,0 +1,19 @@ +import cv2 ##Import OpenCv + +face = cv2.CascadeClassifier('C:/Users/91976/Desktop/haarcascade_frontalface_default.xml') ##'haarcascade_frontalface_default.xml' an opencv classifier for face detection +cap = cv2.VideoCapture(0) ##capturevideo by webcam or your laptop default cam for webcame => 1 and for defalut laptop camera => 2 + +while True: + sucess , img = cap.read() + gray = cv2.cvtColor( img , cv2.COLOR_BGR2GRAY ) ##before detecting face you should convert img or video into gray image + faces = face.detectMultiScale( gray ,1.1 ,5 ) + + for ( x , y , w , h) in faces: + cv2.rectangle(img,( x , y ),( x*w , y*h ),(255,0,0),2) ##will create the rectangle where face is detected + + cv2.imshow('img',img) + k = cv2.waitKey(30) & 0xff + if k == 27: + break + +cap.release() diff --git a/Image-Processing/Face_detection/README.md b/Image-Processing/Face_detection/README.md new file mode 100644 index 00000000..48f7eb5a --- /dev/null +++ b/Image-Processing/Face_detection/README.md @@ -0,0 +1,20 @@ +# Image Processing + +Image Processing is most commonly termed as 'Digital Image Processing' and the domain in which it is frequently used is 'Computer Vision'. +Don't be confused - we are going to talk about both of these terms and how they connect. +Both Image Processing algorithms and Computer Vision (CV) algorithms take an image as input; however, in image processing, +the output is also an image, whereas in computer vision the output can be some features/information about the image. + +## OpenCV + +![](https://logodix.com/logo/1989939.png) + +## Installation + +### Windows + + $ pip install opencv-python +### MacOS + $ brew install opencv3 --with-contrib --with-python3 +### Linux + $ sudo apt-get install libopencv-dev python-opencv