diff --git a/Pose2Sim/filtering.py b/Pose2Sim/filtering.py index cf0b4ee..4565fb4 100644 --- a/Pose2Sim/filtering.py +++ b/Pose2Sim/filtering.py @@ -481,7 +481,7 @@ def filter_all(config_dict): # Read trc coordinates values trc_df = pd.read_csv(t_in, sep="\t", skiprows=4) frames_col, time_col = trc_df.iloc[:,0], trc_df.iloc[:,1] - Q_coord = trc_df.drop(trc_df.columns[[0, 1]], axis=1) + Q_coord = trc_df.drop(trc_df.columns[[0, 1, -1]], axis=1) # Filter coordinates Q_filt = Q_coord.apply(filter1d, axis=0, args = [config_dict, filter_type, frame_rate]) @@ -489,7 +489,7 @@ def filter_all(config_dict): # Display figures if display_figures: # Retrieve keypoints - keypoints_names = pd.read_csv(t_in, sep="\t", skiprows=3, nrows=0).columns[2::3].to_numpy() + keypoints_names = pd.read_csv(t_in, sep="\t", skiprows=3, nrows=0).columns[2::3][:-1].to_numpy() display_figures_fun(Q_coord, Q_filt, time_col, keypoints_names, person_id) # Reconstruct trc file with filtered coordinates diff --git a/Pose2Sim/triangulation.py b/Pose2Sim/triangulation.py index 98757ae..38c31c2 100644 --- a/Pose2Sim/triangulation.py +++ b/Pose2Sim/triangulation.py @@ -214,8 +214,8 @@ def make_trc(config_dict, Q, keypoints_names, f_range, id_person=-1): header_trc = ['PathFileType\t4\t(X/Y/Z)\t' + trc_f, 'DataRate\tCameraRate\tNumFrames\tNumMarkers\tUnits\tOrigDataRate\tOrigDataStartFrame\tOrigNumFrames', '\t'.join(map(str,[DataRate, CameraRate, NumFrames, NumMarkers, 'm', OrigDataRate, f_range[0], f_range[1]])), - 'Frame#\tTime\t' + '\t\t\t'.join(keypoints_names) + '\t\t', - '\t\t'+'\t'.join([f'X{i+1}\tY{i+1}\tZ{i+1}' for i in range(len(keypoints_names))])] + 'Frame#\tTime\t' + '\t\t\t'.join(keypoints_names) + '\t\t\t', + '\t\t'+'\t'.join([f'X{i+1}\tY{i+1}\tZ{i+1}' for i in range(len(keypoints_names))]) + '\t'] # Zup to Yup coordinate system Q = zup2yup(Q)