Skip to content

Commit

Permalink
Merge pull request #73 from michaelnutt2/tracking_calib_fix
Browse files Browse the repository at this point in the history
Fixed error with Tracking calibration loading.
  • Loading branch information
jkelly-stars authored Oct 16, 2023
2 parents 1b10a3a + bf25526 commit de33723
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pykitti/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def _load_calib(self):
data = {}

# Load the calibration file
calib_filepath = os.path.join(self.sequence_path + '.txt', 'calib.txt')
# calib_filepath = os.path.join(self.sequence_path + '.txt', 'calib.txt')
calib_filepath = os.path.join(self.base_path, 'calib', self.sequence + '.txt')
filedata = utils.read_calib_file(calib_filepath)

# Create 3x4 projection matrices
Expand All @@ -152,7 +153,7 @@ def _load_calib(self):
T3[0, 3] = P_rect_30[0, 3] / P_rect_30[0, 0]

# Compute the velodyne to rectified camera coordinate transforms
data['T_cam0_velo'] = np.reshape(filedata['Tr'], (3, 4))
data['T_cam0_velo'] = np.reshape(filedata['Tr_velo_cam'], (3, 4))
data['T_cam0_velo'] = np.vstack([data['T_cam0_velo'], [0, 0, 0, 1]])
data['T_cam1_velo'] = T1.dot(data['T_cam0_velo'])
data['T_cam2_velo'] = T2.dot(data['T_cam0_velo'])
Expand Down
5 changes: 4 additions & 1 deletion pykitti/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ def read_calib_file(filepath):

with open(filepath, 'r') as f:
for line in f.readlines():
key, value = line.split(':', 1)
try:
key, value = line.split(':', 1)
except ValueError:
key, value = line.split(' ', 1)
# The only non-float values in these files are dates, which
# we don't care about anyway
try:
Expand Down

0 comments on commit de33723

Please sign in to comment.