hough_circles
Detects the circles with the Hough transform (cv::HoughCircles()).
opencv_apps |
1.11 and later (ROS 1), 3.0.0 and later (ROS 2) |
|---|---|
ROS |
noetic, ROS One, jazzy, kilted, lyrical and later |
OpenCV |
any version of the distributions |
Group |
Features and shapes, the nodes of which publish |
Usage
# ROS 2
ros2 launch opencv_apps hough_circles.launch.xml image:=/camera/image_raw debug_view:=false
# ROS 1
roslaunch opencv_apps hough_circles.launch image:=/camera/image_raw debug_view:=false
Try it with the demo video
Download the input video of the demo above, publish it as image with image_publisher, and run the node on it, in the terminals:
wget https://ros-perception.github.io/opencv_apps/media/clips/pool_zoom.mp4
# terminal 1: publish the video as image in a loop
ros2 run image_publisher image_publisher_node pool_zoom.mp4 --ros-args -p publish_rate:=10.0 -r image_raw:=image
# terminal 2: run the node with the parameters of the demo
ros2 launch opencv_apps hough_circles.launch.xml image:=image accumulator_threshold:=40.0 canny_threshold:=200.0 max_circle_radius:=60 min_circle_radius:=15
# terminal 3: view the result
ros2 run rqt_image_view rqt_image_view /hough_circles/image
The radius range is tuned for the balls.
In ROS 1:
# terminal 1
rosrun image_publisher image_publisher pool_zoom.mp4 _publish_rate:=10 __name:=camera
# terminal 2
roslaunch opencv_apps hough_circles.launch image:=camera/image_raw accumulator_threshold:=40.0 canny_threshold:=200.0 max_circle_radius:=60 min_circle_radius:=15
See Credits of the demo videos for the license of the video.
Subscribed topics
Topic |
Type |
|---|---|
|
|
Published topics
Topic |
Type |
|---|---|
|
|
|
|
|
|
Parameters
See also the common parameters.
Name |
Type |
Default (range) |
Changed at run time |
Description |
|---|---|---|---|---|
|
double |
50.0 (1 - 200) |
yes |
Accumulator threshold |
|
double |
200.0 (1 - 255) |
yes |
Canny threshold |
|
int |
0 (0 - 2) |
yes |
Select image type for debug output, 0: Input, 1: Blur, 2: Canny |
|
double |
2.0 (0 - 100) |
yes |
dp |
|
int |
9 (1 - 30) |
yes |
the size of gaussian blur (should be odd number) |
|
double |
2.0 (1 - 10) |
yes |
sigma x of gaussian kernel |
|
double |
2.0 (1 - 10) |
yes |
sigma y of gaussian kernel |
|
int |
0 (0 - 2000) |
yes |
the maximum size of the circle |
|
int |
0 (0 - 500) |
yes |
the minimum size of the circle |
|
double |
0.0 (0 - 1024) |
yes |
mnimum distance between the centers of the detected circles |
|
int |
3 |
no, restart the node |
Specigy queue_size of input image subscribers |
Source
src/nodelet/hough_circles_nodelet.cpp, launch/hough_circles.launch.xml