From fab12d3f54cafa9ccd98085887141fca327274fc Mon Sep 17 00:00:00 2001 From: Erik Hildebrandt Date: Tue, 25 Jul 2023 14:55:29 +0200 Subject: [PATCH] Last finishes --- DataStreamModule.py | 7 ------- HPEModule.py | 1 - PoseEstimationGUI.py | 7 +------ main.py | 5 ++--- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/DataStreamModule.py b/DataStreamModule.py index 610e510..eb03b0b 100644 --- a/DataStreamModule.py +++ b/DataStreamModule.py @@ -26,15 +26,8 @@ class DataStreamModule(IDataStreamModule): # Method to get the camera stream from a given camera def get_camera_stream(self, camera_name): cap = cv2.VideoCapture(camera_name) - total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) - current_frame = 0 while cap.isOpened(): ret, frame = cap.read() # Yield each frame as a numpy array yield np.array(frame) - current_frame += 1 - if current_frame == total_frames - 1: - # If the current frame is the second-to-last frame, reset to the beginning of the file - cap.set(cv2.CAP_PROP_POS_FRAMES, 0) - current_frame = 0 cap.release() diff --git a/HPEModule.py b/HPEModule.py index 9db6ae5..57a2995 100644 --- a/HPEModule.py +++ b/HPEModule.py @@ -1,6 +1,5 @@ import os from xml.dom import minidom - import cv2 import mediapipe as mp from DataStreamModule import DataStreamModule diff --git a/PoseEstimationGUI.py b/PoseEstimationGUI.py index d684403..a16075a 100644 --- a/PoseEstimationGUI.py +++ b/PoseEstimationGUI.py @@ -62,7 +62,6 @@ class PoseEstimationGUI: 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, self.export_Landmarks,)) @@ -76,8 +75,4 @@ class PoseEstimationGUI: 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__': - PoseEstimationGUI() + self.mp4_file_path = None \ No newline at end of file diff --git a/main.py b/main.py index 34613f7..d2213ad 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,4 @@ -from HPEModule import HPEModule +from PoseEstimationGUI import PoseEstimationGUI if __name__ == '__main__': - pe = HPEModule() # use camera 0 - pe.startHPEwithCamera(0) + gui = PoseEstimationGUI() # use camera 0