Skip to content

fixing baseException and reformatted code #1357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 24, 2021
6 changes: 3 additions & 3 deletions Eight_Puzzle_Solver/eight_puzzle.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import sys
# import sys
from collections import deque
from copy import deepcopy
from queue import PriorityQueue
import time
from collections import Counter
# import time
# from collections import Counter

class Node:
def __init__(self,state,depth = 0,moves = None,optimizer=0):
Expand Down
37 changes: 20 additions & 17 deletions Face and eye Recognition/face_recofnation_first.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
## Name - Soumyajit Chakraborty
## 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')

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()):
while cap.isOpened():

falg ,img = cap.read() #start reading the camera output i mean frames
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)
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 (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)
for (a, b, c, d) in eyes:
cv.rectangle(img, (a, b), (a + c, b + d), (255, 0, 0), 1)

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

cv.release()
cv.destroyAllWindows()


17 changes: 9 additions & 8 deletions Face and eye Recognition/gesture_control.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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)
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)
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)
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()
cv.destroyAllWindows()
Loading