ROS use OpenCV for camera calibration but the format that it stores the data is different than OpenCV. Also, you need to know where to place the camera calibration files so ROS can find it and publish it.
1.First, you need to install usb cam package from ROS and uvcdynctrl to disable autofocus:
1 |
sudo apt-get install ros-kinetic-usb-cam uvcdynctrl |
2.Open a terminal and run roscore:
1 |
roscore |
3. Turn off the autofocus of your camera (if your camera supports autofocus):
check if your camera supports autofocus:
1 |
uvcdynctrl --device=/dev/video0 --clist |
turn off the autofocus:
1 |
uvcdynctrl --device=/dev/video0 --set='Focus, Auto' 0 |
check if the autofocus is off:
1 |
uvcdynctrl --device=/dev/video0 --get='Focus, Auto' |
4. Publish the data from your camera, for example, via use usb_cam:
1 |
rosrun usb_cam usb_cam_node |
5.Connect camera_calibratio to the node publishing camera images: (node and topic name should be adjusted: image:=/usb_cam/image_raw camera:=/usb_cam) and a checkerboard with 0.02517-meter squares:
1 |
rosrun camera_calibration cameracalibrator.py --size 9x6 --square 0.02517 image:=/usb_cam/image_raw camera:=/usb_cam --no-service-check |
6.After getting enough images click on the calibrate and then save. If you click on the commit button if will copy calibration data into:
1 |
/home/<username>/.ros/camera_info/head_camera.yaml |
7. Fix the calibration URL. Put the YAML file in the
1 |
/home/<username>/.ros/camera_info/head_camera.yaml |
[…] my previous tutorial I showed you how to calibrate a camera with ROS. In this tutorial, I’m gonna show you how to […]
[…] my previous tutorial I showed you how to calibrate a camera with ROS. In this tutorial, I’m gonna show you how to […]
There is something wrong with point 7 – the path is the same as in point 6.
Thanks for your comment, I strongly recommend you to watch my other two videos on calibrating a camera so you can grasp the math behind it:
https://ros-developer.com/2018/10/22/camera-calibration-based-on-direct-linear-transform-explained/
https://ros-developer.com/2018/10/23/camera-calibration-based-on-zhangs-algorithm-chess-board-explained/
can you share me the abbreviation ROS and its functionality
… [Trackback]
[…] Read More Infos here: ros-developer.com/2017/04/23/camera-calibration-with-ros/ […]