added screen axis for c3d so that import possible in blender
This commit is contained in:
parent
db8014c3f5
commit
fb191d8a59
@ -116,6 +116,9 @@ def c3d_to_trc_func(*args):
|
||||
trc_line = '{i}\t{t}\t'.format(i=i, t=trc_time[n]) + '\t'.join(map(str,c3d_line_markers))
|
||||
trc_o.write(trc_line+'\n')
|
||||
|
||||
print(f'Converted c3d file to {trc_path}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-i', '--input', required = True, help='c3d input file name')
|
||||
|
@ -34,7 +34,7 @@ __status__ = "Development"
|
||||
|
||||
|
||||
## FUNCTIONS
|
||||
def extract_marker_data(trc_path):
|
||||
def extract_trc_data(trc_path):
|
||||
'''
|
||||
Extract marker names and coordinates from a trc file.
|
||||
|
||||
@ -78,6 +78,7 @@ def create_c3d_file(c3d_path, marker_names, trc_data_np):
|
||||
# write c3d file
|
||||
writer = c3d.Writer(point_rate=frame_rate, analog_rate=0, point_scale=1.0, point_units='mm', gen_scale=-1.0)
|
||||
writer.set_point_labels(marker_names)
|
||||
writer.set_screen_axis(X='+Z', Y='+Y')
|
||||
|
||||
for frame in trc_data_np:
|
||||
residuals = np.full((len(marker_names), 1), 0.0)
|
||||
@ -113,9 +114,11 @@ def trc_to_c3d_func(*args):
|
||||
trc_path = args[0] # invoked as a function
|
||||
c3d_path = trc_path.replace('.trc', '.c3d')
|
||||
|
||||
marker_names, trc_data_np = extract_marker_data(trc_path)
|
||||
marker_names, trc_data_np = extract_trc_data(trc_path)
|
||||
create_c3d_file(c3d_path, marker_names, trc_data_np)
|
||||
|
||||
print(f'Converted trc file to {c3d_path}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Convert TRC files to C3D files.')
|
||||
|
@ -428,6 +428,7 @@ def create_c3d_file(c3d_path, marker_names, trc_data_np):
|
||||
# write c3d file
|
||||
writer = c3d.Writer(point_rate=frame_rate, analog_rate=0, point_scale=1.0, point_units='mm', gen_scale=-1.0)
|
||||
writer.set_point_labels(marker_names)
|
||||
writer.set_screen_axis(X='+Z', Y='+Y')
|
||||
|
||||
for frame in trc_data_np:
|
||||
residuals = np.full((len(marker_names), 1), 0.0)
|
||||
|
Loading…
Reference in New Issue
Block a user