From b4275e198792735b41a8c11812ac6683a74d5027 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Wed, 26 May 2010 11:27:56 +0000 Subject: [PATCH] added clear method to GenericDescriptorMatch --- .../include/opencv2/features2d/features2d.hpp | 5 +++++ modules/features2d/src/descriptors.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index ce5d07a7ac..14ddc6a3d9 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -1559,6 +1559,9 @@ public: // Returns the keypoint by its global index KeyPoint getKeyPoint( int index ) const; + // Clears images, keypoints and startIndices + void clear(); + vector images; vector > points; @@ -1599,6 +1602,8 @@ public: // class_ids A vector to be filled with keypoint class_ids virtual void match( const Mat& image, vector& points, vector& indices ) = 0; + // Clears keypoints storing in collection + virtual void clear(); protected: KeyPointCollection collection; }; diff --git a/modules/features2d/src/descriptors.cpp b/modules/features2d/src/descriptors.cpp index 5951dcfa70..6e8e5b568c 100644 --- a/modules/features2d/src/descriptors.cpp +++ b/modules/features2d/src/descriptors.cpp @@ -150,6 +150,13 @@ size_t KeyPointCollection::calcKeypointCount() const return *startIndices.rbegin() + points.rbegin()->size(); } +void KeyPointCollection::clear() +{ + images.clear(); + points.clear(); + startIndices.clear(); +} + /* * GenericDescriptorMatch */ @@ -169,6 +176,10 @@ void GenericDescriptorMatch::classify( const Mat& image, vector& p points[i].class_id = collection.getKeyPoint(keypointIndices[i]).class_id; }; +void GenericDescriptorMatch::clear() +{ + collection.clear(); +} /****************************************************************************************\ * OneWayDescriptorMatch * \****************************************************************************************/