@@ -92,6 +92,7 @@ def convert_range_image_to_point_cloud(frame, range_images, camera_projections,
9292 points_NLZ = []
9393 points_intensity = []
9494 points_elongation = []
95+ extrinsics = []
9596
9697 frame_pose = tf .convert_to_tensor (np .reshape (np .array (frame .pose .transform ), [4 , 4 ]))
9798 # [H, W, 6]
@@ -162,8 +163,9 @@ def convert_range_image_to_point_cloud(frame, range_images, camera_projections,
162163 points_NLZ .append (np .concatenate (points_NLZ_single , axis = 0 ))
163164 points_intensity .append (np .concatenate (points_intensity_single , axis = 0 ))
164165 points_elongation .append (np .concatenate (points_elongation_single , axis = 0 ))
166+ extrinsics .append (extrinsic )
165167
166- return points , cp_points , points_NLZ , points_intensity , points_elongation
168+ return points , cp_points , points_NLZ , points_intensity , points_elongation , extrinsics
167169
168170
169171def save_lidar_points (frame , cur_save_path , use_two_returns = True ):
@@ -174,7 +176,7 @@ def save_lidar_points(frame, cur_save_path, use_two_returns=True):
174176 assert len (ret_outputs ) == 3
175177 range_images , camera_projections , range_image_top_pose = ret_outputs
176178
177- points , cp_points , points_in_NLZ_flag , points_intensity , points_elongation = convert_range_image_to_point_cloud (
179+ points , cp_points , points_in_NLZ_flag , points_intensity , points_elongation , extrinsics = convert_range_image_to_point_cloud (
178180 frame , range_images , camera_projections , range_image_top_pose , ri_index = (0 , 1 ) if use_two_returns else (0 ,)
179181 )
180182
@@ -191,7 +193,7 @@ def save_lidar_points(frame, cur_save_path, use_two_returns=True):
191193
192194 np .save (cur_save_path , save_points )
193195 # print('saving to ', cur_save_path)
194- return num_points_of_each_lidar
196+ return num_points_of_each_lidar , extrinsics
195197
196198
197199def process_single_sequence (sequence_file , save_path , sampled_interval , has_label = True , use_two_returns = True , update_info_only = False ):
@@ -251,11 +253,13 @@ def process_single_sequence(sequence_file, save_path, sampled_interval, has_labe
251253 if update_info_only and sequence_infos_old is not None :
252254 assert info ['frame_id' ] == sequence_infos_old [cnt ]['frame_id' ]
253255 num_points_of_each_lidar = sequence_infos_old [cnt ]['num_points_of_each_lidar' ]
256+ extrinsics = sequence_infos_old [cnt ]['extrinsics' ]
254257 else :
255- num_points_of_each_lidar = save_lidar_points (
258+ num_points_of_each_lidar , extrinsics = save_lidar_points (
256259 frame , cur_save_dir / ('%04d.npy' % cnt ), use_two_returns = use_two_returns
257260 )
258261 info ['num_points_of_each_lidar' ] = num_points_of_each_lidar
262+ info ['extrinsics' ] = extrinsics
259263
260264 sequence_infos .append (info )
261265
0 commit comments