The main task this week was the introduction of ROS as an image source in the application. Now, we can read from video and local camera using OpenCV and from local stream using ROS usb_cam driver.
To use it you need to have usb_cam driver installed (http://wiki.ros.org/usb_cam). For the installation I followed this question on the ROS forum https://answers.ros.org/question/197651/how-to-install-a-driver-like-usb_cam/ . After installing the driver, connect a V4L USB compatible camera (any normal webcam camera should work) and launch the usb_cam node in terminal with:
roslaunch usb_cam.launch
The usb_cam.launch file is available at https://github.com/RoboticsURJC-students/2017-tfm-alexandre-rodriguez/blob/develop/dl_objecttracker/usb_cam.launch
When launched you may see some warnings like:
[ WARN] [1556133267.311291656]: sh: 1: v4l2-ctl: not found
Solved with:
sudo apt-get install v4l-utils
Or some errors like:
VIDIOC_S_FMT error 5, Input/output error
Solved by disconnecting and connecting again the usb camera. Most of them are solved in ROS forums if you need any help.
If you finally ran the node successfully you should be able to see the image topic of the camera /usb_cam/image_raw by typing:
rostopic list
After that, modify the objecttracker.yml and run the objectracker. You will be able to see the ObjectTracker running with your camera using ROS.