MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / get_smpl

Method get_smpl

detrsmpl/data/data_structures/smc_reader.py:916–1021  ·  view source on GitHub ↗

Get SMPL (world coordinate) computed by mocap processing pipeline. Args: device (str): Device name, should be Kinect or iPhone. None: world coordinate Defaults to None. device_id (int): ID of a device, s

(self,
                 device=None,
                 device_id=None,
                 frame_id=None,
                 vertical=True)

Source from the content-addressed store, hash-verified

914 return self.smpl_created_time
915
916 def get_smpl(self,
917 device=None,
918 device_id=None,
919 frame_id=None,
920 vertical=True):
921 """Get SMPL (world coordinate) computed by mocap processing pipeline.
922
923 Args:
924 device (str):
925 Device name, should be Kinect or iPhone.
926 None: world coordinate
927 Defaults to None.
928 device_id (int):
929 ID of a device, starts from 0.
930 None: world coordinate
931 Defaults to None
932 frame_id (int, list or None, optional):
933 int: frame id of one selected frame
934 list: a list of frame id
935 None: all frames will be returned
936 Defaults to None.
937 vertical (bool, optional):
938 Only applicable to iPhone as device
939 iPhone assumes horizontal orientation
940 if True, convert data to vertical orientation
941 Defaults to True.
942
943 Returns:
944 dict:
945 'global_orient': np.ndarray of shape (N, 3)
946 'body_pose': np.ndarray of shape (N, 69)
947 'transl': np.ndarray of shape (N, 3)
948 'betas': np.ndarray of shape (N, 10)
949 """
950 smpl_dict = self.smc['SMPL']
951 global_orient = smpl_dict['global_orient'][...]
952 body_pose = smpl_dict['body_pose'][...]
953 transl = smpl_dict['transl'][...]
954 betas = smpl_dict['betas'][...]
955
956 if frame_id is None:
957 frame_list = range(self.get_smpl_num_frames())
958 elif isinstance(frame_id, list):
959 frame_list = frame_id
960 elif isinstance(frame_id, int):
961 assert frame_id < self.get_keypoints_num_frames(),\
962 'Index out of range...'
963 frame_list = [frame_id]
964 else:
965 raise TypeError('frame_id should be int, list or None.')
966
967 body_pose = body_pose[frame_list, ...]
968 global_orient = global_orient[frame_list, ...]
969 transl = transl[frame_list, ...]
970
971 # return SMPL parameters in world coordinate system
972 if device is None:
973 smpl_dict = dict(global_orient=global_orient,

Callers

nothing calls this directly

Calls 7

get_smpl_num_framesMethod · 0.95
get_iphone_extrinsicsMethod · 0.95
build_body_modelFunction · 0.90
detachMethod · 0.45

Tested by

no test coverage detected