""" This test program parses oxts .txt files and print transformation """ import pykitti.utils as utils from glob import glob load_dir = '/home/caizhongang/Datasets/kitti/kitti_raw_data/2011_09_26/2011_09_26_drive_0017_sync/oxts/data' if __name__ == '__main__': paths = glob(load_dir + '/*.txt') oxts = utils.load_oxts_packets_and_poses(paths) print(oxts[1])
def _load_oxts(self): """Load OXTS data from file.""" self.oxts = utils.load_oxts_packets_and_poses(self.oxts_files)
def get_oxt_list(self): """Read velodyne [x,y,z,reflectance] scan at the specified index.""" return utils.load_oxts_packets_and_poses(self.oxt_file)
def transform(pc, tf): tf_pc = [] tf = np.array(tf) for p in pc: p = np.array(p[0:3].tolist() + [1.0]) #print(tf, p) tf_p = np.matmul(tf, p) tf_p = tf_p[0:3] / tf_p[3] tf_pc.append(tf_p.tolist()) return tf_pc if __name__ == '__main__': oxts_pathnames = sorted(glob(join(oxts_load_dir, '*.txt'))) oxts_all = utils.load_oxts_packets_and_poses(oxts_pathnames) pc_all = [] oxts_pathnames = oxts_pathnames[:1] for i, oxts_pathname in enumerate(oxts_pathnames): stem, ext = splitext(basename(oxts_pathname)) pc_pathname = join(pc_load_dir, stem+'.bin') pc = utils.load_velo_scan(pc_pathname) oxts = oxts_all[i] #print(type(oxts)) tf = oxts[1] #print(tf) tf_pc = transform(pc, tf)
def _load_oxts(self): """Load OXTS data from file.""" oxt_filename = os.path.join( self.base_path, 'oxts/{}.txt'.format(self.sequence)) self.oxts = utils.load_oxts_packets_and_poses([oxt_filename])