Browse Source

Made GUI Prettier

Dev
Erik Hildebrandt 3 years ago
parent
commit
acba300047
  1. 7
      HPEModule.py
  2. 25
      PoseEstimationGUI.py

7
HPEModule.py

@ -49,8 +49,6 @@ class HPEModule(IHPEModule):
else:
frame = next(cap)
# Recolor image to RGB
image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
image.flags.writeable = False
@ -65,7 +63,7 @@ class HPEModule(IHPEModule):
# Extract landmarks
try:
landmarks = results.pose_landmarks.landmark
print(landmarks)
#print(landmarks)
except:
pass
@ -83,6 +81,3 @@ class HPEModule(IHPEModule):
keyCode = cv2.waitKey(1)
if cv2.getWindowProperty(window_name, cv2.WND_PROP_VISIBLE) < 1:
break
# destroy the window after exiting the loop
#cv2.destroyWindow(window_name)

25
PoseEstimationGUI.py

@ -12,7 +12,8 @@ class PoseEstimationGUI:
self.mp4_file_path = None
self.root = tk.Tk()
self.root.title("Pose Estimation GUI")
self.root.geometry("400x200")
self.root.geometry("400x250")
self.root.config(bg="#F9F9F9")
self.camera_options = [] # Initialize camera options list
@ -20,20 +21,26 @@ class PoseEstimationGUI:
self.camera_options = DataStreamModule().findCameras()
self.selected_camera = tk.StringVar()
self.selected_camera.set(self.camera_options[0]) # default value
camera_label = tk.Label(self.root, text="Select a camera:", bg="#F9F9F9", font=("Arial", 12, "bold"))
camera_label.pack(pady=(20, 0))
camera_menu = tk.OptionMenu(self.root, self.selected_camera, *self.camera_options)
camera_menu.config(font=("Arial", 12))
camera_menu.pack()
# Create a button to start pose estimation
self.start_button = tk.Button(self.root, text="Start Pose Estimation", command=self.start_pose_estimation)
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()
self.select_file_button = tk.Button(self.root, text="Select MP4 File to Start HPE on", bg="#2196F3", fg="white",
font=("Arial", 12, "bold"), command=self.select_file)
self.select_file_button.pack(pady=(10, 20))
# 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.file_selected_label = Label(self.root, text="No file selected", fg="red", bg="#F9F9F9",
font=("Arial", 12))
self.file_selected_label.pack(pady=(10, 0))
# Create a button to start pose estimation
self.start_button = tk.Button(self.root, text="Start Pose Estimation", bg="#4CAF50", fg="white",
font=("Arial", 12, "bold"), command=self.start_pose_estimation)
self.start_button.pack(pady=(20, 10))
self.root.mainloop()

Loading…
Cancel
Save