Book Image

OpenCV Computer Vision Application Programming Cookbook Second Edition

By : Robert Laganiere
Book Image

OpenCV Computer Vision Application Programming Cookbook Second Edition

By: Robert Laganiere

Overview of this book

Table of Contents (18 chapters)
OpenCV Computer Vision Application Programming Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Detecting corners in an image


When searching for interesting feature points in images, corners come out as an interesting solution. They are indeed local features that can be easily localized in an image, and in addition, they should abound in scenes of man-made objects (where they are produced by walls, doors, windows, tables, and so on). Corners are also interesting because they are two-dimensional features that can be accurately localized (even at sub-pixel accuracy), as they are at the junction of two edges. This is in contrast to points located on a uniform area or on the contour of an object and points that would be difficult to repeatedly localize precisely on other images of the same object. The Harris feature detector is a classical approach to detecting corners in an image. We will explore this operator in this recipe.

How to do it...

The basic OpenCV function that is used to detect Harris corners is called cv::cornerHarris and is straightforward to use. You call it on an input image...