evo_traj的参数设置及保存图片
文章目录
- 1 查看参数配置
- 2 设置参数
- 3 显示运动轨迹
- 4 保存图片
1 查看参数配置
evo_config show
{"console_logging_format": "%(message)s","euler_angle_sequence": "sxyz","global_logfile_enabled": false,"plot_axis_marker_scale": 0.0,"plot_backend": "TkAgg","plot_export_format": "pdf","plot_figsize": [6,6],"plot_fontfamily": "sans-serif","plot_fontscale": 1.0,"plot_invert_xaxis": false,"plot_invert_yaxis": false,"plot_linewidth": 1.5,"plot_mode_default": "xyz","plot_multi_cmap": "none","plot_pose_correspondences": false,"plot_pose_correspondences_linestyle": "dotted","plot_reference_alpha": 0.5,"plot_reference_color": "black","plot_reference_linestyle": "--","plot_seaborn_palette": "deep6","plot_seaborn_style": "darkgrid","plot_split": false,"plot_statistics": ["rmse","median","mean","std","min","max"],"plot_texsystem": "pdflatex","plot_trajectory_alpha": 0.75,"plot_trajectory_cmap": "jet","plot_trajectory_linestyle": "-","plot_usetex": false,"plot_xyz_realistic": true,"ros_map_alpha_value": 1.0,"ros_map_unknown_cell_value": 205,"save_traj_in_zip": false,"table_export_data": "stats","table_export_format": "csv","table_export_transpose": true,"tf_cache_lookup_frequency": 10,"tf_cache_max_time": 10000.0
}
2 设置参数
- 设置线宽:
evo_config set plot_linewidth 2
- 设置字体大小:
evo_config set plot_fontscale 3
- 设置画布大小:
evo_config set plot_figsize 22 16
3 显示运动轨迹
evo_traj tum \ORB-SLAM2.txt \YOLOv3-ORB-SLAM2.txt \OUR.txt \--ref=groundtruth.txt \-as \--plot_mode=xy \-p
4 保存图片
evo_traj tum \ORB-SLAM2.txt \YOLOv3-ORB-SLAM2.txt \OUR.txt \--ref=groundtruth.txt \-as \--plot_mode=xy \--save_plot=./
会报以下错:
[ERROR] Unhandled error in evo.main_traj
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/evo/entry_points.py”, line 98, in launch
main_module.run(args)
File “/usr/local/lib/python2.7/dist-packages/evo/main_traj.py”, line 473, in run
confirm_overwrite=not args.no_warnings)
File “/usr/local/lib/python2.7/dist-packages/evo/tools/plot.py”, line 186, in export
pdf = matplotlib.backends.backend_pdf.PdfPages(file_path)
File “/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py”, line 2472, in init
self._file = PdfFile(filename, metadata=metadata)
File “/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py”, line 438, in init
fh, opened = cbook.to_filehandle(filename, “wb”, return_opened=True)
File “/usr/local/lib/python2.7/dist-packages/matplotlib/cbook/init.py”, line 616, in to_filehandle
fh = io.open(fname, flag, encoding=encoding)
IOError: [Errno 21] Is a directory: ‘./’
[ERROR] evo module evo.main_traj crashed - no logfile written (disabled)
之前一直没仔细看这个报错,导致一直以为evo_traj
是无法保存图片的,于是傻傻手动截图,或者手动占保存按钮一个个保存…从报错的信息中,可以看到,它保存时,调用的是backend_pdf.py
,似乎将图片保存为PDF文件,所以我们将命令改成下面
evo_traj tum \ORB-SLAM2.txt \YOLOv3-ORB-SLAM2.txt \OUR.txt \--ref=groundtruth.txt \-as \--plot_mode=xy \--save_plot=./res.pdf
果然可以正常保存,而且也能正常打开
Plots saved to ./res.pdf
但我们想的是保存图片,而无须再傻傻的手动进行保存或截图。仔细查看它的参数配置,可以看到其中一行配置:
“plot_export_format”: “pdf”,
试着将其改为png
:
evo_config set plot_export_format png
然后执行
evo_traj tum \ORB-SLAM2.txt \YOLOv3-ORB-SLAM2.txt \OUR.txt \--ref=groundtruth.txt \-as \--plot_mode=xy \--save_plot=./res
Plot saved to ./res_trajectories
Plot saved to ./res_xyz_view
Plot saved to ./res_rpy_view
成功的将图片保存到./res
中,这个不大不小的坑就解决了!