This commit is contained in:
s449273 2020-02-01 15:25:16 +01:00
parent 07ca3df6de
commit 559803033a
45 changed files with 7655 additions and 48199 deletions

View File

@ -27,12 +27,11 @@ for root, dirs, files in os.walk(image_dir):
#print(label, path)
if not label in label_ids:
label_ids[label] = current_id
# print(label_ids)
current_id += 1
id_ = label_ids[label]
# print(label_ids)
# y_labels.append(label) #some number
# x_train.append(path) # verify this image turn into a numpy array ,gray
pil_image = Image.open(path).convert("L") # gray scale
size = (550, 550)
final_image = pil_image.resize(size, Image.ANTIALIAS)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

BIN
src/faces/bartek/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
src/faces/bartek/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/136.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/137.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/139.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
src/faces/bartek/140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/141.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
src/faces/bartek/142.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/143.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/146.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
src/faces/bartek/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
src/faces/bartek/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 779 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 995 KiB

Binary file not shown.

View File

@ -1,8 +1,11 @@
nagrać nagrania do pokazu footage
ogarnąć strukturę projektu, posprzątać
hover
dzwiek jak ktos dobrze wpisze haslo
może dzięk jak ktos przyjdzie
zmien tapete
@ -21,3 +24,5 @@ dodawanie osób do bazy jakieś wymyśleć
szata graficzna, zmienić listen na capture
reset listy po 20 sec zeby kolejna osoba miala szanse na rozpoznanie
MOŻESZ ZROBIC LATWO TO ODSWIERZANIE PO PROSTU ZALADUJ JESZCZE RAZ PLIK ;)
nagrać nagrania do pokazu footage
dzwiek jak ktos dobrze wpisze haslo

View File

@ -35,6 +35,9 @@ def click_event(event, x, y, flags, param):
elif 640 <= y <= 703 and 218 <= x <= 422: # open gate
global wait_notification
wait_notification = 1
pygame.mixer.init()
pygame.mixer.music.load("noises/beep-07.wav")
pygame.mixer.music.play()
elif 640 <= y <= 703 and 452 <= x <= 694: # take a photo
global screenshot, keyboard, choose
screenshot = 1
@ -267,9 +270,10 @@ def click_event2(event, x, y, flags, param):
def display_work(length):
global displayString
global displayString, switch
if length == 1:
putOnDisplay(outDoor, 220, 304, 54, 214, 'images/*.png')
switch = 1
elif length == 2:
putOnDisplay(outDoor, 220, 304, 54, 214, 'images/**.png')
elif length == 3:
@ -279,9 +283,15 @@ def display_work(length):
putOnDisplay(outDoor, 220, 304, 54, 214, 'images/goodpass.png')
global wait_notification
wait_notification = 1
if (switch == 1):
pygame.mixer.init()
pygame.mixer.music.load("noises/beep-07.wav")
pygame.mixer.music.play()
switch = 0
if wait_seconds2(3) == True:
name_of_photo[2] = name_of_photo[2] + 1
displayString = displayString + '#'
else:
putOnDisplay(outDoor, 220, 304, 54, 214, 'images/badpass.png')
if wait_seconds2(3) == True:
@ -451,7 +461,7 @@ def putStatsOnDisplay():
# Declaration
global displayString, wait_notification, wait_add, temp1, temp2, temp3, temp4, temp5, temp6, refresh, name_of_photo, stats_status, screenshot, cam_status, show_who, is_recording, show_list, choose, keyboard, keyboardChar, keyboardString, keyboardWork
global displayString, wait_notification, wait_add, temp1, temp2, temp3, temp4, switch, temp5, temp6, refresh, name_of_photo, stats_status, screenshot, cam_status, show_who, is_recording, show_list, choose, keyboard, keyboardChar, keyboardString, keyboardWork
mydb = mysql.connector.connect(
host="localhost",
user="root",
@ -472,6 +482,7 @@ temp4 = None
temp5 = None
temp6 = None
wait_notification = 0
switch = 0
wait_add = 0
cam_status = 0
stats_status = 0
@ -485,6 +496,7 @@ show_list = 0
List = []
out = None
refresh = 1
attempt = 15
font = cv2.FONT_HERSHEY_SIMPLEX
# Wyczytywanie zmiennych z pliku
@ -497,7 +509,13 @@ with open("variable.pickle", "rb") as f:
# Ustawianie parametrów kamery
cap = cv2.VideoCapture(0)
#cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture('recordings/footage.mp4') # pokaz
# cap = cv2.VideoCapture('recordings/footage2.mp4') #zle
# cap = cv2.VideoCapture('recordings/footage3.mp4') #pokaz2
# cap = cv2.VideoCapture('recordings/footage4.mp4') #pokaz2
# cap = cv2.VideoCapture('recordings/footage5.mp4') #zle
#cap = cv2.VideoCapture('recordings/footage6.mp4') # pol na pol
cap.set(3, 1280)
cap.set(4, 720)
ret, frame1 = cap.read()
@ -505,7 +523,7 @@ ret, frame2 = cap.read()
while True:
# print("brak")
if(refresh == 1):
# Wczytywanie listy osób które znajdują się w bazie
@ -520,7 +538,6 @@ while True:
'cascades/data/haarcascade_frontalface_alt2.xml')
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read("trainner.yml")
print("odswierzam")
refresh = 0
@ -531,11 +548,8 @@ while True:
# Wykrywanie ruchu
diff = cv2.absdiff(frame1, frame2)
# cv2.imshow('diff',diff)
gray = cv2.cvtColor(diff, cv2.COLOR_BGR2GRAY)
# cv2.imshow('gray',gray)
blur = cv2.GaussianBlur(gray, (5, 5), 0)
# cv2.imshow('blur',blur)
_, thresh = cv2.threshold(blur, 20, 255, cv2.THRESH_BINARY)
dilated = cv2.dilate(thresh, None, iterations=3)
contours, _ = cv2.findContours(
@ -543,9 +557,10 @@ while True:
for contour in contours:
if cv2.contourArea(contour) < 10000:
if cv2.contourArea(contour) < 20000:
continue
# aktualizacja czasu nagrywania (nagrywa do 20 sec po ostatnim wykryciu ruchu)
print("ruch")
temp4 = datetime.datetime.now()
if is_recording == 0:
@ -597,7 +612,7 @@ while True:
faces = face_cascade.detectMultiScale(
gray, scaleFactor=1.5, minNeighbors=5)
if len(List) < 11:
if len(List) < attempt:
for (x, y, w, h) in faces:
@ -606,23 +621,27 @@ while True:
id_, conf = recognizer.predict(roi_gray)
if conf >= 1:
print("rozpoznano:" + labels[id_])
count = count + 1
List.append(labels[id_])
# Wyłączenie widoku kamery w podglądzie
putOnDisplay(frame, 620, 720, 0, 1280, 'images/menu.png')
if cam_status == 0:
putOnDisplay(frame, 0, 720, 0, 1280, "images/black.png")
actual_time = str(
datetime.datetime.now().strftime("%H:%M:%S"))
cv2.putText(frame, actual_time, (700, 100),
font, 2, (255, 255, 255), 1, cv2.LINE_AA)
# Powiadomienie o rozpoznaniu osoby
if len(List) > 0 and len(List) < 11:
if len(List) > 0 and len(List) < attempt:
print("lista: " + str(len(List)))
if wait_seconds6(30) == True:
List = []
if len(List) == 11:
if len(List) >= attempt:
font = cv2.FONT_HERSHEY_SIMPLEX
putOnDisplay(frame, 120, 255, 60, 430, "images/is_coming.png")
cv2.putText(frame, most_frequent(List), (80, 170),
@ -654,7 +673,7 @@ while True:
cv2.putText(frame, "motion detected", (500, 500),
font, 1, (255, 255, 255), 2, cv2.LINE_AA)
if wait_seconds4(20) == True:
if wait_seconds4(5) == True:
is_recording = 0
# Wybór podczas robienia zdjecia #####################################
@ -685,7 +704,6 @@ while True:
cv2.putText(frame, name, (716, 200 + poz*40),
font, 1, (255, 255, 255), 2, cv2.LINE_AA)
poz = poz + 1
print("files 0 to: " + files[0])
# Klawiatura
if keyboard == 1:
@ -706,7 +724,7 @@ while True:
# Umieszczenie więkości interfejsu
putOnDisplay(frame, 620, 720, 0, 1280, 'images/menu.png')
putOnDisplay(frame, 640, 640 + 63, 20, 188, 'images/camera.png')
putOnDisplay(frame, 640, 640 + 63, 218, 422, 'images/open_gate.png')

File diff suppressed because it is too large Load Diff

Binary file not shown.