|
|
@ -1,4 +1,6 @@ |
|
|
import tkinter as tk |
|
|
import tkinter as tk |
|
|
|
|
|
from tkinter import filedialog |
|
|
|
|
|
from tkinter import Label |
|
|
from DataStreamModule import DataStreamModule |
|
|
from DataStreamModule import DataStreamModule |
|
|
from HPEModule import HPEModule |
|
|
from HPEModule import HPEModule |
|
|
import threading |
|
|
import threading |
|
|
@ -7,8 +9,10 @@ import threading |
|
|
class PoseEstimationGUI: |
|
|
class PoseEstimationGUI: |
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
def __init__(self): |
|
|
|
|
|
self.mp4_file_path = None |
|
|
self.root = tk.Tk() |
|
|
self.root = tk.Tk() |
|
|
self.root.title("Pose Estimation GUI") |
|
|
self.root.title("Pose Estimation GUI") |
|
|
|
|
|
self.root.geometry("400x200") |
|
|
|
|
|
|
|
|
self.camera_options = [] # Initialize camera options list |
|
|
self.camera_options = [] # Initialize camera options list |
|
|
|
|
|
|
|
|
@ -23,15 +27,41 @@ class PoseEstimationGUI: |
|
|
self.start_button = tk.Button(self.root, text="Start Pose Estimation", command=self.start_pose_estimation) |
|
|
self.start_button = tk.Button(self.root, text="Start Pose Estimation", command=self.start_pose_estimation) |
|
|
self.start_button.pack() |
|
|
self.start_button.pack() |
|
|
|
|
|
|
|
|
|
|
|
# Create a button to select an mp4 file |
|
|
|
|
|
self.select_file_button = tk.Button(self.root, text="Select MP4 File to Start HPE on", command=self.select_file) |
|
|
|
|
|
self.select_file_button.pack() |
|
|
|
|
|
|
|
|
|
|
|
# Create label widget to indicate file selection status |
|
|
|
|
|
self.file_selected_label = Label(self.root, text="No file selected", fg="red") |
|
|
|
|
|
self.file_selected_label.pack(pady=10) |
|
|
|
|
|
|
|
|
self.root.mainloop() |
|
|
self.root.mainloop() |
|
|
|
|
|
|
|
|
def start_pose_estimation(self): |
|
|
def start_pose_estimation(self): |
|
|
# Start pose estimation on the selected camera |
|
|
if self.mp4_file_path is not None: |
|
|
# print(self.selected_camera.get()) |
|
|
# Start pose estimation on the selected mp4 file |
|
|
pose_estimator = HPEModule() |
|
|
pose_estimator = HPEModule() |
|
|
camera = int(self.selected_camera.get()) |
|
|
pose_thread_file = threading.Thread(target=pose_estimator.startHPEwithCamera, args=(self.mp4_file_path,)) |
|
|
pose_thread = threading.Thread(target=pose_estimator.startHPEwithCamera, args=(camera,)) |
|
|
self.mp4_file_path = None |
|
|
pose_thread.start() |
|
|
self.file_selected_label.config(text="No File selected", fg="red") |
|
|
|
|
|
pose_thread_file.start() |
|
|
|
|
|
else: |
|
|
|
|
|
# Start pose estimation on the selected camera |
|
|
|
|
|
# print(self.selected_camera.get()) |
|
|
|
|
|
pose_estimator = HPEModule() |
|
|
|
|
|
camera = int(self.selected_camera.get()) |
|
|
|
|
|
pose_thread_camera = threading.Thread(target=pose_estimator.startHPEwithCamera, args=(camera,)) |
|
|
|
|
|
pose_thread_camera.start() |
|
|
|
|
|
|
|
|
|
|
|
def select_file(self): |
|
|
|
|
|
self.mp4_file_path = filedialog.askopenfilename(initialdir="/", title="Select MP4 File to Start HPE on", |
|
|
|
|
|
filetypes=(("mp4 files", "*.mp4"), ("all files", "*.*"))) |
|
|
|
|
|
# Update file selection status label |
|
|
|
|
|
if self.mp4_file_path: |
|
|
|
|
|
self.file_selected_label.config(text="File selected", fg="green") |
|
|
|
|
|
else: |
|
|
|
|
|
self.file_selected_label.config(text="No File selected", fg="red") |
|
|
|
|
|
self.mp4_file_path = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
|