Skip to content

Commit 0caa915

Browse files
committed
post-processed angles unwrapped and kept between -180 and 180°
1 parent 22e4415 commit 0caa915

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sports2D/process.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,6 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
15151515
cv2.namedWindow(f'{video_file} Sports2D', cv2.WINDOW_NORMAL + cv2.WINDOW_KEEPRATIO)
15161516
cv2.setWindowProperty(f'{video_file} Sports2D', cv2.WND_PROP_ASPECT_RATIO, cv2.WINDOW_FULLSCREEN)
15171517

1518-
15191518
# Select the appropriate model based on the model_type
15201519
logging.info('\nEstimating pose...')
15211520
pose_model_name = pose_model
@@ -2035,8 +2034,11 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
20352034
for i in range(all_frames_angles_homog.shape[1]): # for each person
20362035
for j in range(all_frames_angles_homog.shape[2]): # for each angle
20372036
valid_mask = ~np.isnan(all_frames_angles_homog[:, i, j])
2038-
all_frames_angles_homog[valid_mask, i, j] = np.unwrap(all_frames_angles_homog[valid_mask, i, j], period=180)
2039-
2037+
ang = np.unwrap(all_frames_angles_homog[valid_mask, i, j], period=180)
2038+
ang = ang-360 if ang.mean()> 180 else ang
2039+
ang = ang+360 if ang.mean()<-180 else ang
2040+
all_frames_angles_homog[valid_mask, i, j] = ang
2041+
20402042
# Process angles for each person
20412043
for i, idx_person in enumerate(selected_persons):
20422044
angles_path_person = angles_output_path.parent / (angles_output_path.stem + f'_person{i:02d}.mot')

0 commit comments

Comments
 (0)