diff --git a/Pose2Sim/Utilities/reproj_from_trc_calib.py b/Pose2Sim/Utilities/reproj_from_trc_calib.py index ba3e9b0..5606721 100644 --- a/Pose2Sim/Utilities/reproj_from_trc_calib.py +++ b/Pose2Sim/Utilities/reproj_from_trc_calib.py @@ -312,7 +312,7 @@ def reproj_from_trc_calib_func(**args): pass # header preparation - num_frames = min(P_all.shape[1], len(data_trc)) + num_frames = [len(data_trc) if P_all.shape[1]==1 else min(P_all.shape[1], len(data_trc))][0] columns_iterables = [['DavidPagnon'], ['person0'], bodyparts, ['x','y']] columns_h5 = pd.MultiIndex.from_product(columns_iterables, names=['scorer', 'individuals', 'bodyparts', 'coords']) rows_iterables = [[os.path.join(os.path.splitext(input_trc_file)[0],f'img_{i:03d}.png') for i in range(num_frames)]] @@ -324,7 +324,7 @@ def reproj_from_trc_calib_func(**args): Q = data_trc_zup.iloc[:,2:] for frame in range(num_frames): coords = [[] for cam in range(len(P_all))] - P_all_frame = [P_all[cam][frame] for cam in range(len(P_all))] + P_all_frame = [P_all[cam][0] if P_all.shape[1]==1 else P_all[cam][frame] for cam in range(len(P_all))] for keypoint in range(num_bodyparts): q = np.append(Q.iloc[frame,3*keypoint:3*keypoint+3], 1) if undistort_points: @@ -408,4 +408,4 @@ if __name__ == '__main__': parser.add_argument('-O', '--output_file_root', required=False, help='output file root path, without extension') args = vars(parser.parse_args()) - reproj_from_trc_calib_func(**args) \ No newline at end of file + reproj_from_trc_calib_func(**args)