diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index ef2d6ecf45..7fb4cabfa1 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -237,6 +237,12 @@ public: //! converts vector of points to the vector of keypoints, where each keypoint is assigned the same size and the same orientation static void convert(const std::vector& points2f, std::vector& keypoints, float size=1, float response=1, int octave=0, int class_id=-1); + + //! computes overlap for pair of keypoints; + //! overlap is a ratio between area of keypoint regions intersection and + //! area of keypoint regions union (now keypoint region is circle) + static float overlap(const KeyPoint& kp1, const KeyPoint& kp2); + Point2f pt; //!< coordinates of the keypoints float size; //!< diameter of the meaningfull keypoint neighborhood float angle; //!< computed orientation of the keypoint (-1 if not applicable) diff --git a/modules/features2d/src/keypoint.cpp b/modules/features2d/src/keypoint.cpp index 71c035aaf6..dc6e102df3 100644 --- a/modules/features2d/src/keypoint.cpp +++ b/modules/features2d/src/keypoint.cpp @@ -109,4 +109,53 @@ void KeyPoint::convert( const std::vector& points2f, std::vector 0) + ovrl = bna/bua; + } + + return ovrl; +} + }