[ROS Tutorial 008] Machine Vision

In the ROS system, the support for machine vision is achieved by adding a camera driver, integrating the OpenCV algorithm library, integrating the tool for coordinate transformation (tf) of the camera optical coordinate system based on the robot position, and a series of third-party tools, including vision measurement. , augmented reality, object detection, and intellisense algorithms.
(1) Connect and run the camera
FireWire camera that is officially supported by the ROS system. Due to the limitations of the experimental conditions, there is no such device, and a USB camera is used for demonstration. There are two main options available for the USB camera driver.
num1 usb_cam
If you want to install usb_cam, you need to run the following command:

$ cd ~/dev/rosbook
$ svn co http://svn.code.sf.net/p/bosch-ros-pkg/code/trunk/stacks/bosch_drivers/usb_cam
$ cd usb_cam
$ rosmake usb_cam

After this run the following command to display the camera data, which itself is the raw image of the USB camera, i.e. in color.

$ roslaunch chapter6_tutorials usb_cam.launch view:=true

write picture description here
Similarly other good options are gscam.
(2) Use OpenCV to make a USB camera driver The
driver is realized by calling the cv::VideoCapture class of OpenCV, which can drive the camera and allow us to modify some of its parameters supported by books. However, in fact it is not possible to use usb_cam to achieve these functions, because CameraInfo messages are not available, so camera_info_url cannot be set in the parameter file params/usb_cam/logitech.yaml. Whereas in gscam we have more control.
There are two main ways to implement camera driver using OpenCV. The first is to poll based on a given number of images per second (FPS), and the second is to be able to set a timer based on the FPS and do the actual reading in the timer's callback function. The main technologies included are to create a USB camera driver function package, use the ImageTransport API to publish camera frames, use cv_bridge for OpenCV and ROS image processing, use ImageTransport to publish images, and use OpenCV in ROS, etc.
The following is the display result of camera_polling.

$ roslaunch chapter6_tutorials camera_polling.launch camera_index:=0 fps:=15 view:=true

write picture description here
(3) Calibration of the camera The calibration performed under the drive of
the USB camera

$ roslaunch chapter6_tutorials camera.launch calibrate:=true

write picture description here
double target

$ sudo apt-get install v4l-utils qv4l2
$ roslaunch chapter6_tutorials camera_stereo.launch view:=true

write picture description here
The effect of my experiment here is not good, and I will study it carefully when I have time.
Visual odometry with viso2
Both ROS Fuerte and Groovy include the current version of viso2, however both versions require the catkin build system. We have introduced the classic compilation system of rosmake. Here we provide detailed instructions for viso2 installed based on catkin. Run the following commands:

$ cd ~
$ mkdir ros
$ cd ros
$ mkdir -p catkin_ws/src
$ cd catkin_ws/src/

References:
[1]. Aaron Martinez Enrique Fern andez, ROS Robot Programming [B], P126-160, 2014.
http://wiki.ros.org/gscam
http://wangsx.cn/?p=604
https ://www.cnblogs.com/Jessica-jie/p/6520061.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325449745&siteId=291194637