corner_harris

Detects the corners with the Harris corner detector (cv::cornerHarris()).

opencv_apps

1.11.15 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 ~/corners (Point2DArrayStamped), ~/lines (LineArrayStamped), ~/circles (CircleArrayStamped) and ~/contours (ContourArrayStamped, ~/hulls of convex_hull), by the kind of the features

demo of corner_harris

Usage

# ROS 2
ros2 launch opencv_apps corner_harris.launch.xml image:=/camera/image_raw debug_view:=false
# ROS 1
roslaunch opencv_apps corner_harris.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/tos_bridge.mp4
# terminal 1: publish the video as image in a loop
ros2 run image_publisher image_publisher_node tos_bridge.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 corner_harris.launch.xml image:=image threshold:=120
# terminal 3: view the result
ros2 run rqt_image_view rqt_image_view /corner_harris/image

The threshold is lowered from 200 to show more corners.

In ROS 1:

# terminal 1
rosrun image_publisher image_publisher tos_bridge.mp4 _publish_rate:=10 __name:=camera
# terminal 2
roslaunch opencv_apps corner_harris.launch image:=camera/image_raw threshold:=120

See Credits of the demo videos for the license of the video.

Subscribed topics

Topic

Type

image

sensor_msgs/msg/Image

Published topics

Topic

Type

Note

~/corners (recommended)

opencv_apps/msg/Point2DArrayStamped

Recommended, opencv_apps 3.0.1 and later. The corners, a local maximum of the pixels over threshold for each corner.

~/image

sensor_msgs/msg/Image

Parameters

See also the common parameters.

Name

Type

Default (range)

Changed at run time

Description

queue_size

int

3

no, restart the node

Specigy queue_size of input image subscribers

threshold

int

200 (0 - 255)

yes

Threshold of corner.

Source

src/nodelet/corner_harris_nodelet.cpp, launch/corner_harris.launch.xml