["KNU3_A", "KNU3_B", "KNU2_B", "KNU1_A"]): key = "_".join([f, p]) value = "_".join([fID, pID]) TARGET_CONVERTER[key] = value TARGET_INDICES = [ ORIGINAL_KEYPOINT_NAMES.index(TARGET_CONVERTER[k]) for k in DEFAULT_KEYPOINT_NAMES ] assert len(ORIGINAL_KEYPOINT_NAMES) == ORIGINAL_NUM_KEYPOINTS assert len(DEFAULT_KEYPOINT_NAMES) == NUM_KEYPOINTS NAME_CONVERTER = make_keypoint_converter( root="root", fingers=["thumb", "index", "middle", "ring", "little"], parts=["mcp", "pip", "dip", "tip"], ) INDEX_CONVERTER = [ DEFAULT_KEYPOINT_NAMES.index(NAME_CONVERTER[k]) for k in STANDARD_KEYPOINT_NAMES ] KEYPOINT_NAMES = STANDARD_KEYPOINT_NAMES def create_camera_mat(): # These parameters are taken from convert_xyz_to_uvd.m provided by NYU dataset. u0 = 640 / 2 v0 = 480 / 2 fx = 588.036865
DEFAULT_KEYPOINT_NAMES = [ "Wrist", "TMCP", "IMCP", "MMCP", "RMCP", "PMCP", "TPIP", "TDIP", "TTIP", "IPIP", "IDIP", "ITIP", "MPIP", "MDIP", "MTIP", "RPIP", "RDIP", "RTIP", "PPIP", "PDIP", "PTIP" ] COLUMN_NAMES = ["FRAME_ID"] for kname in DEFAULT_KEYPOINT_NAMES: for c in ["X", "Y", "Z"]: cname = "_".join([c, kname]) COLUMN_NAMES.append(cname) assert len(DEFAULT_KEYPOINT_NAMES) == NUM_KEYPOINTS NAME_CONVERTER = make_keypoint_converter( root="Wrist", fingers=["T", "I", "M", "R", "P"], parts=["MCP", "PIP", "DIP", "TIP"], sep="", ) INDEX_CONVERTER = [ DEFAULT_KEYPOINT_NAMES.index(NAME_CONVERTER[k]) for k in STANDARD_KEYPOINT_NAMES ] KEYPOINT_NAMES = STANDARD_KEYPOINT_NAMES def create_camera_matrix(): """ All parameters are taken from https://github.com/guiggh/hand_pose_action """
"M3", "R0", "R1", "R2", "R3", "L0", "L1", "L2", "L3", ] assert len(DEFAULT_KEYPOINT_NAMES) == NUM_KEYPOINTS NAME_CONVERTER = make_keypoint_converter( root="W", fingers=["T", "I", "M", "R", "L"], parts=["0", "1", "2", "3"], sep="", ) INDEX_CONVERTER = [DEFAULT_KEYPOINT_NAMES.index(NAME_CONVERTER[k]) for k in STANDARD_KEYPOINT_NAMES] KEYPOINT_NAMES = STANDARD_KEYPOINT_NAMES def create_camera_mat(): # See README.txt camera_intr = np.array([ [617.173, 0, 315.453], [0, 617.173, 242.259], [0, 0, 1], ])
'F2_KNU1_B', 'F2_KNU2_A', 'F2_KNU3_A', 'TH_KNU1_A', 'TH_KNU1_B', 'TH_KNU2_A', 'TH_KNU3_A', 'PALM_POSITION', # 'PALM_NORMAL' # ignore ] assert len(DEFAULT_KEYPOINT_NAMES) == NUM_KEYPOINTS NAME_CONVERTER = make_keypoint_converter( root="PALM_POSITION", fingers=["TH", "F4", "F3", "F2", "F1"], parts=["KNU1_B", "KNU1_A", "KNU2_A", "KNU3_A"], ) INDEX_CONVERTER = [ DEFAULT_KEYPOINT_NAMES.index(NAME_CONVERTER[k]) for k in STANDARD_KEYPOINT_NAMES ] KEYPOINT_NAMES = STANDARD_KEYPOINT_NAMES def create_camera_mat(): fx = 614.878 fy = 615.479 u0 = 313.219 v0 = 231.288