Upload 12 files
Browse files- Person/101231186_1701957441.jpg +0 -0
- Person/101231186_1701958029.jpg +0 -0
- Person/101231186_1701964291.jpg +0 -0
- Person/10123_1701964199.jpg +0 -0
- Person/123_1702026855.jpg +0 -0
- __pycache__/anti_spoofing.cpython-311.pyc +0 -0
- app.py +58 -27
Person/101231186_1701957441.jpg
ADDED
Person/101231186_1701958029.jpg
ADDED
Person/101231186_1701964291.jpg
ADDED
Person/10123_1701964199.jpg
ADDED
Person/123_1702026855.jpg
ADDED
__pycache__/anti_spoofing.cpython-311.pyc
ADDED
Binary file (13.2 kB). View file
|
|
app.py
CHANGED
@@ -1,30 +1,61 @@
|
|
1 |
-
import
|
|
|
|
|
|
|
|
|
2 |
import cv2
|
3 |
from anti_spoofing import AntiSpoofingSystem
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
import tkinter as tk
|
3 |
+
from tkinter import messagebox
|
4 |
+
from PIL import Image, ImageTk
|
5 |
+
import threading
|
6 |
import cv2
|
7 |
from anti_spoofing import AntiSpoofingSystem
|
8 |
|
9 |
+
class AntiSpoofingGUI:
|
10 |
+
def __init__(self, anti_spoofing_system):
|
11 |
+
self.anti_spoofing_system = anti_spoofing_system
|
12 |
+
self.window = tk.Tk()
|
13 |
+
self.window.title("Anti-Spoofing System")
|
14 |
+
|
15 |
+
self.student_id_label = tk.Label(self.window, text="Student ID:")
|
16 |
+
self.student_id_label.pack()
|
17 |
+
self.student_id_entry = tk.Entry(self.window)
|
18 |
+
self.student_id_entry.pack()
|
19 |
+
|
20 |
+
self.student_name_label = tk.Label(self.window, text="Student Name:")
|
21 |
+
self.student_name_label.pack()
|
22 |
+
self.student_name_entry = tk.Entry(self.window)
|
23 |
+
self.student_name_entry.pack()
|
24 |
+
|
25 |
+
self.start_button = tk.Button(self.window, text="Start", command=self.start_anti_spoofing)
|
26 |
+
self.start_button.pack()
|
27 |
+
|
28 |
+
self.image_label = tk.Label(self.window)
|
29 |
+
self.image_label.pack()
|
30 |
+
|
31 |
+
# Create a PhotoImage object to use for the video feed
|
32 |
+
self.photo = ImageTk.PhotoImage("RGB", (640, 480))
|
33 |
+
|
34 |
+
def start_anti_spoofing(self):
|
35 |
+
self.student_id = self.student_id_entry.get()
|
36 |
+
self.student_name = self.student_name_entry.get()
|
37 |
+
|
38 |
+
if not self.student_id or not self.student_name:
|
39 |
+
messagebox.showwarning("Warning", "Please enter both Student ID and Name")
|
40 |
+
return
|
41 |
+
|
42 |
+
threading.Thread(target=self.run_anti_spoofing, daemon=True).start()
|
43 |
+
|
44 |
+
def run_anti_spoofing(self):
|
45 |
+
self.anti_spoofing_system.student_id = self.student_id
|
46 |
+
self.anti_spoofing_system.student_name = self.student_name
|
47 |
+
self.anti_spoofing_system.run(self.update_frame)
|
48 |
+
|
49 |
+
def update_frame(self, frame):
|
50 |
+
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
|
51 |
+
self.photo.paste(Image.fromarray(cv2image))
|
52 |
+
self.image_label.config(image=self.photo)
|
53 |
+
self.image_label.update_idletasks()
|
54 |
+
|
55 |
+
def run(self):
|
56 |
+
self.window.mainloop()
|
57 |
+
|
58 |
+
if __name__ == "__main__":
|
59 |
+
anti_spoofing_system = AntiSpoofingSystem()
|
60 |
+
gui = AntiSpoofingGUI(anti_spoofing_system)
|
61 |
+
gui.run()
|