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

Method get_keypoints3d

detrsmpl/data/data_structures/smc_reader.py:828–908  ·  view source on GitHub ↗

Get keypoints3d (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

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

Source from the content-addressed store, hash-verified

826 return self.keypoints_created_time
827
828 def get_keypoints3d(self,
829 device=None,
830 device_id=None,
831 frame_id=None,
832 vertical=True):
833 """Get keypoints3d (world coordinate) computed by mocap processing
834 pipeline.
835
836 Args:
837 device (str):
838 Device name, should be Kinect or iPhone.
839 None: world coordinate
840 Defaults to None.
841 device_id (int):
842 ID of a device, starts from 0.
843 None: world coordinate
844 Defaults to None
845 frame_id (int, list or None, optional):
846 int: frame id of one selected frame
847 list: a list of frame id
848 None: all frames will be returned
849 Defaults to None.
850 vertical (bool, optional):
851 Only applicable to iPhone as device
852 iPhone assumes horizontal orientation
853 if True, convert data to vertical orientation
854 Defaults to True.
855
856 Returns:
857 Tuple[np.ndarray, np.ndarray]:
858 keypoints3d (N, J, 4) and its mask (J, )
859 """
860 assert (device is None and device_id is None) or \
861 (device is not None and device_id is not None), \
862 'device and device_id should be both None or both not None.'
863 if device is not None:
864 assert device in {
865 'Kinect', 'iPhone'
866 }, f'Undefined device: {device}, should be "Kinect" or "iPhone"'
867 if device_id is not None:
868 assert device_id >= 0
869
870 if frame_id is None:
871 frame_list = range(self.get_keypoints_num_frames())
872 elif isinstance(frame_id, list):
873 frame_list = frame_id
874 elif isinstance(frame_id, int):
875 assert frame_id < self.get_keypoints_num_frames(),\
876 'Index out of range...'
877 frame_list = [frame_id]
878 else:
879 raise TypeError('frame_id should be int, list or None.')
880
881 kps3d_dict = self.smc['Keypoints3D']
882
883 # keypoints3d are in world coordinate system
884 keypoints3d_world = kps3d_dict['keypoints3d'][...]
885 keypoints3d_world = keypoints3d_world[frame_list, ...]

Callers

nothing calls this directly

Calls 4

get_iphone_extrinsicsMethod · 0.95
concatenateMethod · 0.80

Tested by

no test coverage detected