|
46 | 46 | from rtmlib import PoseTracker, BodyWithFeet, Wholebody, Body, Hand, Custom, draw_skeleton |
47 | 47 | from deep_sort_realtime.deepsort_tracker import DeepSort |
48 | 48 | from Pose2Sim.common import natural_sort_key, sort_people_sports2d, sort_people_deepsort,\ |
49 | | - colors, thickness, draw_bounding_box, draw_keypts, draw_skel |
| 49 | + colors, thickness, draw_bounding_box, draw_keypts, draw_skel, get_screen_size, calculate_display_size |
50 | 50 | from Pose2Sim.skeletons import * |
51 | 51 |
|
52 | 52 |
|
@@ -233,7 +233,10 @@ def process_video(video_path, pose_tracker, pose_model, output_format, save_vide |
233 | 233 | out = cv2.VideoWriter(output_video_path, fourcc, fps, (W, H)) # Create the output video file |
234 | 234 |
|
235 | 235 | if display_detection: |
236 | | - cv2.namedWindow(f"Pose Estimation {os.path.basename(video_path)}", cv2.WINDOW_NORMAL + cv2.WINDOW_KEEPRATIO) |
| 236 | + screen_width, screen_height = get_screen_size() |
| 237 | + display_width, display_height = calculate_display_size(W, H, screen_width, screen_height, margin=50) |
| 238 | + cv2.namedWindow(f"Pose Estimation {os.path.basename(video_path)}", cv2.WINDOW_NORMAL) |
| 239 | + cv2.resizeWindow(f"Pose Estimation {os.path.basename(video_path)}", display_width, display_height) |
237 | 240 |
|
238 | 241 | frame_idx = 0 |
239 | 242 | cap = cv2.VideoCapture(video_path) |
@@ -353,7 +356,10 @@ def process_images(image_folder_path, vid_img_extension, pose_tracker, pose_mode |
353 | 356 | out = cv2.VideoWriter(output_video_path, fourcc, fps, (W, H)) # Create the output video file |
354 | 357 |
|
355 | 358 | if display_detection: |
| 359 | + screen_width, screen_height = get_screen_size() |
| 360 | + display_width, display_height = calculate_display_size(W, H, screen_width, screen_height, margin=50) |
356 | 361 | cv2.namedWindow(f"Pose Estimation {os.path.basename(image_folder_path)}", cv2.WINDOW_NORMAL) |
| 362 | + cv2.resizeWindow(f"Pose Estimation {os.path.basename(image_folder_path)}", display_width, display_height) |
357 | 363 |
|
358 | 364 | f_range = [[0,len(image_files)] if frame_range in ('all', 'auto', []) else frame_range][0] |
359 | 365 | for frame_idx, image_file in enumerate(tqdm(image_files, desc=f'\nProcessing {os.path.basename(img_output_dir)}')): |
|
0 commit comments