Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
116 lines (94 loc) · 3.64 KB
/
Copy pathmain.py
File metadata and controls
116 lines (94 loc) · 3.64 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
import tkinter as tk
from tkinter import ttk
from human_detection_cascade import humanDetection
class tkinterApp(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (StartPage, DistancePage):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky = "nsew")
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
tk.Label(self,
text="SOCIAL DISTANCING DETECTION AND ALARM SYSTEM",
fg="green",
pady=100,
font="Helvetica 50 bold ").pack()
tk.Label(self,
text="""This system connects with your surveillance system and detects human beings captured in the video.
On processing the video stream, it displays whether the humans are maintaining safe distance between them or not.""",
fg="blue",
font="Helvetica 20",
justify=tk.CENTER).pack()
tk.Button(self,
text="Click To Initialise",
relief='raised',
fg='green',
font="Helvetica 30 bold ",
height=3,
highlightcolor='light green',
pady='4',
padx='10',
command= lambda : controller.show_frame(DistancePage)
).pack()
class DistancePage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.val = 1
tk.Label(self,
text="SOCIAL DISTANCING DETECTION AND ALARM SYSTEM",
fg="green",
pady=100,
font="Helvetica 50 bold ").pack()
tk.Label(self,
text="""Enter The Minimum Distance""",
fg="blue",
font="Helvetica 20",
justify=tk.CENTER).pack()
v = tk.Entry(
self,
bd=2,
highlightcolor='light blue'
)
v.pack()
def validateEntry():
x = v.get()
if x.isdigit() and len(x) <= 2:
if int(x) > self.val and int(x) <= 15:
p_button["state"] = "normal"
INPUT_DISTANCE = int(x)
else:
p_button["state"] = "disabled"
else:
p_button["state"] = "disabled"
check_button = tk.Button(self,
text='Check Validity',
fg='green',
pady=10,
padx=10,
font='Helvetica 20',
command= validateEntry)
check_button.pack(pady=10)
p_button = tk.Button(self,
text='Proceed',
fg='green',
pady=10,
padx=10,
state="disabled",
font='Helvetica 30',
command= lambda : humanDetection(int(v.get())*100)
)
p_button.pack(pady=20)
app = tkinterApp()
app.mainloop()