Feature Detection and Description#

Detailed Description#

Classes#

Name

Description

struct cv::Accumulator

View details

struct cv::Accumulator< char >

View details

struct cv::Accumulator< short >

View details

struct cv::Accumulator< unsigned char >

View details

struct cv::Accumulator< unsigned short >

View details

class cv::AffineFeature

Class for implementing the wrapper which makes detectors and extractors to be affine invariant, described as ASIFT in [349] . View details

class cv::ALIKED

ALIKED feature detector and descriptor extractor. View details

class cv::DISK

DISK feature detector and descriptor, based on a DNN model. View details

class cv::FastFeatureDetector

Wrapping class for feature detection using the FAST method. View details

class cv::Feature2D

Abstract base class for 2D image feature detectors and descriptor extractors. View details

class cv::GFTTDetector

Wrapping class for feature detection using the goodFeaturesToTrack function. : View details

class cv::KeyPointsFilter

A class filters a vector of keypoints. View details

struct cv::L1

View details

struct cv::L2

View details

class cv::MSER

Maximally stable extremal region extractor. View details

class cv::ORB

Class implementing the ORB (oriented BRIEF) keypoint detector and descriptor extractor. View details

class cv::SIFT

Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform (SIFT) algorithm by D. Lowe [194] . View details

class cv::SimpleBlobDetector

Class for extracting blobs from an image. : View details

struct cv::SL2

View details

Typedef Documentation#

AffineDescriptorExtractor#

typedef AffineFeature cv::AffineDescriptorExtractor

#include <opencv2/features.hpp>

AffineFeatureDetector#

typedef AffineFeature cv::AffineFeatureDetector

#include <opencv2/features.hpp>

DescriptorExtractor#

typedef Feature2D cv::DescriptorExtractor

#include <opencv2/features.hpp>

Extractors of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to easily switch between different algorithms solving the same problem. This section is devoted to computing descriptors represented as vectors in a multidimensional space. All objects that implement the vector descriptor extractors inherit the DescriptorExtractor interface.

FeatureDetector#

typedef Feature2D cv::FeatureDetector

#include <opencv2/features.hpp>

Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch between different algorithms solving the same problem. All objects that implement keypoint detectors inherit the FeatureDetector interface.

SiftDescriptorExtractor#

typedef SIFT cv::SiftDescriptorExtractor

#include <opencv2/features.hpp>

SiftFeatureDetector#

typedef SIFT cv::SiftFeatureDetector

#include <opencv2/features.hpp>

Function Documentation#

computeRecallPrecisionCurve()#

void cv::computeRecallPrecisionCurve(
const std::vector< std::vector< DMatch > > & matches1to2,
const std::vector< std::vector< uchar > > & correctMatches1to2Mask,
std::vector< Point2f > & recallPrecisionCurve )

#include <opencv2/features.hpp>

evaluateFeatureDetector()#

void cv::evaluateFeatureDetector(
const Mat & img1,
const Mat & img2,
const Mat & H1to2,
std::vector< KeyPoint > * keypoints1,
std::vector< KeyPoint > * keypoints2,
float & repeatability,
int & correspCount,
const Ptr< FeatureDetector > & fdetector = Ptr< FeatureDetector >() )

#include <opencv2/features.hpp>

FAST()#

void cv::FAST(
InputArray image,
std::vector< KeyPoint > & keypoints,
int threshold,
bool nonmaxSuppression = true,
FastFeatureDetector::DetectorType type = FastFeatureDetector::TYPE_9_16 )

#include <opencv2/features.hpp>

Detects corners using the FAST algorithm.

Detects corners using the FAST algorithm by [253] .

Check the corresponding tutorial for more details.

Parameters

  • image — grayscale image where keypoints (corners) are detected.

  • keypoints — keypoints detected on the image.

  • threshold — threshold on difference between intensity of the central pixel and pixels of a circle around this pixel.

  • nonmaxSuppression — if true, non-maximum suppression is applied to detected keypoints (corners).

  • type — one of the three neighborhoods as defined in the paper: FastFeatureDetector::TYPE_9_16, FastFeatureDetector::TYPE_7_12, FastFeatureDetector::TYPE_5_8

getNearestPoint()#

int cv::getNearestPoint(
const std::vector< Point2f > & recallPrecisionCurve,
float l_precision )

#include <opencv2/features.hpp>

getRecall()#

float cv::getRecall(
const std::vector< Point2f > & recallPrecisionCurve,
float l_precision )

#include <opencv2/features.hpp>

goodFeaturesToTrack()#

void cv::goodFeaturesToTrack(
InputArray image,
OutputArray corners,
int maxCorners,
double qualityLevel,
double minDistance,
InputArray mask,
int blockSize,
int gradientSize,
bool useHarrisDetector = false,
double k = 0.04 )

#include <opencv2/features.hpp>

Python:

cv.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners
cv.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize[, corners[, useHarrisDetector[, k]]]) -> corners
cv.goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask[, corners[, cornersQuality[, blockSize[, gradientSize[, useHarrisDetector[, k]]]]]]) -> corners, cornersQuality

goodFeaturesToTrack()#

void cv::goodFeaturesToTrack(
InputArray image,
OutputArray corners,
int maxCorners,
double qualityLevel,
double minDistance,
InputArray mask,
OutputArray cornersQuality,
int blockSize = 3,
int gradientSize = 3,
bool useHarrisDetector = false,
double k = 0.04 )

#include <opencv2/features.hpp>

Python:

cv.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners
cv.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize[, corners[, useHarrisDetector[, k]]]) -> corners
cv.goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask[, corners[, cornersQuality[, blockSize[, gradientSize[, useHarrisDetector[, k]]]]]]) -> corners, cornersQuality

Same as above, but returns also quality measure of the detected corners.

Parameters

  • image — Input 8-bit or floating-point 32-bit, single-channel image.

  • corners — Output vector of detected corners.

  • maxCorners — Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all detected corners are returned.

  • qualityLevel — Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.

  • minDistance — Minimum possible Euclidean distance between the returned corners.

  • mask — Region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.

  • cornersQuality — Output vector of quality measure of the detected corners.

  • blockSize — Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .

  • gradientSize — Aperture parameter for the Sobel operator used for derivatives computation. See cornerEigenValsAndVecs .

  • useHarrisDetector — Parameter indicating whether to use a Harris detector (see cornerHarris) or cornerMinEigenVal.

  • k — Free parameter of the Harris detector.

goodFeaturesToTrack()#

void cv::goodFeaturesToTrack(
InputArray image,
OutputArray corners,
int maxCorners,
double qualityLevel,
double minDistance,
InputArray mask = noArray(),
int blockSize = 3,
bool useHarrisDetector = false,
double k = 0.04 )

#include <opencv2/features.hpp>

Python:

cv.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners
cv.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize[, corners[, useHarrisDetector[, k]]]) -> corners
cv.goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask[, corners[, cornersQuality[, blockSize[, gradientSize[, useHarrisDetector[, k]]]]]]) -> corners, cornersQuality

Determines strong corners on an image.

The function finds the most prominent corners in the image or in the specified image region, as described in [272]

  • Function calculates the corner quality measure at every source image pixel using the cornerMinEigenVal or cornerHarris .

  • Function performs a non-maximum suppression (the local maximums in 3 x 3 neighborhood are retained).

  • The corners with the minimal eigenvalue less than \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.

  • The remaining corners are sorted by the quality measure in the descending order.

  • Function throws away each corner for which there is a stronger corner at a distance less than maxDistance.

The function can be used to initialize a point-based tracker of an object.

Note

If the function is called with different values A and B of the parameter qualityLevel , and A > B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector with qualityLevel=B .

Parameters

  • image — Input 8-bit or floating-point 32-bit, single-channel image.

  • corners — Output vector of detected corners.

  • maxCorners — Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all detected corners are returned.

  • qualityLevel — Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.

  • minDistance — Minimum possible Euclidean distance between the returned corners.

  • mask — Optional region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.

  • blockSize — Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .

  • useHarrisDetector — Parameter indicating whether to use a Harris detector (see cornerHarris) or cornerMinEigenVal.

  • k — Free parameter of the Harris detector.