ros打开笔记本摄像头,单目标定

本文详细介绍如何在ROS环境中配置USB摄像头,包括安装驱动、调整端口、读取视频及保存图片序列。此外,还提供了使用张正友标定法进行摄像头标定的步骤,涉及标定程序的下载、参数设定及结果保存。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

笔记本摄像头多是usb 镜头

下载包或者sudo apt-get install ros-indigo-usb-cam

git clone https://github.com/bosch-ros-pkg/usb_cam.git 

打开驱动

 rosrun usb_cam usb_cam_node

端口为/dev/video0, 如果你外接了usb摄像头,你应该把该端口改成video1,自行从/dev下验证
对应的话题

robot@ubuntu:/dev$ rostopic list
/rosout
/rosout_agg
/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
/usb_cam/image_raw/compressedDepth/parameter_descriptions
/usb_cam/image_raw/compressedDepth/parameter_updates
/usb_cam/image_raw/theora
/usb_cam/image_raw/theora/parameter_descriptions
/usb_cam/image_raw/theora/parameter_updates

读取视频(重映射话题名)

 rosrun image_view image_view image:=/usb_cam/image_raw

保存图片序列,jpg+ini
rosrun image_view image_saver image:=/usb_cam/image_raw

launch

<launch>
  <!-- Arguments -->
  <!-- Show video output (both RAW and rectified) -->
  <arg name="view" default="true"/>
  <!-- Camera driver -->
  <node pkg="usb_cam" type="usb_cam_node" name="camera"/>

  <!-- Show video output -->
  <group if="$(arg view)">
    <!-- Image viewer (non-rectified image) -->
    <node pkg="image_view" type="image_view" name="image_raw">
      <remap from="image" to="usb_cam/image_raw"/>
    </node>
  </group>
</launch>

打开rviz 来看看视频吧
add->image
设置image topic 即可

接下来摄像头的标定
ros提供了单目和双目的标定程序,使用张正友标定法。
http://wiki.ros.org/camera_calibration
下载camera_calibraiton 包
或者rosdep install camera_calibraion

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

–size 表示所使用棋盘格内部的行列角点数量,
–square 表示单个方格的大小,单位m

标定程序使用方法:
为了得到一个好的标定结果,应该使得标定板尽量出现在摄像头视野的各个位置里:
如标定板出现在视野中的左边,右边,上边和下边,标定板既有倾斜的,也有水平的,。
界面中的x:表示标定板在视野中的左右位置。
y:表示标定板在视野中的上下位置。
size:标定板在占视野的尺寸大小,也可以理解为标定板离摄像头的远近。
skew:标定板在视野中的倾斜位置。
并还要有棋盘占住大部分视野的图片,直到calibrate点亮
点击 commit 保存标定结果,保存在~/.ros/camera_info/hea_camera.yaml

camera_calibration_parsers创建yaml参数文件

$ rosrun camera_calibration_parsers convert in-file out-file 

http://blog.youkuaiyun.com/ArtistA/article/details/51125560?locationNum=15&fps=1
参数含义:
image_width、image_height代表图片的长宽
camera_name为摄像头名
camera_matrix规定了摄像头的内部参数矩阵
distortion_model指定了畸变模型
distortion_coefficients指定畸变模型的系数
rectification_matrix为矫正矩阵,一般为单位阵
projection_matrix为外部世界坐标到像平面的投影矩阵

windows打开camera方法

AMCAP

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值