ROS 2
demo package to illustrate interoperability with OpenCV
.
It was tested with ROS 2 Humble but should also work with other distribution since no tweaks were added to make sure anyone can use it.
This package provides two nodes:
CameraMockerNode
: loading a MPEG4 video with OpenCV and publishing its image inimage_provider
topicDataProcessorNode
: susbscribing toimage_provider
topic and processing received image with OpenCV object detection then publishing processed image inprocessed_image
topic
This package provides a launch file to automatically launch the two nodes described above, one publishing an image to image_provider
and a second subscribing to this topic and as callback performs YOLOv5 object detection with OpenCV dnn then publishes the result in the processed_image
topic.
The animation below illustrate the expected behavior
Go into your ROS2 workspace
cd ~/ros2_ws/src
Clone the repository
git clone https://github.com/BBO-repo/ros2-opencv.git
Return to your workspace folder and rebuild your workspace
cd ~/ros2_ws
colcon build --symlink-install
Source your install/setup.bash
source install/setup.bash
Launch the package launch file
ros2 launch src/ros2-opencv/launch/ros2-opencv.launch.xml rviz_config:=src/ros2-opencv/config/ros2_opencv.rviz yolov5_file_path:=src/ros2-opencv/assets/yolov5s.onnx video_path:=src/ros2-opencv/assets/street-walk.mp4