ros-perception/opencv_apps
소개
http://wiki.ros.org/opencv_apps
AI 및 머신러닝What you can do
- corner_harris~/corners - goodfeature_track~/corners - hough_lines~/lines - hough_circles~/circles
- find_contours~/contours - general_contours~/contours - contour_moments~/contours - convex_hull~/hulls
- line_segment_detector~/lines - blob_detection~/circles
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalopencv_apps

opencv_apps provides the ROS nodes that run the functions of OpenCV: image processing,
features, contours, optical flows, tracking, detection and recognition, and the deep learning models of cv::dnn.
Each node subscribes an image topic, and publishes its results as messages and as an image, so you can use the
functions of OpenCV just by running a launch file. The same source supports both ROS 1 and ROS 2.
sudo apt install ros-$ROS_DISTRO-opencv-apps ros-$ROS_DISTRO-image-publisher
# ROS 2, terminal 1: publish the USB camera as image (0: the number of the camera, /dev/video0)
ros2 run image_publisher image_publisher_node 0 --ros-args -r image_raw:=image
# ROS 2, terminal 2: the face detection on it
ros2 launch opencv_apps face_detection.launch.xml image:=image
# ROS 1 (ROS One), terminal 1: publish the USB camera as camera/image_raw (0: /dev/video0)
rosrun image_publisher image_publisher 0 __name:=camera
# ROS 1 (ROS One), terminal 2: the face detection on it
roslaunch opencv_apps face_detection.launch image:=camera/image_raw use_opencv4:=true
Documentation: https://ros-perception.github.io/opencv_apps/ (the topics, the parameters and the usage of the nodes)
Run the dnn nodes on the GPU (CUDA, ROS 2)
The OpenCV of the distributions has no CUDA, so the launch files of the dnn nodes (dnn_*.launch.xml) run the node
in a docker image of OpenCV with CUDA with use_cuda:=true (by scripts/run_in_docker, with the GPUs, the network
and the shared memory of the host, so the other nodes on the host communicate with it as usual). The images are on
the GitHub Container Registry, and pulled at the first use (about 10 GB); the host needs the NVIDIA driver and the
NVIDIA Container Toolkit:
# OpenCV 4.12 with CUDA 12.8 (ghcr.io/ros-perception/opencv_apps:cuda, the default of cuda_image)
ros2 launch opencv_apps dnn_object_detection.launch.xml image:=/camera/image_raw use_cuda:=true
# OpenCV 5.1 with CUDA 13.3; its new engine runs a model on CUDA only if all its layers have CUDA, otherwise on the
# CPU (e.g. YOLOX-S, YuNet and SFace of opencv_zoo with OpenCV 5.1)
ros2 launch opencv_apps dnn_object_detection.launch.xml image:=/camera/image_raw use_cuda:=true \
cuda_image:=ghcr.io/ros-perception/opencv_apps:opencv5-cuda
# or build the image (about an hour), in opencv_apps, with CUDA_ARCH_BIN of your GPU, e.g. 8.9 of RTX 40 series
docker build -f docker/cuda/Dockerfile --build-arg CUDA_ARCH_BIN=8.9 -t opencv_apps:cuda .
ros2 launch opencv_apps dnn_object_detection.launch.xml image:=/camera/image_raw use_cuda:=true cuda_image:=opencv_apps:cuda
The rates of all the models on the CPU and in both images are in the documentation. The rate of ~/detections of dnn_object_detection (YOLOX-S, 640x640) for the images of 640x480 at 100 Hz, on AMD
Ryzen 9 7950X (16 cores) and NVIDIA GeForce RTX 4090:
| OpenCV | backend | Hz | |
|---|---|---|---|
| ROS 2 jazzy (apt) | 4.6 | CPU | 13.3 |
opencv_apps:cuda |
4.12 | CUDA | 55.0 |
opencv_apps:cuda |
4.12 | CPU (backend:=cpu) |
13.4 |
opencv_apps:opencv5-cuda |
5.1 | CPU (falls back from CUDA) | 36.0 |
What opencv_apps can do
The nodes are grouped by what they find, e.g. what the whole image shows (image classification), the bounding boxes of
the objects (object detection) or the regions of the pixels (segmentation). The nodes of a group publish the same kind
of results, mostly the same type of message on the same topic, so that one can replace another, e.g. face_detection
by dnn_face_detection. Each group lists the nodes by the distributions that they run on, and each tile shows the
main output of the node.
Image filters
Filter and transform the images: edges (also by DexiNed), histogram equalization, morphology, image pyramids, smoothing, thresholds, the Fourier transform, and the super resolution and the inpainting by a DNN. Output: the processed image in ~/image.
ROS 1: noetic and later, ROS 2: jazzy and later
adding_images~/image |
discrete_fourier_transform~/image |
edge_detection~/image |
pyramids~/image |
smoothing~/image |
threshold~/image |
ROS 1: ROS One and later, ROS 2: jazzy and later
equalize_histogram~/image |
morphology~/image |
ROS 1 and ROS 2, with OpenCV built from source
dnn_edge_detection~/image |
dnn_super_resolution~/image |
dnn_inpainting~/image |
Features and shapes
Find the corners, the lines and the line segments, the circles and the blobs, and the contours with their bounding shapes, moments and convex hulls. Output: ~/corners (Point2DArrayStamped), ~/lines (LineArrayStamped), ~/circles (CircleArrayStamped) and ~/contours (ContourArrayStamped, ~/hulls of convex_hull), by the kind of the features.
ROS 1: noetic and later, ROS 2: jazzy and later
corner_harris~/corners |
goodfeature_track~/corners |
hough_lines~/lines |
hough_circles~/circles |
find_contours~/contours |
general_contours~/contours |
contour_moments~/contours |
convex_hull~/hulls |
ROS 1: ROS One and later, ROS 2: jazzy and later
line_segment_detector~/lines |
blob_detection~/circles |
Segmentation
Divide the image into regions by the class of each pixel: the pixels in a range of colors, the foreground, the connected regions, the classes of a DNN, and the object given by a box or points. Output: the mask or label image, ~/image of the color filters and background_subtraction, ~/label of dnn_semantic_segmentation, ~/mask of dnn_interactive_segmentation, and ~/contours (ContourArrayStamped) of the regions of segment_objects, watershed_segmentation and dnn_interactive_segmentation.
ROS 1: noetic and later, ROS 2: jazzy and later
hsv_color_filter~/image |
hls_color_filter~/image |
rgb_color_filter~/image |
segment_objects~/contours |
watershed_segmentation~/contours |
ROS 1: ROS One and later, ROS 2: jazzy and later
lab_color_filter~/image |
background_subtraction~/image |
dnn_semantic_segmentation~/label |
ROS 2: lyrical and later
dnn_interactive_segmentation~/mask |
Image classification
Find what the whole image shows, the classes of ImageNet. Output: ~/detections (DetectionArrayStamped), the classes with their scores.
ROS 1: ROS One and later, ROS 2: jazzy and later
dnn_image_classification~/detections |
Object detection
Find the bounding boxes of the people (HOG of people_detect) and the objects (YOLO of dnn_object_detection: YOLOX, YOLOv4 and the other models of cv::dnn), and re-identify the people of ~/detections over the images by their appearance (dnn_person_reid, a post-process of the detections). Output: ~/detections (DetectionArrayStamped), with the id of each person in data for dnn_person_reid.
ROS 1: noetic and later, ROS 2: jazzy and later
people_detect~/detections |
ROS 1: ROS One and later, ROS 2: jazzy and later
dnn_object_detection~/detections |
dnn_person_reid~/detections |
Codes and markers
Find and decode QR codes, barcodes and ArUco markers. Output: ~/detections (DetectionArrayStamped), with the decoded data and the corners.
ROS 1: ROS One and later, ROS 2: jazzy and later
qrcode_detection~/detections |
barcode_detection~/detections |
aruco_detection~/detections |
Text detection and recognition
Find the texts and read them (OCR). Output: ~/detections (DetectionArrayStamped), with the recognized text.
ROS 1: ROS One and later, ROS 2: jazzy and later
dnn_text_detection~/detections |
Faces
Detect and recognize the faces and their expressions. Output: ~/faces (FaceArrayStamped).
ROS 1: noetic and later, ROS 2: jazzy and later
face_detection~/faces |
face_recognition~/faces |
ROS 1: ROS One and later, ROS 2: jazzy and later
dnn_face_detection~/faces |
dnn_face_recognition~/faces |
dnn_facial_expression_recognition~/faces |
Human and hand poses
Estimate the poses of the people and the hands. Output: ~/skeletons (SkeletonArrayStamped).
ROS 2: lyrical and later
dnn_pose_estimation~/skeletons |
dnn_hand_pose_estimation~/skeletons |
Tracking
Track a target given by set_roi or the mouse. Output: ~/output (RectArrayStamped), ~/track_box (RotatedRectStamped) of camshift.
ROS 1: noetic and later, ROS 2: jazzy and later
camshift~/track_box |
ROS 1: ROS One and later, ROS 2: jazzy and later
tracking~/output |
match_template~/output |
dnn_tracking~/output |
Optical flow and motion
Estimate the motion of the image. Output: ~/flows (FlowArrayStamped), ~/shift (Point2DStamped) of phase_corr.
ROS 1: noetic and later, ROS 2: jazzy and later
fback_flow~/flows |
lk_flow~/flows |
simple_flow~/flows |
phase_corr~/shift |
ROS 2: lyrical and later
dnn_optical_flow~/flows |
Histogram comparison
Compare the color histogram of the image with a reference. Output: ~/distance (Float64).
ROS 1: ROS One and later, ROS 2: jazzy and later
compare_histogram~/distance |
Depth and 3D localization
Estimate the depth of a color image by a DNN, and localize the objects, the faces, the tracked targets and the human and hand skeletons of the nodes above in 3D, with a depth image of an RGB-D camera or of the depth estimation, or a point cloud of a LiDAR, and publish their TF frames. Output: ~/inverse_depth or ~/depth (Image) of dnn_depth_estimation, and ~/detections (vision_msgs/Detection3DArray), ~/markers (for rviz) and the TF frames of detection_3d.

ROS 1: ROS One and later, ROS 2: jazzy and later
dnn_depth_estimation~/inverse_depth |
detection_3d~/detections |
Odometry and maps
Estimate the motion of the robot by an RGB-D camera or a LiDAR (e.g. Livox), as the odometry for slam_toolbox (the 2D map) and Nav2 instead of the odometry of the wheels, and build the 3D map and the 3D trajectory. Output: ~/odom (nav_msgs/Odometry), the TF odom -> base_frame, ~/path (nav_msgs/Path) and ~/map (PointCloud2, the 3D map).
ROS 1: ROS One and later, ROS 2: jazzy and later
rgbd_odometry~/odom, ~/map |
laser_odometry~/odom, ~/map |
The demo videos are made of Tears of Steel (CC BY 3.0, Blender Foundation) and the clips of Wikimedia Commons, see the credits.
관련 프로젝트 살펴보기
불러오는 중…