ROS 摄像头驱动及数据接口
安装启动摄像头
sudo apt-get install ros-melodic-usb-cam
roslaunch usb_cam usb_cam-test.launch
rqt_image_view
摄像头参数的标定
安装标定的功能包
sudo apt-get install ros-melodic-camera-calibration
摄像头标定流程
启动摄像头
roslaunch robot_vision usb_cam.launch
启动标定包
rosrun camera_calibration cameracalibrator.py --size 8x6--square 0.024 image:=/usb_cam/image_raw camera:=/usb_cam
- size:标定棋盘格的内部角点个数,这里使用的棋盘一共有六行,每行有8个内部角点;
- square:这个参数对应每个棋盘格的边长,单位是米;
- image和camera:设置摄像头发布的图像话题。
ROS + OpenCV 图像处理方法及案例
安装 OpenCV
sudo apt-get install ros-melodic-vision-opencv libopencv-dev python-opencv
graph LR
subgraph ROS
handler("CvBridge")-->handler2("ROS Image Message")
handler2("ROS Image Message")-->handler("CvBridge")
end
subgraph OpenCV
start("Opencv ipiimage")-->handler("CvBridge")
handler("CvBridge")-->start("Opencv ipiimage")
end
ROS + OpenCV 最重要的就是 CvBridge 。通过这个将图像进行转化。所有的图像处理都是用opencv去处理的。
imgmsg_to_cv2() : 将 ROS 图像消息转换成 OpenCV 图像数据
cv2_to_imgmsg(): 将 OpenCV格式的图像数据转换成 ROS 图像消息
ROS + Tensorflow 物体识别方法及案例
安装 TensorFlow
sudo apt-get install python-pip python-dev python-virtualenv
virtualenv --system-site-packages ~/tensorflow
source ~/tensorflow/bin/activate
easy_install -U pip
pip install --upgrade tensorflow
安装功能包
cd ~/catkin_ws/src
git clone https://github.com/Kukanani/vision msgs.git
git clone https://github.com/osrf/tensorflow_object_detector.git
物体识别
roslaunch tensorflow_object_detector usb_cam_detector.launch