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
Methods
Create(Feature2D)
Creates an instance where the keypoint detector and descriptor extractor are identical.
public static AffineFeature2D Create(Feature2D keypointDetector)
Parameters
keypointDetectorFeature2DThe keypoint detector/descriptor extractor to wrap.
Returns
Create(Feature2D, Feature2D)
Creates an instance wrapping the given keypoint detector and descriptor extractor.
public static AffineFeature2D Create(Feature2D keypointDetector, Feature2D descriptorExtractor)
Parameters
keypointDetectorFeature2DThe keypoint detector to wrap.
descriptorExtractorFeature2DThe descriptor extractor to wrap.
Returns
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
imageInputArrayImage.
maskInputArrayMask specifying where to look for keypoints (optional).
descriptorsOutputArrayComputed descriptors.
useProvidedKeypointsboolIf true,
providedKeypointsis used as input instead of running detection.providedKeypointsIEnumerable<EllipticKeyPoint>Keypoints to use when
useProvidedKeypointsis true.
Returns
- EllipticKeyPoint[]
The elliptic keypoints (either newly detected, or the augmented input keypoints when
useProvidedKeypointsis 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
imageInputArrayImage.
maskInputArrayMask specifying where to look for keypoints (optional).
Returns
- EllipticKeyPoint[]
The detected elliptic keypoints.