Skip to content

Commit dcfee26

Browse files
Merge pull request #1357 from slowy07/slowy07-fixing
fixing baseException and reformatted code
2 parents ea5bac2 + 7afa3dc commit dcfee26

File tree

9 files changed

+502
-437
lines changed

9 files changed

+502
-437
lines changed

Eight_Puzzle_Solver/eight_puzzle.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import sys
1+
# import sys
22
from collections import deque
33
from copy import deepcopy
44
from queue import PriorityQueue
5-
import time
6-
from collections import Counter
5+
# import time
6+
# from collections import Counter
77

88
class Node:
99
def __init__(self,state,depth = 0,moves = None,optimizer=0):

Face and eye Recognition/face_recofnation_first.py

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
1-
## Name - Soumyajit Chakraborty
1+
## Name - Soumyajit Chakraborty
22
## place - kolkata
33
## date - 10 / 08 / 2020
44

55
import cv2 as cv
6-
face_cascade = cv.CascadeClassifier('..\libs\haarcascade_frontalface_default.xml')
7-
face_cascade_eye = cv.CascadeClassifier('..\libs\haarcascade_eye.xml')
8-
#face_glass = cv.CascadeClassifier('..\libs\haarcascade_eye_tree_eyeglasses.xml')
6+
7+
face_cascade = cv.CascadeClassifier("..\libs\haarcascade_frontalface_default.xml")
8+
face_cascade_eye = cv.CascadeClassifier("..\libs\haarcascade_eye.xml")
9+
# face_glass = cv.CascadeClassifier('..\libs\haarcascade_eye_tree_eyeglasses.xml')
910

1011
cap = cv.VideoCapture(0)
11-
while(cap.isOpened()):
12+
while cap.isOpened():
1213

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

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

23-
for(a , b , c , d) in eyes:
24-
cv.rectangle(img, (a , b), (a+c, b+d), (255, 0, 0), 1)
28+
for (a, b, c, d) in eyes:
29+
cv.rectangle(img, (a, b), (a + c, b + d), (255, 0, 0), 1)
2530

26-
cv.imshow('img' , img )
31+
cv.imshow("img", img)
2732
c = cv.waitKey(1)
28-
if c == ord('q'):
33+
if c == ord("q"):
2934
break
3035

3136
cv.release()
3237
cv.destroyAllWindows()
33-
34-
+9-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import cv2 as cv
2+
23
# import numpy as np
34

4-
img = cv.imread('..\img\hand1.jpg' , 0)
5-
flag,frame = cv.threshold(img , 70 , 255 , cv.THRESH_BINARY)
5+
img = cv.imread("..\img\hand1.jpg", 0)
6+
flag, frame = cv.threshold(img, 70, 255, cv.THRESH_BINARY)
67

7-
contor,_ = cv.findContours(frame.copy(),cv.RETR_TREE,cv.CHAIN_APPROX_SIMPLE)
8+
contor, _ = cv.findContours(frame.copy(), cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
89

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

11-
final = cv.drawContours(img , hull , -1 , (0 , 0 , 0) )
12-
cv.imshow('original_image' , img)
13-
cv.imshow('thres' , frame)
14-
cv.imshow('final_hsv' , final)
12+
final = cv.drawContours(img, hull, -1, (0, 0, 0))
13+
cv.imshow("original_image", img)
14+
cv.imshow("thres", frame)
15+
cv.imshow("final_hsv", final)
1516

1617
cv.waitKey(0)
17-
cv.destroyAllWindows()
18+
cv.destroyAllWindows()

0 commit comments

Comments
 (0)