/// <summary> /// Detect keypoints in an image and compute the descriptors on the image from the keypoint locations. /// </summary> /// <param name="image">The image</param> /// <param name="mask">The optional mask, can be null if not needed</param> /// <param name="keyPoints">The detected keypoints will be stored in this vector</param> /// <param name="descriptors">The descriptors from the keypoints</param> /// <param name="useProvidedKeyPoints">If true, the method will skip the detection phase and will compute descriptors for the provided keypoints</param> public void DetectAndCompute(IInputArray image, IInputArray mask, VectorOfKeyPoint keyPoints, IOutputArray descriptors, bool useProvidedKeyPoints) { using (InputArray iaImage = image.GetInputArray()) using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray()) using (OutputArray oaDescriptors = descriptors.GetOutputArray()) Feature2DInvoke.CvFeature2DDetectAndCompute(_ptr, iaImage, iaMask, keyPoints, oaDescriptors, useProvidedKeyPoints); }
/// <summary> /// Detect the features in the image /// </summary> /// <param name="keypoints">The result vector of keypoints</param> /// <param name="image">The image from which the features will be detected from</param> /// <param name="mask">The optional mask.</param> public void DetectRaw(IInputArray image, VectorOfKeyPoint keypoints, IInputArray mask = null) { using (InputArray iaImage = image.GetInputArray()) using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray()) Feature2DInvoke.CvFeature2DDetect(_feature2D, iaImage, keypoints.Ptr, iaMask); }
/* * /// <summary> * /// Compute the descriptor given the image and the point location * /// </summary> * /// <param name="extractor">The descriptor extractor</param> * /// <param name="image">The image where the descriptor will be computed from</param> * /// <param name="keyPoints">The keypoint where the descriptor will be computed from</param> * /// <returns>The descriptors founded on the keypoint location</returns> * public static ImageFeature<TDescriptor>[] Compute<TColor, TDescriptor>(this IDescriptorExtractor<TColor, TDescriptor> extractor, Image<TColor, Byte> image, MKeyPoint[] keyPoints) * where TColor : struct, IColor * where TDescriptor : struct * { * if (keyPoints.Length == 0) return new ImageFeature<TDescriptor>[0]; * using (VectorOfKeyPoint kpts = new VectorOfKeyPoint()) * { * kpts.Push(keyPoints); * using (Matrix<TDescriptor> descriptor = extractor.Compute(image, kpts)) * { * return ImageFeature<TDescriptor>.ConvertFromRaw(kpts, descriptor); * } * } * }*/ /// <summary> /// Compute the descriptors on the image from the given keypoint locations. /// </summary> /// <param name="image">The image to compute descriptors from</param> /// <param name="keyPoints">The keypoints where the descriptor computation is perfromed</param> /// <param name="descriptors">The descriptors from the given keypoints</param> public void Compute(IInputArray image, VectorOfKeyPoint keyPoints, IOutputArray descriptors) { using (InputArray iaImage = image.GetInputArray()) using (OutputArray oaDescriptors = descriptors.GetOutputArray()) Feature2DInvoke.CvFeature2DCompute(_feature2D, iaImage, keyPoints.Ptr, oaDescriptors); }