1. 安装对应的驱动与程序包。

图像对应包   http://wiki.ros.org/camera_calibration          在gitbub下载image_pipeline :      https://github.com/ros-perception/image_pipeline

安装对应的驱动

1)uvc_camera          ktossell/camera_umd
                  sudo apt-get install ros-indigo-xxxxx     (      camera_umd     jpeg_streamer  uvc_camera  )

2)usb_cam          http://wiki.ros.org/usb_cam            
bosch-ros-pkg/usb_cam

2. 相机校正的步骤

1)  启动相机  uvc_camera  或者   usb_cam

roslaunch usb_cam camera.launch           (个人的  camera.launch)  rviz 详细文件见后。(也能够自己先打开rviz 加入topic后保存,以后直接调用保存的.rviz就可以)

camera.launch

<launch>
<node pkg="rviz" type="rviz" name="rviz"
args="-d $(find usb_cam)/launch/camera.rviz"/> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" respawn="false" output="log">
<param name="video_device" type="string" value="/dev/video0"/>
<param name="camera_frame_id" type="string" value="usb_cam"/>
<param name="framerate" type="int" value="30"/>
<param name="io_method" type="string" value="mmap"/>
<param name="image_width" type="int" value="640"/>
<param name="image_height" type="int" value="480"/>
<param name="pixel_format" type="string" value="yuyv"/>
</node>
</launch>

2) 启动校正程序

參见教程    http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration

yhzhao@yhzhao:~$ rostopic list
/usb_cam/camera_info
/usb_cam/image_raw ################################
/usb_cam/image_raw/compressed
/usb_cam/image_raw/compressed/parameter_descriptions
/usb_cam/image_raw/compressed/parameter_updates
/usb_cam/image_raw/compressedDepth

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.0245 image:=/usb_cam/image_raw camera:=/camera

出错:例如以下

('Waiting for service', '/camera/set_camera_info', '...')

Service not found

执行例如以下语句: 角点数 棋盘格大小  topic映射

 rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.0245 image:=/usb_cam/image_raw camera:=/camera --no-service-check

注意:校正採集的角点图像要多。数量达到一定效果时,calibration button会变亮,点击就可以进行校正运算。结果在终端有显示,也能够选择保存。

校正输出结果:

('D = ', [-0.1976212648687889, 0.1688022413942262, 0.0124442419926021, 0.005870906198680583, 0.0])
('K = ', [485.5897704187133, 0.0, 297.2537641560215, 0.0, 491.6813624489518, 296.2003190013238, 0.0, 0.0, 1.0])
('R = ', [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0])
('P = ', [462.4408874511719, 0.0, 301.47298442859574, 0.0, 0.0, 469.7864074707031, 301.54598383033044, 0.0, 0.0, 0.0, 1.0, 0.0])
None
# oST version 5.0 parameters [image] width
640 height
480 [narrow_stereo] camera matrix
485.589770 0.000000 297.253764
0.000000 491.681362 296.200319
0.000000 0.000000 1.000000 distortion
-0.197621 0.168802 0.012444 0.005871 0.000000 rectification
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000 projection
462.440887 0.000000 301.472984 0.000000
0.000000 469.786407 301.545984 0.000000
0.000000 0.000000 1.000000 0.000000

3. 启动 ros 相机相应节点公布图像topic

carmera_haved_calibrated.launch

<launch>
<node pkg="rviz" type="rviz" name="rviz"
args="-d $(find usb_cam)/launch/camera.rviz"/> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" respawn="false" output="log">
<param name="video_device" type="string" value="/dev/video0"/>
<param name="camera_frame_id" type="string" value="usb_cam"/>
<param name="io_method" type="string" value="mmap"/>
<param name="image_width" type="int" value="640"/>
<param name="image_height" type="int" value="480"/>
<param name="pixel_format" type="string" value="yuyv"/>
<rosparam param="D">[-0.1976212648687889, 0.1688022413942262, 0.0124442419926021, 0.005870906198680583, 0.0]</rosparam>
<rosparam param="K">[485.5897704187133, 0.0, 297.2537641560215, 0.0, 491.6813624489518, 296.2003190013238, 0.0, 0.0, 1.0]</rosparam>
<rosparam param="R">[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]</rosparam>
<rosparam param="P">[462.4408874511719, 0.0, 301.47298442859574, 0.0, 0.0, 469.7864074707031, 301.54598383033044, 0.0, 0.0, 0.0, 1.0, 0.0]</rosparam>
</node>
</launch>

------------------------------------------------------------附--------------------------------------------------------------------------------------------------------------------------------------

<pre name="code" class="html">$(find usb_cam)/launch/camera.rviz文件

Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded: ~
Splitter Ratio: 0.5
Tree Height: 144
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.588679
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: Image
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.03
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /usb_cam/image_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /slam/raw_flip_image
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /detect_qr/qr_img
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /slam/qrslam/slam_map
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: odom
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Topic: /initialpose
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 15.7352
Enable Stereo Rendering:
Stereo Eye Separation: 0.06
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 0
Y: 0
Z: 0
Name: Current View
Near Clip Distance: 0.01
Pitch: 0.825398
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 1.5604
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 718
Hide Left Dock: false
Hide Right Dock: false
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd00000004000000000000039d00000247fc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006400fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afc000000280000011f000000dd00fffffffa000000010100000002fb0000000a0049006d00610067006502000007ce000001680000073200000279fb000000100044006900730070006c00610079007301000000000000039d0000010f00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d006100670065010000014d000001220000001600ffffff000000010000037600000247fc0200000005fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000028000000b0000000b000fffffffb0000000a0049006d00610067006501000000de000000c60000001600fffffffb0000000a0049006d00610067006501000001aa000000c50000001600fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b2000000000000000000000002000004b0000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073f0000003bfc0100000002fb0000000800540069006d006501000000000000073f000002f600fffffffb0000000800540069006d00650100000000000004500000000000000000000000200000024700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 1855
X: 90
Y: 153

ros下单目相机校正的更多相关文章

  1. 基于OpenCV单目相机的快速标定--源码、工程、实现过程

    相机的标定是所有人走进视觉世界需要做的第一件事,辣么多的视觉标定原理解释你可以随便在网上找到,这里只讲到底如何去实现,也算是给刚入门的朋友做个简单的分享. 1.单目相机标定的工程源码 首先请到同性交友 ...

  2. ROS与深度相机入门教程-在ROS使用kinect v1摄像头

    ROS与深度相机入门教程-在ROS使用kinect v1摄像头 说明: 介绍在ros安装和使用kinect v1摄像头 介绍freenect包 安装驱动 deb安装 $ sudo apt-get in ...

  3. ROS标定IDS相机

    参考 ROS 相机标定http://blog.csdn.net/ArtistA/article/details/51125560 ROS里的标定程序只要使用了OPNCV的标定程序: opencv 相机 ...

  4. matlab单目相机标定——标定步骤以及参数含义

    参考博客园的一篇文章: https://www.cnblogs.com/flyinggod/p/8470407.html#commentform

  5. 双目相机标定以及立体测距原理及OpenCV实现

    单目相机标定的目标是获取相机的内参和外参,内参(1/dx,1/dy,Cx,Cy,f)表征了相机的内部结构参数,外参是相机的旋转矩阵R和平移向量t.内参中dx和dy是相机单个感光单元芯片的长度和宽度,是 ...

  6. ZED 相机 && ORB-SLAM2安装环境配置与ROS下的调试

    注:1. 对某些地方进行了更新(红色标注),以方便进行配置. 2. ZED ROS Wrapper官方github已经更新,根据描述新的Wrapper可能已经不适用与Ros Indigo了,如果大家想 ...

  7. ORB-SLAM2实现(kinect V1/ROS)

    实验室电脑环境ubuntu14.04和ROS indigo已经装好. 1. 构建工作空间[非常重要的一步] mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catki ...

  8. 单目、双目和RGB-D视觉SLAM初始化比较

    无论单目.双目还是RGB-D,首先是将从摄像头或者数据集中读入的图像封装成Frame类型对象: 首先都需要将彩色图像处理成灰度图像,继而将图片封装成帧. (1) 单目 mCurrentFrame = ...

  9. 三维重建:深度相机方案对比-KinectFusion的基本原理(尺度)

    算法原理请参考此文:  kinect fusion 3D重建基本算法  http://log.csdn.net/xiaohu50/article/details/51592503 三维重建为三维空间实 ...

随机推荐

  1. SELinux的Docker安全性

    原文译自:http://opensource.com/business/14/7/docker-security-selinux 这篇文章基于我今年在DockerCon一个讲座,它将讨论我们当前听到的 ...

  2. Python魔法师

    第一章:数据结构和算法 1.1 查找最大或者最小的n个元素 heapq 模块的两个函数 nlargest()  nsmallest() import heapq nums = [1, 8, 2, 23 ...

  3. ["1", "2", "3"].map(parseInt) 结果

    // 下面的语句返回什么呢: ["1", "2", "3"].map(parseInt); // 你可能觉的会是[1, 2, 3] // 但 ...

  4. 用组合取代继承能为 Activity 带来什么

    用组合取代继承能为 Activity 带来什么 原文链接 : Composition over Inheritance,What it means for your Activities 原文作者 : ...

  5. WIN10 当中装BDM驱动

      方法: 禁用第三方签名 将插件替换原有的dll   1.参考此篇文档 http://jingyan.baidu.com/article/375c8e19c2b25b25f2a229a3.html ...

  6. Hbase 认识及其作用

    HBase出现的原因: HBase作为面向列的数据库运行在HDFS之上,HDFS缺乏随即读写操作,HBase正是为此而出现.HBase以Google BigTable为蓝本,以键值对的形式存储.项目的 ...

  7. adb pull adb push

    adb pull:数据从真机到计算机 adb push: 数据从计算机到真机 使用方法: 在android开发环境的sdk--platform tools中安装了adb,在该目录下运行“adb pul ...

  8. 创建标题栏,UINavigationBar的使用

    IOS 开发有关界面的东西不仅可以使用代码来编写,也可以使用Interface Builder可视化工具来编写.今天有个朋友问我这两个有什么区别,首先说说IB ,使用它编辑出来的控件其实底层还是调用代 ...

  9. 正则表达式匹配 href 和text内容

    string pattern = @"<a[^>]*href=(""(?<href>[^""]*)""|' ...

  10. 从两张Excel表所想到的

    从两张Excel表所想到的 前几日,客服妹子发过来几张表,让我给她做下匹配,然后做了,想了,便有了这篇博文,不由感慨,看似简简单单的两张Excel表其实藏着好多东西,记叙如下,与君共勉. 最初的需求: ...