-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
199 lines (134 loc) · 6.91 KB
/
main.py
File metadata and controls
199 lines (134 loc) · 6.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
from tkinter import *
from tkinter import ttk
import tkinter
from PIL import Image, ImageTk
from student import Student
from train import Train
from attendance import Attendance
from developer import Developer
from help import Help
from face_recognition import Face_Recognition
import os
from time import strftime
class Face_Recognition_System:
def __init__(self, root):
self.root=root
imgs = Image.open(r"img/vit2.jpeg")
imgs = imgs.resize((530,150),Image.LANCZOS)
self.photoimgs = ImageTk.PhotoImage(imgs)
f_lbl = Label(self.root,image = self.photoimgs)
f_lbl.place(x=0,y=0,width=530,height=150)
imgl = Image.open(r"img/vit2.jpeg")
imgl = imgl.resize((530,150),Image.LANCZOS)
self.photoimgl = ImageTk.PhotoImage(imgs)
f_lbl = Label(self.root,image = self.photoimgl)
f_lbl.place(x=1060,y=0,width=530,height=150)
#background image
img3 = Image.open(r"img\bg.jpg")
img3 = img3.resize((1530,710),Image.LANCZOS)
self.photoimg3 = ImageTk.PhotoImage(img3)
bg_img = Label(self.root,image = self.photoimg3)
bg_img.place(x=0,y=150,width=1530,height=710)
#img 1
img = Image.open(r"img\vit.jpg")
img = img.resize((530,150),Image.LANCZOS)
self.photoimg = ImageTk.PhotoImage(img)
f_lbl = Label(self.root,image = self.photoimg)
f_lbl.place(x=530,y=0,width=530,height=150)
self.root.geometry("1530x790+0+0")
self.root.title("Face Recognition System")
#student button
img4 = Image.open(r"img\details.jpeg")
img4 = img4.resize((220,220),Image.LANCZOS)
self.photoimg4 = ImageTk.PhotoImage(img4)
b1 = Button(bg_img, image = self.photoimg4, command=self.student_details ,cursor="hand2")
b1.place(x=200,y=50,width=220,height=220)
b1_1 = Button(bg_img, text="Student Details", command=self.student_details ,cursor="hand2",font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=200,y=260,width=220,height=40)
#train button
img8 = Image.open(r"img\facial_recognition_system_identification_digital_id_security_scanning_thinkstock_858236252_3x3-100740902-large.jpg")
img8 = img8.resize((220,220),Image.LANCZOS)
self.photoimg8 = ImageTk.PhotoImage(img8)
b1 = Button(bg_img, image = self.photoimg8, command=self.train_data,cursor="hand2")
b1.place(x=500,y=50,width=220,height=220)
b1_1 = Button(bg_img, text="Train Face", cursor="hand2",command=self.train_data,font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=500,y=260,width=220,height=40)
#detect face button
img5 = Image.open(r"img\face_detector1.jpg")
img5 = img5.resize((220,220),Image.LANCZOS)
self.photoimg5 = ImageTk.PhotoImage(img5)
b1 = Button(bg_img, image = self.photoimg5,command=self.face_date, cursor="hand2")
b1.place(x=800,y=50,width=220,height=220)
b1_1 = Button(bg_img, text="Face Detector", cursor="hand2",command=self.face_date,font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=800,y=260,width=220,height=40)
#attendance button
img6 = Image.open(r"img\smart-attendance.jpg")
img6 = img6.resize((220,220),Image.LANCZOS)
self.photoimg6 = ImageTk.PhotoImage(img6)
b1 = Button(bg_img, image = self.photoimg6, command=self.attendance_date, cursor="hand2")
b1.place(x=1100,y=50,width=220,height=220)
b1_1 = Button(bg_img, text="Attendance", cursor="hand2",command=self.attendance_date,font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=1100,y=260,width=220,height=40)
#photos button
img9 = Image.open(r"img\student.jpg")
img9 = img9.resize((220,220),Image.LANCZOS)
self.photoimg9 = ImageTk.PhotoImage(img9)
b1 = Button(bg_img, image = self.photoimg9, command=self.open_img,cursor="hand2")
b1.place(x=200,y=350,width=220,height=220)
b1_1 = Button(bg_img, text="Photos", cursor="hand2",command=self.open_img,font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=200,y=560,width=220,height=40)
#developer button
img10 = Image.open(r"img\1_5TRuG7tG0KrZJXKoFtHlSg.jpeg")
img10 = img10.resize((220,220),Image.LANCZOS)
self.photoimg10 = ImageTk.PhotoImage(img10)
b1 = Button(bg_img,command=self.developer_date ,image = self.photoimg10, cursor="hand2")
b1.place(x=500,y=350,width=220,height=220)
b1_1 = Button(bg_img,command=self.developer_date, text="Developer", cursor="hand2",font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=500,y=560,width=220,height=40)
#helpdesk button
img7 = Image.open(r"img\help.jpg")
img7 = img7.resize((220,220),Image.LANCZOS)
self.photoimg7 = ImageTk.PhotoImage(img7)
b1 = Button(bg_img, command=self.help_date ,image = self.photoimg7, cursor="hand2")
b1.place(x=800,y=350,width=220,height=220)
b1_1 = Button(bg_img, text="Help Desk", command=self.help_date,cursor="hand2",font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=800,y=560,width=220,height=40)
#exit button
img11 = Image.open(r"img\exit.jpg")
img11 = img11.resize((220,220),Image.LANCZOS)
self.photoimg11 = ImageTk.PhotoImage(img11)
b1 = Button(bg_img,command=self.iExit, image = self.photoimg11, cursor="hand2")
b1.place(x=1100,y=350,width=220,height=220)
b1_1 = Button(bg_img,command=self.iExit ,text="Exit", cursor="hand2",font=("times new roman",15,"bold"),bg="darkblue",fg="white")
b1_1.place(x=1100,y=560,width=220,height=40)
# ======== functions buttons ==========
def open_img(self):
os.startfile("data")
def student_details(self):
self.new_window = Toplevel(self.root)
self.app = Student(self.new_window)
def train_data(self):
self.new_window = Toplevel(self.root)
self.app = Train(self.new_window)
def face_date(self):
self.new_window = Toplevel(self.root)
self.app = Face_Recognition(self.new_window)
def attendance_date(self):
self.new_window = Toplevel(self.root)
self.app = Attendance(self.new_window)
def developer_date(self):
self.new_window = Toplevel(self.root)
self.app = Developer(self.new_window)
def help_date(self):
self.new_window = Toplevel(self.root)
self.app = Help(self.new_window)
def iExit(self):
self.iExit = tkinter.messagebox.askyesno("Face Recognition", "Are you sure exit this project?",parent=self.root)
if self.iExit > 0:
self.root.destroy()
else:
return
if __name__ == "__main__":
root = Tk()
obj = Face_Recognition_System(root)
root.mainloop()