-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.py
More file actions
73 lines (53 loc) · 2.4 KB
/
Copy pathApplication.py
File metadata and controls
73 lines (53 loc) · 2.4 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
import tkinter as tk
import customtkinter
import imageDetector
import videoDetector
from tkinter import Label
from tkinter import filedialog as fd
from tkinter.messagebox import showinfo
customtkinter.set_appearance_mode("System") # Modes: system (default), light, dark
customtkinter.set_default_color_theme("dark-blue") # Themes: blue (default), dark-blue, green
# create the root window
root = customtkinter.CTk()
root.title('Potholes Detection')
root.resizable(False, False)
root.geometry('400x200')
HeadingText= Label(root, text="Select Image or Video to Identify Pothole", font=("poppins", 16))
def select_image_file():
#Restricting only Image and video files to select through application
filetypes = (('Image files', '*.jpg'),)
filename = fd.askopenfilename(
title='Open a file',
initialdir='/',
filetypes=filetypes)
if(len(filename)) > 0:
showinfo(title='Selected Image File',message=filename)
imageDetector.detectPotholeonImage(filename)
def select_video_file():
#Restricting only Image and video files to select through application
filetypes = (('Video files', '*.mp4'),)
filename = fd.askopenfilename(
title='Open a file',
initialdir='/',
filetypes=filetypes)
if(len(filename)) > 0:
showinfo(title='Selected Video File',message=filename)
videoDetector.detectPotholeonVideo(filename)
#Image open button
image_open_button = customtkinter.CTkButton(root,text='Image',command=select_image_file,hover_color="green")
#Video open button
video_open_button = customtkinter.CTkButton(root,text='Video',command=select_video_file,hover_color="green")
#Live Camera button
liveCamera_button = customtkinter.CTkButton(root,
text='Live Camera',
command= lambda : videoDetector.detectPotholeonVideo(0),
hover_color="green",
border_color="black",
border_width=2.5,
fg_color= "red",font=("poppins", 14))
HeadingText.place(x= 50, y =15)
image_open_button.place(x=40, y=80)
video_open_button.place(x=220, y=80)
liveCamera_button.pack(side='bottom',pady=20)
# run the application
root.mainloop()