Skip to content

Commit 9315063

Browse files
committed
Display image with correct ratio + more info on angles in Readme
1 parent 0caa915 commit 9315063

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ sports2d --video_input demo.mp4 other_video.mp4 --time_range 1.2 2.7 0 3.5
364364
```cmd
365365
sports2d --flip_left_right true # Default
366366
```
367+
- Correct segment angles according to the estimated camera tild angle.\
368+
**N.B.:** *The camera tilt angle is automatically estimated. Set to false if it is actually the floor which is tilted rather than the camera.*
369+
```cmd
370+
sports2d --correct_segment_angles_with_floor_angle true # Default
371+
```
367372

368373
- To run **inverse kinematics with OpenSim**, check [this section](#run-inverse-kinematics)
369374

@@ -469,7 +474,7 @@ sports2d --help
469474
'trimmed_extrema_percent': ["", "Proportion of the most extreme segment values to remove before calculating their mean. Defaults to 50"],
470475
'fontSize': ["", "font size for angle values. 0.3 if not specified"],
471476
'flip_left_right': ["", "true or false. Flips angles when the person faces the other side. The person looks to the right if their toe keypoint is to the right of their heel. Set it to false if the person is sprinting or if you want timeseries to be continuous even when the participant switches their stance. true if not specified"],
472-
'correct_segment_angles_with_floor_angle': ["", "true or false. If the camera is tilted, corrects segment angles as regards to the floor angle. Set to false is the floor is tilted instead. True if not specified"],
477+
'correct_segment_angles_with_floor_angle': ["", "true or false. If the camera is tilted, corrects segment angles as regards to the floor angle. Set to false if it is actually the floor which is tilted, not the camera. True if not specified"],
473478
'interpolate': ["", "interpolate missing data. true if not specified"],
474479
'interp_gap_smaller_than': ["", "interpolate sequences of missing data if they are less than N frames long. 10 if not specified"],
475480
'fill_large_gaps_with': ["", "last_value, nan, or zeros. last_value if not specified"],

Sports2D/process.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,8 +1512,13 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
15121512
frame_range = [int((time_range[0]-start_time) * frame_rate), int((time_range[1]-start_time) * frame_rate)] if time_range else [0, int(cap.get(cv2.CAP_PROP_FRAME_COUNT))]
15131513
frame_iterator = tqdm(range(*frame_range)) # use a progress bar
15141514
if show_realtime_results:
1515-
cv2.namedWindow(f'{video_file} Sports2D', cv2.WINDOW_NORMAL + cv2.WINDOW_KEEPRATIO)
1516-
cv2.setWindowProperty(f'{video_file} Sports2D', cv2.WND_PROP_ASPECT_RATIO, cv2.WINDOW_FULLSCREEN)
1515+
try:
1516+
screen_width, screen_height = get_screen_size()
1517+
display_width, display_height = calculate_display_size(cam_width, cam_height, screen_width, screen_height)
1518+
cv2.namedWindow(f'{video_file} Sports2D', cv2.WINDOW_NORMAL)
1519+
cv2.resizeWindow(f'{video_file} Sports2D', display_width, display_height)
1520+
except: # if Pose2Sim < v0.10.29
1521+
cv2.namedWindow(f'{video_file} Sports2D', cv2.WINDOW_NORMAL + cv2.WINDOW_KEEPRATIO)
15171522

15181523
# Select the appropriate model based on the model_type
15191524
logging.info('\nEstimating pose...')

0 commit comments

Comments
 (0)