alternative to multi-person if not satisfying
This commit is contained in:
parent
eb80393304
commit
5347f22d49
@ -4,7 +4,7 @@
|
||||
|
||||
'''
|
||||
##################################################
|
||||
## EASYMOCAP CALIBRATION TO TOML CALIBRATION ##
|
||||
## TOML CALIBRATION TO EASYMOCAP CALIBRATION ##
|
||||
##################################################
|
||||
|
||||
Convert a Pose2Sim .toml calibration file
|
||||
|
@ -14,8 +14,8 @@
|
||||
coordinates on the original images.
|
||||
|
||||
Usage:
|
||||
json_display_without_img -j json_folder -W 1920 -H 1080
|
||||
json_display_without_img -j json_folder -o output_img_folder -d True -s True -W 1920 -H 1080 - 30
|
||||
python -m json_display_without_img -j json_folder -W 1920 -H 1080
|
||||
python -m json_display_without_img -j json_folder -o output_img_folder -d True -s True -W 1920 -H 1080 - 30
|
||||
import json_display_without_img; json_display_without_img.json_display_without_img_func(json_folder=r'<json_folder>', image_width=1920, image_height = 1080)
|
||||
'''
|
||||
|
||||
@ -136,12 +136,13 @@ def json_display_without_img_func(**args):
|
||||
|
||||
plt.close('all')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-j', '--json_folder', required = True, help='folder of json 2D coordinate files')
|
||||
parser.add_argument('-W', '--image_width', required = True, help='image width')
|
||||
parser.add_argument('-H', '--image_height', required = True, help='image height')
|
||||
parser.add_argument('-f', '--frame_rate', required = True, help='frame rate')
|
||||
parser.add_argument('-W', '--image_width', required = False, help='image width')
|
||||
parser.add_argument('-H', '--image_height', required = False, help='image height')
|
||||
parser.add_argument('-f', '--frame_rate', required = False, help='frame rate')
|
||||
parser.add_argument('-o', '--output_img_folder', required=False, help='custom folder name for coordinates overlayed on images')
|
||||
parser.add_argument('-d', '--display', default=True, required = False, help='display images with overlayed coordinates')
|
||||
parser.add_argument('-s', '--save', default=False, required = False, help='save images with overlayed 2D coordinates')
|
||||
|
@ -1,214 +0,0 @@
|
||||
[2024-02-27 17:07:01.556] [info] Loaded model Pose2Sim_scaled-scaled from file D:\softs\github_david\Openpose-to-Opensim\Pose_from_simu_draft\Yoga_multi\Model_Pose2Sim_Body25b_scaled_unlocked_small.osim
|
||||
[2024-02-27 17:07:01.557] [warning] Couldn't find file 'r_pelvis.vtp'.
|
||||
[2024-02-27 17:07:01.558] [warning] Couldn't find file 'l_pelvis.vtp'.
|
||||
[2024-02-27 17:07:01.558] [warning] Couldn't find file 'sacrum.vtp'.
|
||||
[2024-02-27 17:07:01.558] [warning] Couldn't find file 'femur_r.vtp'.
|
||||
[2024-02-27 17:07:01.558] [warning] Couldn't find file 'r_patella.vtp'.
|
||||
[2024-02-27 17:07:01.558] [warning] Couldn't find file 'tibia_r.vtp'.
|
||||
[2024-02-27 17:07:01.558] [warning] Couldn't find file 'fibula_r.vtp'.
|
||||
[2024-02-27 17:07:01.559] [warning] Couldn't find file 'talus_rv.vtp'.
|
||||
[2024-02-27 17:07:01.559] [warning] Couldn't find file 'foot.vtp'.
|
||||
[2024-02-27 17:07:01.559] [warning] Couldn't find file 'bofoot.vtp'.
|
||||
[2024-02-27 17:07:01.559] [warning] Couldn't find file 'femur_l.vtp'.
|
||||
[2024-02-27 17:07:01.559] [warning] Couldn't find file 'l_patella.vtp'.
|
||||
[2024-02-27 17:07:01.559] [warning] Couldn't find file 'tibia_l.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'fibula_l.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'talus_lv.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'l_foot.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'l_bofoot.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'lumbar5.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'lumbar4.vtp'.
|
||||
[2024-02-27 17:07:01.560] [warning] Couldn't find file 'lumbar3.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'lumbar2.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'lumbar1.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'cerv1sm.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'cerv2sm.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'cerv3sm.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'cerv4sm.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'cerv5sm.vtp'.
|
||||
[2024-02-27 17:07:01.561] [warning] Couldn't find file 'cerv6sm.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'cerv7.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic12_s.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic11_s.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic10_s.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic9_s.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic8_s.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic7_s.vtp'.
|
||||
[2024-02-27 17:07:01.562] [warning] Couldn't find file 'thoracic6_s.vtp'.
|
||||
[2024-02-27 17:07:01.563] [warning] Couldn't find file 'thoracic5_s.vtp'.
|
||||
[2024-02-27 17:07:01.563] [warning] Couldn't find file 'thoracic4_s.vtp'.
|
||||
[2024-02-27 17:07:01.563] [warning] Couldn't find file 'thoracic3_s.vtp'.
|
||||
[2024-02-27 17:07:01.563] [warning] Couldn't find file 'thoracic2_s.vtp'.
|
||||
[2024-02-27 17:07:01.563] [warning] Couldn't find file 'thoracic1_s.vtp'.
|
||||
[2024-02-27 17:07:01.563] [warning] Couldn't find file 'hat_ribs_scap.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'hat_jaw.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'hat_skull.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'humerus_rv.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'ulna_rv.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'radius_rv.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'pisiform_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.564] [warning] Couldn't find file 'lunate_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'scaphoid_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'triquetrum_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'hamate_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'capitate_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'trapezoid_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'trapezium_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'metacarpal2_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'index_proximal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.565] [warning] Couldn't find file 'index_medial_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'index_distal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'metacarpal3_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'middle_proximal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'middle_medial_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'middle_distal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'metacarpal4_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'ring_proximal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.566] [warning] Couldn't find file 'ring_medial_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'ring_distal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'metacarpal5_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'little_proximal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'little_medial_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'little_distal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'metacarpal1_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'thumb_proximal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'thumb_distal_rvs.vtp'.
|
||||
[2024-02-27 17:07:01.567] [warning] Couldn't find file 'humerus_lv.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'ulna_lv.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'radius_lv.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'pisiform_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'lunate_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'scaphoid_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'triquetrum_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.568] [warning] Couldn't find file 'hamate_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'capitate_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'trapezoid_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'trapezium_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'metacarpal2_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'index_proximal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'index_medial_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'index_distal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'metacarpal3_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.569] [warning] Couldn't find file 'middle_proximal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'middle_medial_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'middle_distal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'metacarpal4_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'ring_proximal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'ring_medial_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'ring_distal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'metacarpal5_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'little_proximal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.570] [warning] Couldn't find file 'little_medial_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.571] [warning] Couldn't find file 'little_distal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.571] [warning] Couldn't find file 'metacarpal1_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.571] [warning] Couldn't find file 'thumb_proximal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.571] [warning] Couldn't find file 'thumb_distal_lvs.vtp'.
|
||||
[2024-02-27 17:07:01.823] [warning] Coordinate.setValue: coordinate pro_sup_r is locked. Unable to change its value.
|
||||
[2024-02-27 17:07:01.894] [warning] Coordinate.setValue: coordinate pro_sup_l is locked. Unable to change its value.
|
||||
[2024-02-27 22:25:04.903] [info] Loaded model Pose2Sim_scaled-scaled from file D:\softs\github_david\Openpose-to-Opensim\Pose_from_simu_draft\Yoga_multi\Model_Pose2Sim_Body25b_scaled_unlocked_small.osim
|
||||
[2024-02-27 22:25:04.904] [warning] Couldn't find file 'r_pelvis.vtp'.
|
||||
[2024-02-27 22:25:04.904] [warning] Couldn't find file 'l_pelvis.vtp'.
|
||||
[2024-02-27 22:25:04.905] [warning] Couldn't find file 'sacrum.vtp'.
|
||||
[2024-02-27 22:25:04.905] [warning] Couldn't find file 'femur_r.vtp'.
|
||||
[2024-02-27 22:25:04.905] [warning] Couldn't find file 'r_patella.vtp'.
|
||||
[2024-02-27 22:25:04.905] [warning] Couldn't find file 'tibia_r.vtp'.
|
||||
[2024-02-27 22:25:04.906] [warning] Couldn't find file 'fibula_r.vtp'.
|
||||
[2024-02-27 22:25:04.906] [warning] Couldn't find file 'talus_rv.vtp'.
|
||||
[2024-02-27 22:25:04.906] [warning] Couldn't find file 'foot.vtp'.
|
||||
[2024-02-27 22:25:04.906] [warning] Couldn't find file 'bofoot.vtp'.
|
||||
[2024-02-27 22:25:04.907] [warning] Couldn't find file 'femur_l.vtp'.
|
||||
[2024-02-27 22:25:04.907] [warning] Couldn't find file 'l_patella.vtp'.
|
||||
[2024-02-27 22:25:04.907] [warning] Couldn't find file 'tibia_l.vtp'.
|
||||
[2024-02-27 22:25:04.907] [warning] Couldn't find file 'fibula_l.vtp'.
|
||||
[2024-02-27 22:25:04.908] [warning] Couldn't find file 'talus_lv.vtp'.
|
||||
[2024-02-27 22:25:04.908] [warning] Couldn't find file 'l_foot.vtp'.
|
||||
[2024-02-27 22:25:04.908] [warning] Couldn't find file 'l_bofoot.vtp'.
|
||||
[2024-02-27 22:25:04.908] [warning] Couldn't find file 'lumbar5.vtp'.
|
||||
[2024-02-27 22:25:04.908] [warning] Couldn't find file 'lumbar4.vtp'.
|
||||
[2024-02-27 22:25:04.909] [warning] Couldn't find file 'lumbar3.vtp'.
|
||||
[2024-02-27 22:25:04.909] [warning] Couldn't find file 'lumbar2.vtp'.
|
||||
[2024-02-27 22:25:04.909] [warning] Couldn't find file 'lumbar1.vtp'.
|
||||
[2024-02-27 22:25:04.909] [warning] Couldn't find file 'cerv1sm.vtp'.
|
||||
[2024-02-27 22:25:04.910] [warning] Couldn't find file 'cerv2sm.vtp'.
|
||||
[2024-02-27 22:25:04.910] [warning] Couldn't find file 'cerv3sm.vtp'.
|
||||
[2024-02-27 22:25:04.910] [warning] Couldn't find file 'cerv4sm.vtp'.
|
||||
[2024-02-27 22:25:04.910] [warning] Couldn't find file 'cerv5sm.vtp'.
|
||||
[2024-02-27 22:25:04.910] [warning] Couldn't find file 'cerv6sm.vtp'.
|
||||
[2024-02-27 22:25:04.911] [warning] Couldn't find file 'cerv7.vtp'.
|
||||
[2024-02-27 22:25:04.911] [warning] Couldn't find file 'thoracic12_s.vtp'.
|
||||
[2024-02-27 22:25:04.911] [warning] Couldn't find file 'thoracic11_s.vtp'.
|
||||
[2024-02-27 22:25:04.911] [warning] Couldn't find file 'thoracic10_s.vtp'.
|
||||
[2024-02-27 22:25:04.911] [warning] Couldn't find file 'thoracic9_s.vtp'.
|
||||
[2024-02-27 22:25:04.912] [warning] Couldn't find file 'thoracic8_s.vtp'.
|
||||
[2024-02-27 22:25:04.912] [warning] Couldn't find file 'thoracic7_s.vtp'.
|
||||
[2024-02-27 22:25:04.912] [warning] Couldn't find file 'thoracic6_s.vtp'.
|
||||
[2024-02-27 22:25:04.912] [warning] Couldn't find file 'thoracic5_s.vtp'.
|
||||
[2024-02-27 22:25:04.912] [warning] Couldn't find file 'thoracic4_s.vtp'.
|
||||
[2024-02-27 22:25:04.913] [warning] Couldn't find file 'thoracic3_s.vtp'.
|
||||
[2024-02-27 22:25:04.913] [warning] Couldn't find file 'thoracic2_s.vtp'.
|
||||
[2024-02-27 22:25:04.913] [warning] Couldn't find file 'thoracic1_s.vtp'.
|
||||
[2024-02-27 22:25:04.913] [warning] Couldn't find file 'hat_ribs_scap.vtp'.
|
||||
[2024-02-27 22:25:04.913] [warning] Couldn't find file 'hat_jaw.vtp'.
|
||||
[2024-02-27 22:25:04.913] [warning] Couldn't find file 'hat_skull.vtp'.
|
||||
[2024-02-27 22:25:04.914] [warning] Couldn't find file 'humerus_rv.vtp'.
|
||||
[2024-02-27 22:25:04.914] [warning] Couldn't find file 'ulna_rv.vtp'.
|
||||
[2024-02-27 22:25:04.914] [warning] Couldn't find file 'radius_rv.vtp'.
|
||||
[2024-02-27 22:25:04.914] [warning] Couldn't find file 'pisiform_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.914] [warning] Couldn't find file 'lunate_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.914] [warning] Couldn't find file 'scaphoid_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.915] [warning] Couldn't find file 'triquetrum_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.915] [warning] Couldn't find file 'hamate_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.915] [warning] Couldn't find file 'capitate_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.915] [warning] Couldn't find file 'trapezoid_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.915] [warning] Couldn't find file 'trapezium_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.916] [warning] Couldn't find file 'metacarpal2_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.916] [warning] Couldn't find file 'index_proximal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.916] [warning] Couldn't find file 'index_medial_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.916] [warning] Couldn't find file 'index_distal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.916] [warning] Couldn't find file 'metacarpal3_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'middle_proximal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'middle_medial_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'middle_distal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'metacarpal4_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'ring_proximal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'ring_medial_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'ring_distal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.917] [warning] Couldn't find file 'metacarpal5_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'little_proximal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'little_medial_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'little_distal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'metacarpal1_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'thumb_proximal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'thumb_distal_rvs.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'humerus_lv.vtp'.
|
||||
[2024-02-27 22:25:04.918] [warning] Couldn't find file 'ulna_lv.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'radius_lv.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'pisiform_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'lunate_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'scaphoid_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'triquetrum_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'hamate_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'capitate_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.919] [warning] Couldn't find file 'trapezoid_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'trapezium_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'metacarpal2_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'index_proximal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'index_medial_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'index_distal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'metacarpal3_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.920] [warning] Couldn't find file 'middle_proximal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.921] [warning] Couldn't find file 'middle_medial_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.921] [warning] Couldn't find file 'middle_distal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.921] [warning] Couldn't find file 'metacarpal4_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.921] [warning] Couldn't find file 'ring_proximal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.921] [warning] Couldn't find file 'ring_medial_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.921] [warning] Couldn't find file 'ring_distal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.922] [warning] Couldn't find file 'metacarpal5_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.922] [warning] Couldn't find file 'little_proximal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.922] [warning] Couldn't find file 'little_medial_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.922] [warning] Couldn't find file 'little_distal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.922] [warning] Couldn't find file 'metacarpal1_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.923] [warning] Couldn't find file 'thumb_proximal_lvs.vtp'.
|
||||
[2024-02-27 22:25:04.923] [warning] Couldn't find file 'thumb_distal_lvs.vtp'.
|
||||
[2024-02-27 22:25:05.163] [warning] Coordinate.setValue: coordinate pro_sup_r is locked. Unable to change its value.
|
||||
[2024-02-27 22:25:05.229] [warning] Coordinate.setValue: coordinate pro_sup_l is locked. Unable to change its value.
|
168
Pose2Sim/Utilities/trc_from_easymocap.py
Normal file
168
Pose2Sim/Utilities/trc_from_easymocap.py
Normal file
@ -0,0 +1,168 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
'''
|
||||
#####################################################
|
||||
## Convert EasyMocap results to TRC ##
|
||||
#####################################################
|
||||
|
||||
Converts EasyMocap keypoints3D results to TRC files.
|
||||
If several people are detected, writes one TRC file per person.
|
||||
|
||||
N.B.: If you run EasyMocap with a different model, edit KEYPOINT_NAMES
|
||||
accordingly (names and order of keypoints).
|
||||
|
||||
N.B.: EasyMocap currently attributes even IDs to the detected people,
|
||||
so the trc files with odd numbers may be empty. Left this way for it
|
||||
to still work the day they fix it.
|
||||
|
||||
N.B.: Trc framerate is set to 1 by default.
|
||||
|
||||
Usage:
|
||||
python -m trc_from_easymocap -i input_keypoint_dir
|
||||
python -m trc_from_easymocap -i input_keypoint_dir -o output_trc_dir
|
||||
import trc_from_easymocap; trc_from_easymocap.trc_from_easymocap_func(input_keypoint_dir=r'<input_keypoint_dir>', output_trc_dir=r'<output_trc_dir>')
|
||||
'''
|
||||
|
||||
|
||||
## CONSTANTS
|
||||
KEYPOINT_NAMES = ['Nose', 'Neck','RShoulder','RElbow','RWrist','LShoulder','LElbow','LWrist','CHip','RHip','RKnee','RAnkle','LHip','LKnee','LAnkle','REye','LEye','REar','LEar','LBigToe','LSmallToe','LHeel','RBigToe','RSmallToe','RHeel']
|
||||
|
||||
|
||||
## INIT
|
||||
import argparse
|
||||
import os
|
||||
import glob
|
||||
import json
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
## AUTHORSHIP INFORMATION
|
||||
__author__ = "David Pagnon"
|
||||
__copyright__ = "Copyright 2021, Pose2Sim"
|
||||
__credits__ = ["David Pagnon"]
|
||||
__license__ = "BSD 3-Clause License"
|
||||
__version__ = '0.7.2'
|
||||
__maintainer__ = "David Pagnon"
|
||||
__email__ = "contact@david-pagnon.com"
|
||||
__status__ = "Development"
|
||||
|
||||
|
||||
## FUNCTIONS
|
||||
def zup2yup(Q):
|
||||
'''
|
||||
X->Y, Y->Z, Z->X
|
||||
'''
|
||||
|
||||
cols = list(Q.columns)
|
||||
cols = np.array([[cols[i*3+1],cols[i*3+2],cols[i*3]] for i in range(int(len(cols)/3))]).flatten()
|
||||
Q = Q[cols]
|
||||
return Q
|
||||
|
||||
|
||||
def max_persons(keypoint_files):
|
||||
'''
|
||||
Max number of persons in easymocap results
|
||||
'''
|
||||
|
||||
max_id = 0
|
||||
for f in keypoint_files:
|
||||
with open(f, 'r') as json_f:
|
||||
js = json.load(json_f)
|
||||
for p in js:
|
||||
if p['id'] > max_id:
|
||||
max_id = p['id']
|
||||
max_id += 1
|
||||
return max_id
|
||||
|
||||
|
||||
def df_from_easymocap(keypoint_files, max_id):
|
||||
'''
|
||||
Stores keypoint_files data in a list of dataframes with the IDs given by EasyMocap.
|
||||
'''
|
||||
|
||||
Q = [[] for n in range(max_id)]
|
||||
for f in keypoint_files:
|
||||
with open(f, 'r') as json_f:
|
||||
js = json.load(json_f)
|
||||
idx_persons_in_frame = [p['id'] for p in js]
|
||||
for idx in range(max_id):
|
||||
if idx in idx_persons_in_frame:
|
||||
x = [p['id'] for p in js].index(idx)
|
||||
keypoints3d_frame = np.array(js[x]['keypoints3d'])[:, :3].flatten().tolist()
|
||||
else:
|
||||
keypoints3d_frame = [np.nan]*len(KEYPOINT_NAMES)*3
|
||||
Q[idx].append(keypoints3d_frame)
|
||||
Q_df = [pd.DataFrame(Q[idx]) for idx in range(max_id)]
|
||||
return Q_df
|
||||
|
||||
|
||||
def write_trc(Q_df, output_trc_dir, trc_root_name):
|
||||
'''
|
||||
Writes a list of dataframes in a directory with a given root name.
|
||||
'''
|
||||
|
||||
for idx, Q in enumerate(Q_df):
|
||||
DataRate = CameraRate = OrigDataRate = 1
|
||||
NumFrames = len(Q)
|
||||
NumMarkers = len(KEYPOINT_NAMES)
|
||||
header_trc = ['PathFileType\t4\t(X/Y/Z)\t'+trc_root_name+str(idx),
|
||||
'DataRate\tCameraRate\tNumFrames\tNumMarkers\tUnits\tOrigDataRate\tOrigDataStartFrame\tOrigNumFrames',
|
||||
'\t'.join(map(str,[DataRate, CameraRate, NumFrames, NumMarkers, 'm', OrigDataRate, 0, NumFrames])),
|
||||
'Frame#\tTime\t' + '\t\t\t'.join(KEYPOINT_NAMES) + '\t\t',
|
||||
'\t\t'+'\t'.join([f'X{i+1}\tY{i+1}\tZ{i+1}' for i in range(len(KEYPOINT_NAMES))])]
|
||||
|
||||
Q = zup2yup(Q_df[idx])
|
||||
Q.index = np.array(range(NumFrames)) + 1
|
||||
Q.insert(0, 't', Q.index / DataRate)
|
||||
|
||||
trc_path = os.path.realpath(os.path.join(output_trc_dir, trc_root_name+str(idx)+'.trc'))
|
||||
with open(trc_path, 'w') as trc_o:
|
||||
[trc_o.write(line+'\n') for line in header_trc]
|
||||
Q.to_csv(trc_o, sep='\t', index=True, header=None, lineterminator='\n')
|
||||
|
||||
|
||||
def trc_from_easymocap_func(**kwargs):
|
||||
'''
|
||||
Converts EasyMocap keypoints3D results to TRC files.
|
||||
If several people are detected, writes one TRC file per person.
|
||||
|
||||
N.B.: If you run EasyMocap with a different model, edit KEYPOINT_NAMES
|
||||
accordingly (names and order of keypoints).
|
||||
|
||||
N.B.: EasyMocap currently attributes even IDs to the detected people,
|
||||
so the trc files with odd numbers may be empty. Left this way for it
|
||||
to still work the day they fix it.
|
||||
|
||||
N.B.: Trc framerate is set to 1 by default.
|
||||
|
||||
Usage:
|
||||
trc_from_easymocap -i input_keypoint_dir
|
||||
trc_from_easymocap -i input_keypoint_dir -o output_trc_dir
|
||||
import trc_from_easymocap; trc_from_easymocap.trc_from_easymocap_func(input_keypoint_dir=r'<input_keypoint_dir>', output_trc_dir=r'<output_trc_dir>')
|
||||
'''
|
||||
|
||||
input_keypoint_dir = kwargs.get('input_keypoint_dir')
|
||||
output_trc_dir = kwargs.get('output_trc_dir')
|
||||
|
||||
input_keypoint_dir = os.path.abspath(input_keypoint_dir)
|
||||
output_trc_dir = os.path.abspath(output_trc_dir) if output_trc_dir else os.path.dirname(input_keypoint_dir)
|
||||
if not os.path.exists(output_trc_dir): os.makedirs(output_trc_dir)
|
||||
trc_root_name = os.path.basename(os.path.dirname(os.path.dirname(input_keypoint_dir)))
|
||||
|
||||
keypoint_files = sorted(glob.glob(input_keypoint_dir+'/*.json'))
|
||||
max_id = max_persons(keypoint_files)
|
||||
Q_df = df_from_easymocap(keypoint_files, max_id)
|
||||
write_trc(Q_df, output_trc_dir=output_trc_dir, trc_root_name=trc_root_name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-i', '--input_keypoint_dir', required = True, help='directory on input keypoints3D folder with EasyMocap json files')
|
||||
parser.add_argument('-o', '--output_trc_dir', required = False, help='direction of the gait. If negative, you need to include an equal sign in the argument, eg -d=-Z')
|
||||
|
||||
kwargs = vars(parser.parse_args())
|
||||
trc_from_easymocap_func(**kwargs)
|
||||
|
33
README.md
33
README.md
@ -417,7 +417,12 @@ If you already have a calibration file, set `calibration_type` type to `convert`
|
||||
|
||||
> _**If `multi_person` is set to `false`, the algorithm chooses the person for whom the reprojection error is smallest.\
|
||||
If `multi_person` is set to `true`, it selects all persons with a reprojection error smaller than a threshold, and then associates them across time frames by minimizing the displacement speed.**_ \
|
||||
***N.B.:** Skip this step if only one person is in the field of view.*\
|
||||
***N.B.:** Skip this step if only one person is in the field of view.*
|
||||
|
||||
> ***N.B.:** The **multi-person** algorithm is not very efficient for now. I will try to improve it in the future, but if you are not satisfied with it, you can use [EasyMocap](https://github.com/zju3dv/EasyMocap?tab=readme-ov-file) for that stage.*
|
||||
> - [calib_toml_to_easymocap.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_toml_to_easymocap.py): Convert your Pose2Sim calibration file to the EasyMocap format
|
||||
> - Run EasyMocap
|
||||
> - [trc_from_easymocap.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/trc_from_easymocap.py): Convert EasyMocap results to .trc
|
||||
|
||||
Open an Anaconda prompt or a terminal in a `Session`, `Participant`, or `Trial` folder.\
|
||||
Type `ipython`.
|
||||
@ -558,11 +563,11 @@ Make sure to replace `py38np120` with your Python version (3.8 in this case) and
|
||||
</br>
|
||||
|
||||
# Utilities
|
||||
A list of standalone tools (see [Utilities](https://github.com/perfanalytics/pose2sim/tree/main/Pose2Sim/Utilities)), which can be either run as scripts, or imported as functions. Check usage in the docstrings of each Python file. The figure below shows how some of these toolscan be used to further extend Pose2Sim usage.
|
||||
A list of standalone tools (see [Utilities](https://github.com/perfanalytics/pose2sim/tree/main/Pose2Sim/Utilities)), which can be either run as scripts, or imported as functions. Check usage in the docstring of each Python file. The figure below shows how some of these tools can be used to further extend Pose2Sim usage.
|
||||
|
||||
|
||||
<details>
|
||||
<summary><b>Converting calibration files</b> (CLICK TO SHOW)</summary>
|
||||
<summary><b>Converting pose files</b> (CLICK TO SHOW)</summary>
|
||||
<pre>
|
||||
|
||||
[Blazepose_runsave.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/Blazepose_runsave.py)
|
||||
@ -573,6 +578,18 @@ Converts a DeepLabCut (h5) 2D pose estimation file into OpenPose (json) files.
|
||||
|
||||
[AlphaPose_to_OpenPose.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/AlphaPose_to_OpenPose.py)
|
||||
Converts AlphaPose single json file to OpenPose frame-by-frame files.
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Converting calibration files</b> (CLICK TO SHOW)</summary>
|
||||
<pre>
|
||||
|
||||
[calib_toml_to_easymocap.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_toml_to_easymocap.py)
|
||||
Converts an OpenCV .toml calibration file to EasyMocap intrinsic and extrinsic .yml calibration files.
|
||||
|
||||
[calib_easymocap_to_toml.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_easymocap_to_toml.py)
|
||||
Converts EasyMocap intrinsic and extrinsic .yml calibration files to an OpenCV .toml calibration file.
|
||||
|
||||
[calib_from_checkerboard.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_from_checkerboard.py)
|
||||
Calibrates cameras with images or a video of a checkerboard, saves calibration in a Pose2Sim .toml calibration file.
|
||||
@ -584,12 +601,6 @@ Converts a Qualisys .qca.txt calibration file to the Pose2Sim .toml calibration
|
||||
[calib_toml_to_qca.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_toml_to_qca.py)
|
||||
Converts a Pose2Sim .toml calibration file (e.g., from a checkerboard) to a Qualisys .qca.txt calibration file.
|
||||
|
||||
[calib_easymocap_to_toml.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_easymocap_to_toml.py)
|
||||
Converts EasyMocap intrinsic and extrinsic .yml calibration files to an OpenCV .toml calibration file.
|
||||
|
||||
[calib_toml_to_easymocap.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_toml_to_easymocap.py)
|
||||
Converts an OpenCV .toml calibration file to EasyMocap intrinsic and extrinsic .yml calibration files.
|
||||
|
||||
[calib_toml_to_opencap.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/calib_toml_to_opencap.py)
|
||||
Converts an OpenCV .toml calibration file to OpenCap .pickle calibration files.
|
||||
|
||||
@ -617,6 +628,9 @@ Displays X, Y, Z coordinates of each 3D keypoint of a TRC file in a different ma
|
||||
<summary><b>Other trc tools</b> (CLICK TO SHOW)</summary>
|
||||
<pre>
|
||||
|
||||
[trc_from_easymocap.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/trc_from_easymocap.py)
|
||||
Convert EasyMocap results keypoints3d json files to .trc.
|
||||
|
||||
[c3d_to_trc.py](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/c3d_to_trc.py)
|
||||
Converts 3D point data of a .c3d file to a .trc file compatible with OpenSim. No analog data (force plates, emg) nor computed data (angles, powers, etc.) are retrieved.
|
||||
|
||||
@ -777,6 +791,7 @@ You will be proposed a to-do list, but please feel absolutely free to propose yo
|
||||
▢ **Conda package**
|
||||
▢ **Docker image**
|
||||
▢ Run pose estimation and OpenSim from within Pose2Sim
|
||||
▢ Real-time: Run Pose estimation, Person association, Triangulation, Kalman filter, IK frame by frame (instead of running each step for all frames)
|
||||
▢ **Run from command line via click or typer**
|
||||
▢ **Utilities**: Export other data from c3d files into .mot or .sto files (angles, powers, forces, moments, GRF, EMG...)
|
||||
▢ **Utilities**: Create trc_to_c3d.py script
|
||||
|
Loading…
Reference in New Issue
Block a user