/// <summary> /// Adapts a detector to partition the source image into a grid and detect points in each cell. /// </summary> /// <param name="detector">Detector that will be adapted</param> /// <param name="maxTotalKeyPoints">Maximum count of keypoints detected on the image. Only the strongest keypoints</param> /// <param name="gridRows">Grid rows count</param> /// <param name="gridCols">Grid column count</param> public GridAdaptedFeatureDetector(IKeyPointDetector detector, int maxTotalKeyPoints, int gridRows, int gridCols) { MaxTotalKeyPoints = maxTotalKeyPoints; GridRows = gridRows; GridCols = gridCols; _ptr = GridAdaptedFeatureDetectorCreate(detector.FeatureDetectorPtr, maxTotalKeyPoints, gridRows, gridCols); }
/// <summary> /// Detect the keypoints from the image /// </summary> /// <param name="detector">The keypoint detector</param> /// <param name="image">The image to extract keypoints from</param> /// <param name="mask">The optional mask, can be null if not needed</param> /// <returns>An array of key points</returns> public static MKeyPoint[] DetectKeyPoints(this IKeyPointDetector detector, Image <Gray, Byte> image, Image <Gray, byte> mask) { using (VectorOfKeyPoint keypoints = detector.DetectKeyPointsRaw(image, mask)) { return(keypoints.ToArray()); } }
/// <summary> /// Adapts a detector to partition the source image into a grid and detect points in each cell. /// </summary> /// <param name="detector">Detector that will be adapted</param> /// <param name="maxTotalKeyPoints">Maximum count of keypoints detected on the image. Only the strongest keypoints</param> /// <param name="gridRows">Grid rows count</param> /// <param name="gridCols">Grid column count</param> public GridAdaptedFeatureDetector(IKeyPointDetector detector, int maxTotalKeyPoints, int gridRows, int gridCols) { MaxTotalKeyPoints = maxTotalKeyPoints; GridRows = gridRows; GridCols = gridCols; _ptr = CvInvoke.GridAdaptedFeatureDetectorCreate(detector.FeatureDetectorPtr, maxTotalKeyPoints, gridRows, gridCols); }
/// <summary> /// Detect the keypoints in the image /// </summary> /// <param name="detector">The keypoint detector</param> /// <param name="image">The image from which the key point will be detected from</param> /// <param name="mask">The optional mask, can be null if not needed</param> /// <returns>The key pionts in the image</returns> public static VectorOfKeyPoint DetectKeyPointsRaw(this IKeyPointDetector detector, Image <Gray, Byte> image, Image <Gray, Byte> mask) { VectorOfKeyPoint kpts = new VectorOfKeyPoint(); CvInvoke.CvFeatureDetectorDetectKeyPoints(detector.FeatureDetectorPtr, image, mask, kpts); return(kpts); }