From f3320d4faafee1279e804d94b8a2be161e75d6af Mon Sep 17 00:00:00 2001 From: catree Date: Fri, 19 Jan 2018 16:33:59 +0100 Subject: [PATCH] Add getter and setter for VGG and Boost descriptors. --- .../include/opencv2/xfeatures2d.hpp | 21 +++++++++++++++++++ modules/xfeatures2d/src/boostdesc.cpp | 7 +++++++ modules/xfeatures2d/src/vgg.cpp | 18 +++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp b/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp index a8f16238d..129c61076 100644 --- a/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp +++ b/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp @@ -312,6 +312,21 @@ public: CV_WRAP static Ptr create( int desc = VGG::VGG_120, float isigma = 1.4f, bool img_normalize = true, bool use_scale_orientation = true, float scale_factor = 6.25f, bool dsc_normalize = false ); + + CV_WRAP virtual void setSigma(const float isigma) = 0; + CV_WRAP virtual float getSigma() const = 0; + + CV_WRAP virtual void setUseNormalizeImage(const bool img_normalize) = 0; + CV_WRAP virtual bool getUseNormalizeImage() const = 0; + + CV_WRAP virtual void setUseScaleOrientation(const bool use_scale_orientation) = 0; + CV_WRAP virtual bool getUseScaleOrientation() const = 0; + + CV_WRAP virtual void setScaleFactor(const float scale_factor) = 0; + CV_WRAP virtual float getScaleFactor() const = 0; + + CV_WRAP virtual void setUseNormalizeDescriptor(const bool dsc_normalize) = 0; + CV_WRAP virtual bool getUseNormalizeDescriptor() const = 0; }; /** @brief Class implementing BoostDesc (Learning Image Descriptors with Boosting), described in @@ -353,6 +368,12 @@ public: CV_WRAP static Ptr create( int desc = BoostDesc::BINBOOST_256, bool use_scale_orientation = true, float scale_factor = 6.25f ); + + CV_WRAP virtual void setUseScaleOrientation(const bool use_scale_orientation) = 0; + CV_WRAP virtual bool getUseScaleOrientation() const = 0; + + CV_WRAP virtual void setScaleFactor(const float scale_factor) = 0; + CV_WRAP virtual float getScaleFactor() const = 0; }; diff --git a/modules/xfeatures2d/src/boostdesc.cpp b/modules/xfeatures2d/src/boostdesc.cpp index 5f99c5321..02f6544e0 100644 --- a/modules/xfeatures2d/src/boostdesc.cpp +++ b/modules/xfeatures2d/src/boostdesc.cpp @@ -93,6 +93,13 @@ public: // compute descriptors given keypoints virtual void compute( InputArray image, vector& keypoints, OutputArray descriptors ); + // getter / setter + virtual void setUseScaleOrientation(const bool use_scale_orientation) { m_use_scale_orientation = use_scale_orientation; } + virtual bool getUseScaleOrientation() const { return m_use_scale_orientation; } + + virtual void setScaleFactor(const float scale_factor) { m_scale_factor = scale_factor; } + virtual float getScaleFactor() const { return m_scale_factor; } + protected: /* diff --git a/modules/xfeatures2d/src/vgg.cpp b/modules/xfeatures2d/src/vgg.cpp index f42bd321a..b67979dff 100644 --- a/modules/xfeatures2d/src/vgg.cpp +++ b/modules/xfeatures2d/src/vgg.cpp @@ -83,7 +83,7 @@ public: virtual ~VGG_Impl(); // returns the descriptor length in bytes - virtual int descriptorSize() const { return m_descriptor_size; }; + virtual int descriptorSize() const { return m_descriptor_size; } // returns the descriptor type virtual int descriptorType() const { return CV_32F; } @@ -94,6 +94,22 @@ public: // compute descriptors given keypoints virtual void compute( InputArray image, vector& keypoints, OutputArray descriptors ); + // getter / setter + virtual void setSigma(const float isigma) { m_isigma = isigma; } + virtual float getSigma() const { return m_isigma; } + + virtual void setUseNormalizeImage(const bool img_normalize) { m_img_normalize = img_normalize; } + virtual bool getUseNormalizeImage() const { return m_img_normalize; } + + virtual void setUseScaleOrientation(const bool use_scale_orientation) { m_use_scale_orientation = use_scale_orientation; } + virtual bool getUseScaleOrientation() const { return m_use_scale_orientation; } + + virtual void setScaleFactor(const float scale_factor) { m_scale_factor = scale_factor; } + virtual float getScaleFactor() const { return m_scale_factor; } + + virtual void setUseNormalizeDescriptor(const bool dsc_normalize) { m_dsc_normalize = dsc_normalize; } + virtual bool getUseNormalizeDescriptor() const { return m_dsc_normalize; } + protected: /*