Nav2中文网中有一些比较不错的文章,在公众号分享给大家!
本文来自:Nav2中文网教程-http://nav2.fishros.com “Nav2中文网教程” 完整的Nav2文档和教程请访问:http://nav2.fishros.com Nav2交流群:139707339 微信公众号:鱼香ROS
相机标定- 概述
- 必要条件
- 教程指南
本教程演示如何通过标定获取单目相机的参数。
要求1-使用操作系统的包管理器安装相机标定所需软件包
sudo apt install ros--camera-calibration-parsers
sudo apt install ros--camera-info-manager
sudo apt install ros--launch-testing-ament-cmake
2-需要在您的工作空间中从源代码构建Image Pipeline软件包,命令如下:
git clone – b git@github.com:ros-perception/image_pipeline.git
另外,请确保您具有以下内容:
- 一个已知尺寸的大棋盘。本教程使用的是200mm×200mm的正方形棋盘。* * 由于相机标定使用的是棋盘格的内部顶点,因此需要 “8x10” 的棋盘板。这样使用内部顶点参数就正好是 “7x9” 如下例所示.可以从 https://calib.io/pages/camera-calibration-pattern-generator 下载。
- 一个光线充足的5米 × 5米区域,清除障碍物同时检查棋盘图案
- 一个可以在ROS上发布图像的单目相机
1-在GUI中启动一个终端
2-启动所使用相机的ROS驱动程序。
3-确保相机正在通过ROS发布图像。这可以通过运行来测试:
ros2 topic list
4-这将显示你所有发布的话题,确保里面有一个图像话题 /camera/image_raw。确保image_raw话题是一个真实的话题且正在发布图像,需要检查该话题的发布频率:
ros2 topic hz /camera/image_raw
5-启动摄像机标定节点
ros2 run camera_calibration cameracalibrator --size 7x9 --square 0.20 image:=/my_camera/image_raw camera:=/my_camera
Camera Name:
-c, --camera\_name
name of the camera to appear in the calibration file
Chessboard Options:
You must specify one or more chessboards as pairs of --size and--square options.
-p PATTERN, --pattern=PATTERN
calibration pattern to detect - 'chessboard','circles', 'acircles','charuco'
-s SIZE, --size=SIZE
chessboard size as NxM, counting interior corners (e.g. a standard chessboard is 7x7)
-q SQUARE, --square=SQUARE
chessboard square size in meters
ROS Communication Options:
--approximate=APPROXIMATE
allow specified slop (in seconds) when pairing images from unsynchronized stereo cameras
--no-service-check
disable check for set\_camera\_info services at startup
Calibration Optimizer Options:
--fix-principal-point
fix the principal point at the image center
--fix-aspect-ratio
enforce focal lengths (fx, fy) are equal
--zero-tangent-dist
set tangential distortion coefficients (p1, p2) to
zero
-k NUM\_COEFFS, --k-coefficients=NUM\_COEFFS
number of radial distortion coefficients to use (up to
6, default 2)
--disable\_calib\_cb\_fast\_check
uses the CALIB\_CB\_FAST\_CHECK flag for findChessboardCorners
This will open a calibration window which highlight the checkerboard.
6- 为了得到更好的标定结果需要在相机视野范围内不断移动棋盘格:
- 使得棋盘到达相机视野左侧、右侧、顶部和底部 ◦ X-相机视野中的左/右方向 ◦ Y-相机视野中的上下方 ◦ Size -接近/远离相机以及相对相机倾斜
- 棋盘填充整个视野
- 让棋盘格向左、右、上、下倾斜(Skew)
7- 随着棋盘格的不断移动,标定窗口侧边栏上的4个横条的长度会不断增长。当所有4个横条都变成绿色并且有足够的数据可用于标定时,“CALIBRATE”按钮将会变亮。单击查看结果。标定大约需要花一分钟时间。
8-校准完成后,保存和提交按钮亮起。在终端中也可以看到标定结果。
9- 按保存按钮后可以查看到结果。数据保存到 “/tmp/calibrationdata.tar.gz”
10- 要使用该相机标定结果的文件,请执行以下命令解压缩该文件(calibration.tar.gz)
tar -xvf calibration.tar.gz
11- 在标定结果文件夹中,可以看到用于标定的所有图像以及 “ost.yaml” 和 “ost.txt”文件。您可以使用包含相机驱动程序的校准参数的yaml文件。