在ROS 使用摄像头 WebCam 完成图像处理(1) -- 获取图像数据

本文档介绍了如何在ROS环境下使用WebCam进行图像处理,包括环境搭建、驱动安装和测试。首先,安装必要的ROS基础包和WebCam驱动。遇到问题后,选择了uvc_camera包替代过时的rbx1_vision。通过运行uvc_camera_node获取图像数据并发布到sensor_msgs/Image主题。最后,通过image_view工具查看并验证图像数据的正确获取。

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

在ROS 使用摄像头 WebCam 完成图像处理(1) -- 获取图像数据

我们要使用摄像头,先要能看到摄像头图像:(见附录)

然后我们这里是参考《ros_by_example》( volume1 hydro )书中的方法。
这里要注意的是:虚拟机里的Ubuntu使用cheese, guvcview这样的工具是可以获取图像的,但ros里提供的摄像头驱动,比如uvc_camera, 就不能很好的工作了。

1. 环境搭建的准备工作

ROS组织发布的基础包

开始之前,安装Prerequisites:(是一些ROS组织发布的基础包)

  -----
$ sudo apt-get install ros-hydro-turtlebot-* \
  ros-hydro-openni-camera ros-hydro-openni-launch \
  ros-hydro-uvc-camera \
  ros-hydro-openni-tracker ros-hydro-laser-* \
  ros-hydro-audio-common ros-hydro-joystick-drivers \
  ros-hydro-orocos-kdl ros-hydro-python-orocos-kdl \
  ros-hydro-dynamixel-motor-* ros-hydro-pocketsphinx \
  gstreamer0.10-pocketsphinx python-setuptools python-rosinstall \
  ros-hydro-opencv2 ros-hydro-vision-opencv \
  ros-hydro-depthimage-to-laserscan ros-hydro-arbotix-* \
  git subversion mercurial

  -----
这里有点洒拦河网的感觉,其实可以只安装这几个:
  $ sudo apt-get install ros-hydro-openni-camera \
  ros-hydro-openni-launch \
  ros-hydro-uvc-camera \
     python-setuptools \
  python-rosinstall \

     ros-hydro-opencv2 \
  ros-hydro-vision-opencv \

    git subversion mercurial

1. Installing Webcam Drivers(OPTIONAL)

To use a typical USB webcam, there are a number of possible driver packages available.
The one we will use here is from Eric Perko's repository. Type the following commands
to move into your personal ROS directory, retrieve the source code, then make the
package:

  $ sudo apt-get install git-core
  $ cd ~/catkin_ws/src
  $ git clone https://github.com/ericperko/uvc_cam.git
  $ cd ~/catkin_ws
  $ catkin_make
  
    Tips:如果你是ROS Electric, Fuerte, or Groovy, 自己看《ros_by_example》( volume1 hydro )书吧。

             如果你是Hydro,要用Git 工具下载 rbx1 代码再生成ROS Packages就像former教程写的一样.


2. 用Git 工具下载 rbx1 代码,生成rbx ros Package
    Commands:
$ cd ~/catkin_ws/src && git clone --depth=1 https://github.com/pirobot/rbx1.git
$ cd rbx1 && git checkout hydro-devel
$ cd ~/catkin_ws && catkin_make
$ source ~/catkin_ws/devel/setup.bash

  -----
   git clone 太慢怎么办 ?  所以我这里使用了 --depth=l 进行浅复制
   以上这几行命令,对于你应该很熟悉了,你是有基础的人。这里我们就用了'ROS By Example' 书提供的包了,All of the 'ROS By Example' packages begin with the letters rbx1。
  ===========
  To list the packages,
  move into the parent of the rbx1 meta-package and use the Linux ls command:
    $ roscd rbx1
    $ cd ..
    $ ls -F

  which should result in the following listing:

  rbx1/
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值