Table of Contents

Class AffineFeature2D

Namespace
OpenCvSharp.XFeatures2D
Assembly
OpenCvSharp.dll

Class implementing affine adaptation for keypoints. A Feature2D detector and a Feature2D descriptor extractor are wrapped to augment the detected points with their affine invariant elliptic region, and to compute the feature descriptors on the regions after warping them into circles.

public class AffineFeature2D : Feature2D, IDisposable
Inheritance
AffineFeature2D
Implements
Derived
Inherited Members

Constructors

AffineFeature2D(nint, nint, Action<nint>)

Used by subclasses of the native cv::xfeatures2d::AffineFeature2D hierarchy (e.g. TBMR), which need the elliptic detect/detectAndCompute methods below but are constructed through their own native create()/delete() pair rather than AffineFeature2D::create().

protected AffineFeature2D(nint smartPtr, nint rawPtr, Action<nint> releaseSmartPtr)

Parameters

smartPtr nint
rawPtr nint
releaseSmartPtr Action<nint>

Methods

Create(Feature2D)

Creates an instance where the keypoint detector and descriptor extractor are identical.

public static AffineFeature2D Create(Feature2D keypointDetector)

Parameters

keypointDetector Feature2D

The keypoint detector/descriptor extractor to wrap.

Returns

AffineFeature2D

Create(Feature2D, Feature2D)

Creates an instance wrapping the given keypoint detector and descriptor extractor.

public static AffineFeature2D Create(Feature2D keypointDetector, Feature2D descriptorExtractor)

Parameters

keypointDetector Feature2D

The keypoint detector to wrap.

descriptorExtractor Feature2D

The descriptor extractor to wrap.

Returns

AffineFeature2D

DetectAndComputeElliptic(InputArray, InputArray, OutputArray, bool, IEnumerable<EllipticKeyPoint>?)

Detects keypoints and computes descriptors for their surrounding regions, after warping them into circles.

public EllipticKeyPoint[] DetectAndComputeElliptic(InputArray image, InputArray mask, OutputArray descriptors, bool useProvidedKeypoints = false, IEnumerable<EllipticKeyPoint>? providedKeypoints = null)

Parameters

image InputArray

Image.

mask InputArray

Mask specifying where to look for keypoints (optional).

descriptors OutputArray

Computed descriptors.

useProvidedKeypoints bool

If true, providedKeypoints is used as input instead of running detection.

providedKeypoints IEnumerable<EllipticKeyPoint>

Keypoints to use when useProvidedKeypoints is true.

Returns

EllipticKeyPoint[]

The elliptic keypoints (either newly detected, or the augmented input keypoints when useProvidedKeypoints is true).

Remarks

OpenCV's native calcAffineCovariantDescriptors (opencv_contrib xfeatures2d/src/affine_feature2d.cpp) has been observed to throw an assertion failure when the wrapped descriptor extractor is ORB (a binary/CV_8U descriptor); SIFT-family extractors work correctly.

DetectElliptic(InputArray, InputArray)

Detects keypoints in the image using the wrapped detector and performs affine adaptation to augment them with their elliptic regions.

public EllipticKeyPoint[] DetectElliptic(InputArray image, InputArray mask = default)

Parameters

image InputArray

Image.

mask InputArray

Mask specifying where to look for keypoints (optional).

Returns

EllipticKeyPoint[]

The detected elliptic keypoints.