如何用笔记本自带的摄像头采集图像
大神白巧克力亦唯心博客:
链接: ROS 教程之 vision : 用各种摄像头获取图像.
sudo apt-get install git-core
cd ~/catkin_ws/src #catkin_ws/src对应你自己建立的catkin工作空间
git clone https://github.com/ericperko/uvc_cam.git
rosmake uvc_cam
w²大大博客:
链接: ROS下usb_cam的安装.
cd catkin_ws/src
git clone https://github.com/bosch-ros-pkg/usb_cam.git
cd ..
catkin_make
The devel space at ‘/home/wxh/catkin_ws/devel’ was previously built by ‘catkin build’. Please remove the devel space or pick a different devel space.
解决办法:
catkin clean
catkin init
解决办法1:没有用。。
sudo apt-get install ros-melodic-bfl
解决办法2:
发现问题:No package ‘libv4l2’ found 搜索后
sudo apt-get install libv4l-dev
输入下面语句,ctakin_make成功
catkin clean
catkin init
catkin_make
source ./devel/setup.bash
cd usb_cam
mkdir build
cd build
cmake ..
make
(1)开一个新终端,运行roscore
roscore
(2)在~/catkin_ws/src/usb_cam/launch文件夹下再建一个终端,
运行usb_cam中的launch文件:
roslaunch usb_cam usb_cam-test.launch
Opening streaming device /dev/video0
Cannot identify device by name ‘/dev/video0’ (2)
[ERROR] [1681895427.032392265]: Error starting device
找到解决方案:ROS学习记录001:无法打开笔记本摄像头[ERROR] [1575905480.653251919]: CANNOT IDENTIFY ‘/DEV/VIDEO0’: 2, NO SUCH FILE
link:https://www.freesion.com/article/84131042801/
查看虚拟机设置,果然未勾选,
解决方法:
第一步:关闭学虚拟机,选usb3,勾上蓝色圈圈
第二步:打开虚拟机,虚拟机上能找到摄像头设备,勾选“连接(断开与主机连接)”
出现
点击确定,出现以下提示:
点击确定。
尝试:
再运行测试电脑摄像头的(1)(2)步骤
打开一个新终端,运行roscore,在~/catkin_ws/src/usb_cam/launch文件夹下再建一个终端输入:roslaunch usb_cam usb_cam-test.launch
结果:
。。。直接蓝屏了, 我以为我开太多网页了,然后关闭网页,只开虚拟机再次运行还是不行,又蓝屏了
原因:
VMware16安装教程:https://www.bilibili.com/video/BV1gL4y1H784/?spm_id_from=333.337.search-card.all.click
再次进入launch文件夹,再运行usb_cam中的launch文件,又报错了,不过进步了,摄像头好歹亮起来了,但是没有图像显示。
搜索得到:如果出现报错“sh: 1: v4l2-ctl: not found”则需要安装v4l2
运行:
sudo apt-get install v4l-utils
安装后尝试:
roslaunch usb_cam usb_cam-test.launch device:=/dev/video0
roslaunch usb_cam usb_cam-test.launch
之后发现是在博客:https://blog.csdn.net/heyijia0327/article/details/41623419得到灵感
1、进入launch文件夹,再运行usb_cam中的launch文件:
roslaunch usb_cam usb_cam-test.launch device:=/dev/video0
2、开启一个新终端,输入:
rosrun image_view image_view image:=/usb_cam/image_raw