Turtlebot3-ARM入门教程-抓取挑战之树莓派相机标定
说明
- 本教程介绍如何进行树莓派相机的标定
相机参数设置
- [Remote PC] 远程打开摄像头
$ roslaunch turtlebot3_home_service_challenge_tools turtlebot3_pi_cam_remote.launch
- [Remote PC] 启动
rqt_image_view
工具,在话题框上选择/raspicam_node/image/compressed
或者/raspicam_node/image/
话题
$ rqt_image_view
- [Remote PC] 启动
rqt_reconfigure
工具
$ rosrun rqt_reconfigure rqt_reconfigure
根据实际环境来调整参数,目的是让摄像头获取到更为明亮清晰的图像
[Remote PC] 打开
turtlebot3_home_service_challenge_tools/config/camera_calibration
下的camera.yaml
参数文件,并将调整好的参数替换进去
$ rosed turtlebot3_home_service_challenge_tools camera.yaml
ISO: 400
awb_mode: auto
brightness: 50
contrast: 0
exposureCompensation: 0
exposure_mode: auto
hFlip: false
saturation: 0
sharpness: 0
shutterSpeed: 0
vFlip: false
videoStabilisation: false
zoom: 1.0
相机标定
下载棋盘格标定相片且以A4纸的格式打印出来:棋盘格标定相片下载链接
根据ROSWIKI的camera_calibration教程来进行标定
[Remote PC] 远程启动摄像头
$ roslaunch turtlebot3_home_service_challenge_tools turtlebot3_pi_cam_remote.launch
- [Remote PC] 启动标定程序
$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.024 image:=/raspicam_node/image camera:=/raspicam_node
移动和倾斜棋盘的左,右,上,下和不同的角度得到X,Y,Size和Skew校准数据
当获取足够多的校准数据时,X,Y,Size并且Skew将有一个绿色条
当拥有4个绿色条时,点击
CALIBRATE
- 等待一会后点击
Commit
保存标定数据到树莓派下默认的~/.ros/camera_info
文件中
- [Turtlebot SBC] 打开
~/.ros/camera_info
下的camerav2_1280x720.yaml
文件
$ vim ~/.ros/camera_info/camerav2_1280x720.yaml
- 检查一下获取到的标定数据,其格式类似于一下内容
image_width: 1280
image_height: 720
camera_name: camerav2_1280x720
camera_matrix:
rows: 3
cols: 3
data: [1280.628466572832, 0, 658.384219880362, 0, 1277.989132765768, 360.8363923435625, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [0.2032697817127332, -0.4147569733010375, -0.001420915782245743, 0.003110652248245379, 0]
rectification_matrix:
rows: 3
cols: 3
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
rows: 3
cols: 4
data: [1312.630981445312, 0, 661.4149459665205, 0, 0, 1312.107055664062, 360.0239481801327, 0, 0, 0, 1, 0]
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号