From 3e51da38fb5f0f6acd9980894066ee94586d3abc Mon Sep 17 00:00:00 2001 From: Ievgen Khvedchenia Date: Thu, 1 May 2014 10:58:34 +0300 Subject: [PATCH] Removed Feature_Suppression_Distance function that is not used anywhere. --- modules/features2d/src/akaze/AKAZEFeatures.cpp | 50 ----------------------- modules/features2d/src/akaze/AKAZEFeatures.h | 1 - modules/features2d/src/kaze/KAZEFeatures.cpp | 56 -------------------------- modules/features2d/src/kaze/KAZEFeatures.h | 1 - 4 files changed, 108 deletions(-) diff --git a/modules/features2d/src/akaze/AKAZEFeatures.cpp b/modules/features2d/src/akaze/AKAZEFeatures.cpp index 0b20151..27d5692 100644 --- a/modules/features2d/src/akaze/AKAZEFeatures.cpp +++ b/modules/features2d/src/akaze/AKAZEFeatures.cpp @@ -493,56 +493,6 @@ void AKAZEFeatures::Do_Subpixel_Refinement(std::vector& kpts) { } /* ************************************************************************* */ -/** - * @brief This method performs feature suppression based on 2D distance - * @param kpts Vector of keypoints - * @param mdist Maximum distance in pixels - */ -void AKAZEFeatures::Feature_Suppression_Distance(std::vector& kpts, float mdist) const { - - vector aux; - vector to_delete; - float dist = 0.0, x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0; - bool found = false; - - for (size_t i = 0; i < kpts.size(); i++) { - x1 = kpts[i].pt.x; - y1 = kpts[i].pt.y; - for (size_t j = i + 1; j < kpts.size(); j++) { - x2 = kpts[j].pt.x; - y2 = kpts[j].pt.y; - dist = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)); - if (dist < mdist) { - if (fabs(kpts[i].response) >= fabs(kpts[j].response)) { - to_delete.push_back(j); - } - else { - to_delete.push_back(i); - break; - } - } - } - } - - for (size_t i = 0; i < kpts.size(); i++) { - found = false; - for (size_t j = 0; j < to_delete.size(); j++) { - if (i == to_delete[j]) { - found = true; - break; - } - } - if (found == false) { - aux.push_back(kpts[i]); - } - } - - kpts.clear(); - kpts = aux; - aux.clear(); -} - -/* ************************************************************************* */ class SURF_Descriptor_Upright_64_Invoker : public cv::ParallelLoopBody { diff --git a/modules/features2d/src/akaze/AKAZEFeatures.h b/modules/features2d/src/akaze/AKAZEFeatures.h index 389848c..4bebc16 100644 --- a/modules/features2d/src/akaze/AKAZEFeatures.h +++ b/modules/features2d/src/akaze/AKAZEFeatures.h @@ -46,7 +46,6 @@ public: void Compute_Multiscale_Derivatives(void); void Find_Scale_Space_Extrema(std::vector& kpts); void Do_Subpixel_Refinement(std::vector& kpts); - void Feature_Suppression_Distance(std::vector& kpts, float mdist) const; // Feature description methods void Compute_Descriptors(std::vector& kpts, cv::Mat& desc); diff --git a/modules/features2d/src/kaze/KAZEFeatures.cpp b/modules/features2d/src/kaze/KAZEFeatures.cpp index a3582af..78348f8 100644 --- a/modules/features2d/src/kaze/KAZEFeatures.cpp +++ b/modules/features2d/src/kaze/KAZEFeatures.cpp @@ -591,62 +591,6 @@ void KAZEFeatures::Do_Subpixel_Refinement(std::vector &kpts) { //************************************************************************************* /** - * @brief This method performs feature suppression based on 2D distance - * @param kpts Vector of keypoints - * @param mdist Maximum distance in pixels - */ -void KAZEFeatures::Feature_Suppression_Distance(std::vector& kpts, const float& mdist) { - - vector aux; - vector to_delete; - float dist = 0.0, x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0; - bool found = false; - - for (size_t i = 0; i < kpts.size(); i++) { - x1 = kpts[i].pt.x; - y1 = kpts[i].pt.y; - - for (size_t j = i + 1; j < kpts.size(); j++) { - x2 = kpts[j].pt.x; - y2 = kpts[j].pt.y; - dist = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)); - - if (dist < mdist) { - if (fabs(kpts[i].response) >= fabs(kpts[j].response)) { - to_delete.push_back(j); - } - else { - to_delete.push_back(i); - break; - } - } - } - } - - for (size_t i = 0; i < kpts.size(); i++) { - found = false; - - for (size_t j = 0; j < to_delete.size(); j++) { - if (i == to_delete[j]) { - found = true; - break; - } - } - - if (found == false) { - aux.push_back(kpts[i]); - } - } - - kpts.clear(); - kpts = aux; - aux.clear(); -} - -//************************************************************************************* -//************************************************************************************* - -/** * @brief This method computes the set of descriptors through the nonlinear scale space * @param kpts Vector of keypoints * @param desc Matrix with the feature descriptors diff --git a/modules/features2d/src/kaze/KAZEFeatures.h b/modules/features2d/src/kaze/KAZEFeatures.h index 3f845e1..c901561 100644 --- a/modules/features2d/src/kaze/KAZEFeatures.h +++ b/modules/features2d/src/kaze/KAZEFeatures.h @@ -84,7 +84,6 @@ private: void Determinant_Hessian_Parallel(std::vector& kpts); void Find_Extremum_Threading(const int& level); void Do_Subpixel_Refinement(std::vector& kpts); - void Feature_Suppression_Distance(std::vector& kpts, const float& mdist); // AOS Methods void AOS_Step_Scalar(cv::Mat &Ld, const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize); -- 2.7.4