Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit c9fdb88

Browse files
authored
Merge pull request #209 from ryuk156/FACE_DETECTION_1
Face detection Open cv
2 parents 3304a0b + fac39eb commit c9fdb88

File tree

2 files changed

+39
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)