ros下单目相机校正
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下单目相机校正的更多相关文章
- 基于OpenCV单目相机的快速标定--源码、工程、实现过程
相机的标定是所有人走进视觉世界需要做的第一件事,辣么多的视觉标定原理解释你可以随便在网上找到,这里只讲到底如何去实现,也算是给刚入门的朋友做个简单的分享. 1.单目相机标定的工程源码 首先请到同性交友 ...
- ROS与深度相机入门教程-在ROS使用kinect v1摄像头
ROS与深度相机入门教程-在ROS使用kinect v1摄像头 说明: 介绍在ros安装和使用kinect v1摄像头 介绍freenect包 安装驱动 deb安装 $ sudo apt-get in ...
- ROS标定IDS相机
参考 ROS 相机标定http://blog.csdn.net/ArtistA/article/details/51125560 ROS里的标定程序只要使用了OPNCV的标定程序: opencv 相机 ...
- matlab单目相机标定——标定步骤以及参数含义
参考博客园的一篇文章: https://www.cnblogs.com/flyinggod/p/8470407.html#commentform
- 双目相机标定以及立体测距原理及OpenCV实现
单目相机标定的目标是获取相机的内参和外参,内参(1/dx,1/dy,Cx,Cy,f)表征了相机的内部结构参数,外参是相机的旋转矩阵R和平移向量t.内参中dx和dy是相机单个感光单元芯片的长度和宽度,是 ...
- ZED 相机 && ORB-SLAM2安装环境配置与ROS下的调试
注:1. 对某些地方进行了更新(红色标注),以方便进行配置. 2. ZED ROS Wrapper官方github已经更新,根据描述新的Wrapper可能已经不适用与Ros Indigo了,如果大家想 ...
- ORB-SLAM2实现(kinect V1/ROS)
实验室电脑环境ubuntu14.04和ROS indigo已经装好. 1. 构建工作空间[非常重要的一步] mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catki ...
- 单目、双目和RGB-D视觉SLAM初始化比较
无论单目.双目还是RGB-D,首先是将从摄像头或者数据集中读入的图像封装成Frame类型对象: 首先都需要将彩色图像处理成灰度图像,继而将图片封装成帧. (1) 单目 mCurrentFrame = ...
- 三维重建:深度相机方案对比-KinectFusion的基本原理(尺度)
算法原理请参考此文: kinect fusion 3D重建基本算法 http://log.csdn.net/xiaohu50/article/details/51592503 三维重建为三维空间实 ...
随机推荐
- jsp中URL传递中文參数的处理
在页面的url中使用encodeURI(encodeURI(中文)).对中文进行编码.并在server的java程序中使用URLDecoder.decode(中文, "UTF-8" ...
- 【MVC5】使用Autofac实现依赖注入
1.安装Autofac 在Package Manager Console执行如下命令: Install-Package AutofacInstall-Package Autofac.Mvc5 2.追加 ...
- PHP结巴程序实现
<?php $str="我...我要要要...学学学..编编程"; $str=preg_replace('/\./','',$str);//我我要要要学学学编编程 $str= ...
- idea新建项目打包 ,运行jar,并放入maven仓库
1.新建项目(转自:http://www.cnblogs.com/wql025/p/5215570.html) 创建一个新Maven项目 new 一个project 不选择任何Maven模板 起个Gr ...
- JavaScript的slice()
JavaScript slice() 方法 JavaScript Array 对象 定义和用法 slice() 方法可从已有的数组中返回选定的元素. 语法 arrayObject.slice(star ...
- TouchSlide - 大话主席
http://www.superslide2.com/TouchSlide/downLoad.html 首 页如何使用查看参数案例演示下载页面交流反馈SuperSlide TouchSlide - ...
- who 查看系统登录用户
who 查看所有登录用户 whoami 查看自己的登陆名 w users last
- linux修改root管理员密码
以root 身份登录(SSH操作) 输入 passwd 命令 就可以看到提示输入新密码了 输入密码的时候是看不到字符的.
- C和C++格式转换
一.引用参数和指针的转换 标准C不支持引用参数,对此需进行转换.下面以bo1-1.cpp和bo1-1.c中DestroyTriplet()函数为例来说明这种转换. bo1-1.cpp中含有引用参数的函 ...
- 配置LANMP环境(10)-- 安装memcached与redis
一.安装memcached 1.安装 yum install memcached 2.设置1G内存 memcached -u memcached -p -m -c -d 3.启动与设置开机自启动 sy ...