utils module¶
-
utils.compute_ate(gtruth_xyz, pred_xyz_o)¶
-
utils.compute_errors(gt, pred)¶ Computation of error metrics (abs rel,sq rel, rmse, rmse log) between predicted and ground truth depths From https://github.com/mrharicot/monodepth
- Parameters
gt – an array with the ground truth values
pred – an array with the predicted values
- Returns
the error
- Return type
abs_rel,sq_rel,rmse,rmse_log
-
utils.convert_scale(points, gt_depth)¶ convert the scale of the predictions to the gt
- Parameters
points – the predictions depth
gt_filename – the gt references filename
Returns: the ratio between the predictions and the gt
-
utils.create_dir(directory)¶ Create a directory if not exists :param directory: directory to create
- Returns
None, but it creates a new folder if not exists
-
utils.dump_xyz(source_to_target_transformations)¶
-
utils.evaluate_pose(args)¶ Evaluate odometry on the KITTI dataset
-
utils.get_error(args, filename, points, gt_filename)¶ Get the realtive gt from it’s filename and convert the scale of the predictions in order to compute the error
- Parameters
points – the predictions depth
gt_filename – the gt references filename
- Returns
the error computed on this examples
-
utils.get_error_KITTI(points, gt_filename)¶ Get the realtive gt from it’s filename and convert the scale of the predictions in order to compute the error
- Parameters
points – the predictions depth
gt_filename – the gt references filename
- Returns
the error computed on this examples
-
utils.get_error_TUM(points, gt_filename)¶ Get the realtive gt from it’s filename and convert the scale of the predictions in order to compute the error
- Parameters
points – the predictions depth
gt_filename – the gt references filename
- Returns
the error computed on this examples
-
utils.load_IMU_datas_TUM_VI(path_to_sequence)¶
-
utils.load_images_EuRoC(path_to_sequence)¶ This loader is created for Visual Inertial EuRoC datasets. Format of such datasets is: path_to_sequence/mav0/cam0/+data/xxxx.png
/-times.txt
-
utils.load_images_KITTI(path_to_sequence)¶ Return the sequence of the images found in the path and the corrispondent timestamp
- Parameters
path_to_sequence – the sequence in witch we can found the image sequences
- Returns :
two array : one contains the sequence of the image filename and the second the timestamp in whitch they are acquired
-
utils.load_images_KITTI_VO(path_to_sequence)¶ Return the sequence of the images found in the path and the corrispondent timestamp
- Parameters
path_to_sequence – the sequence in witch we can found the image sequences
- Returns :
two array : one contains the sequence of the image filename and the second the timestamp in whitch they are acquired
-
utils.load_images_OTHERS(path_to_sequence)¶ Return the sequence of the images found in the path and the corrispondent timestamp
- Parameters
path_to_sequence – the sequence in witch we can found the image sequences
- Returns :
two array : one contains the sequence of the image filename and the second the timestamp in whitch they are acquired
- Inside of path_to_sequence must be: +data
xxxxxxxx.png xxxxxxxy.png ….
-times.txt
where times.txt simply contains timestamps of every frame
-
utils.load_images_TUM(path_to_sequence, file_name)¶ Return the sequence of the images found in the path and the corrispondent timestamp
- Parameters
path_to_sequence – the sequence in witch we can found the image sequences
- Returns
one contains the sequence of the image filename and the second the timestamp in whitch they are acquired
- Return type
two array
-
utils.load_images_TUM_VI(path_to_sequence)¶ This loader is created for Visual Inertial TUM datasets. Format of such datasets is: path_to_sequence/mav0/cam0/+data/xxxx.png
/-times.txt
-
utils.read_depth_KITTI(filename)¶ loads depth map D from png file and returns it as a numpy array,
-
utils.read_depth_TUM(filename)¶ loads depth map D from png file and returns it as a numpy array,
-
utils.save_depth(dest, depth)¶ Save depth as 16 bit png file
- Parameters
dest – path to new 16 bit png image wiht depth, w/o exension
depth – depth to save, as ndarray HxW
- Returns
None, but a new 16 bit png image will be saved at dest
-
utils.save_depth_err_results(file_path, filename, err)¶
-
utils.save_pose(dest, pose)¶ Save pose as npy file
- Parameters
dest – path to new npy file wiht pose, w/o exension
pose – ndarray with 4x4 pose matrix (as R|t in homogeneous notation)
- Returns
None, but it creates a new npy file with the pose
-
utils.save_pose_and_times_txt(args, name, pose)¶ Save pose and time in two different txt files.
-
utils.save_pose_txt(args, name, pose)¶ Save pose as txt file
- Parameters
dir – directory of pose.txt
name – frame name or id
pose – ndarray with 4x4 pose matrix (as R|t in homogeneous notation)
- Returns
None, but it creates a new npy file with the pose