Skip to content

Commit

Permalink
face
Browse files Browse the repository at this point in the history
  • Loading branch information
Isoumyajit committed Oct 2, 2020
1 parent 2d34fc1 commit b0fa82b
Show file tree
Hide file tree
Showing 6 changed files with 68,197 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Face and eye Recognition/face_recofnation_first.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Name - Soumyajit Chakraborty
## place - kolkata
## date - 10 / 08 / 2020

import cv2 as cv
face_cascade = cv.CascadeClassifier('..\libs\haarcascade_frontalface_default.xml')
face_cascade_eye = cv.CascadeClassifier('..\libs\haarcascade_eye.xml')
#face_glass = cv.CascadeClassifier('..\libs\haarcascade_eye_tree_eyeglasses.xml')

cap = cv.VideoCapture(0)
while(cap.isOpened()):

falg ,img = cap.read() #start reading the camera output i mean frames
# cap.read() returning a bool value and a frame onject type value

gray = cv.cvtColor(img , cv.COLOR_BGR2GRAY) # converting to grayscale image to perform smoother
faces = face_cascade.detectMultiScale(img , 1.1, 7) #we use detectMultiscale library function to detect the predefined structures of a face
eyes = face_cascade_eye.detectMultiScale(img , 1.1 , 7)
# using for loops we are trying to read each and every frame and map
for(x , y ,w ,h ) in faces:
cv.rectangle(img , (x , y) , (x+w , y+h) , (0 , 255 , 0) , 1)

for(a , b , c , d) in eyes:
cv.rectangle(img, (a , b), (a+c, b+d), (255, 0, 0), 1)

cv.imshow('img' , img )
c = cv.waitKey(1)
if c == ord('q'):
break

cv.release()
cv.destroyAllWindows()


17 changes: 17 additions & 0 deletions Face and eye Recognition/gesture_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import cv2 as cv
import numpy as np

img = cv.imread('..\img\hand1.jpg' , 0)
flag,frame = cv.threshold(img , 70 , 255 , cv.THRESH_BINARY)

contor,_ = cv.findContours(frame.copy(),cv.RETR_TREE,cv.CHAIN_APPROX_SIMPLE)

hull = [cv.convexHull(c) for c in contor]

final = cv.drawContours(img , hull , -1 , (0 , 0 , 0) )
cv.imshow('original_image' , img)
cv.imshow('thres' , frame)
cv.imshow('final_hsv' , final)

cv.waitKey(0)
cv.destroyAllWindows()
Binary file added img/hand1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b0fa82b

Please sign in to comment.