};
/* ************************************************************************* */
-/// AKAZE Timing structure
-struct AKAZETiming {
-
- AKAZETiming() {
- kcontrast = 0.0;
- scale = 0.0;
- derivatives = 0.0;
- detector = 0.0;
- extrema = 0.0;
- subpixel = 0.0;
- descriptor = 0.0;
- }
-
- double kcontrast; ///< Contrast factor computation time in ms
- double scale; ///< Nonlinear scale space computation time in ms
- double derivatives; ///< Multiscale derivatives computation time in ms
- double detector; ///< Feature detector computation time in ms
- double extrema; ///< Scale space extrema computation time in ms
- double subpixel; ///< Subpixel refinement computation time in ms
- double descriptor; ///< Descriptors computation time in ms
-};
-
-/* ************************************************************************* */
/// AKAZE configuration options structure
struct AKAZEOptions {
- AKAZEOptions() {
- soffset = 1.6f;
- derivative_factor = 1.5f;
- omax = 4;
- nsublevels = 4;
- dthreshold = 0.001f;
- min_dthreshold = 0.00001f;
-
- diffusivity = PM_G2;
- descriptor = MLDB;
- descriptor_size = 0;
- descriptor_channels = 3;
- descriptor_pattern_size = 10;
- sderivatives = 1.0;
-
- kcontrast = 0.001f;
- kcontrast_percentile = 0.7f;
- kcontrast_nbins = 300;
-
- save_scale_space = false;
- save_keypoints = false;
- verbosity = false;
+ AKAZEOptions()
+ : omax(4)
+ , nsublevels(4)
+ , img_width(0)
+ , img_height(0)
+ , soffset(1.6f)
+ , derivative_factor(1.5f)
+ , sderivatives(1.0)
+ , diffusivity(PM_G2)
+
+ , dthreshold(0.001f)
+ , min_dthreshold(0.00001f)
+
+ , descriptor(MLDB)
+ , descriptor_size(0)
+ , descriptor_channels(3)
+ , descriptor_pattern_size(10)
+
+ , kcontrast(0.001f)
+ , kcontrast_percentile(0.7f)
+ , kcontrast_nbins(300)
+ {
}
- int omin; ///< Initial octave level (-1 means that the size of the input image is duplicated)
int omax; ///< Maximum octave evolution of the image 2^sigma (coarsest scale sigma units)
int nsublevels; ///< Default number of sublevels per scale level
int img_width; ///< Width of the input image
float kcontrast; ///< The contrast factor parameter
float kcontrast_percentile; ///< Percentile level for the contrast factor
int kcontrast_nbins; ///< Number of bins for the contrast factor histogram
-
- bool save_scale_space; ///< Set to true for saving the scale space images
- bool save_keypoints; ///< Set to true for saving the detected keypoints and descriptors
- bool verbosity; ///< Set to true for displaying verbosity information
};
/* ************************************************************************* */
class SURF_Descriptor_Upright_64_Invoker : public cv::ParallelLoopBody
{
public:
- SURF_Descriptor_Upright_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution, AKAZEOptions& options)
+ SURF_Descriptor_Upright_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution)
: keypoints_(&kpts)
, descriptors_(&desc)
, evolution_(&evolution)
- , options_(&options)
{
}
std::vector<cv::KeyPoint>* keypoints_;
cv::Mat* descriptors_;
std::vector<TEvolution>* evolution_;
- AKAZEOptions* options_;
};
class SURF_Descriptor_64_Invoker : public cv::ParallelLoopBody
{
public:
- SURF_Descriptor_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution, AKAZEOptions& options)
+ SURF_Descriptor_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution)
: keypoints_(&kpts)
, descriptors_(&desc)
, evolution_(&evolution)
- , options_(&options)
{
}
std::vector<cv::KeyPoint>* keypoints_;
cv::Mat* descriptors_;
std::vector<TEvolution>* evolution_;
- AKAZEOptions* options_;
};
class MSURF_Upright_Descriptor_64_Invoker : public cv::ParallelLoopBody
{
public:
- MSURF_Upright_Descriptor_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution, AKAZEOptions& options)
+ MSURF_Upright_Descriptor_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution)
: keypoints_(&kpts)
, descriptors_(&desc)
, evolution_(&evolution)
- , options_(&options)
{
}
std::vector<cv::KeyPoint>* keypoints_;
cv::Mat* descriptors_;
std::vector<TEvolution>* evolution_;
- AKAZEOptions* options_;
};
class MSURF_Descriptor_64_Invoker : public cv::ParallelLoopBody
{
public:
- MSURF_Descriptor_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution, AKAZEOptions& options)
+ MSURF_Descriptor_64_Invoker(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc, std::vector<TEvolution>& evolution)
: keypoints_(&kpts)
, descriptors_(&desc)
, evolution_(&evolution)
- , options_(&options)
{
}
std::vector<cv::KeyPoint>* keypoints_;
cv::Mat* descriptors_;
std::vector<TEvolution>* evolution_;
- AKAZEOptions* options_;
};
class Upright_MLDB_Full_Descriptor_Invoker : public cv::ParallelLoopBody
case SURF_UPRIGHT: // Upright descriptors, not invariant to rotation
{
- cv::parallel_for_(cv::Range(0, (int)kpts.size()), SURF_Descriptor_Upright_64_Invoker(kpts, desc, evolution_, options_));
+ cv::parallel_for_(cv::Range(0, (int)kpts.size()), SURF_Descriptor_Upright_64_Invoker(kpts, desc, evolution_));
//for (int i = 0; i < (int)(kpts.size()); i++) {
// Get_SURF_Descriptor_Upright_64(kpts[i], desc.ptr<float>(i));
break;
case SURF:
{
- cv::parallel_for_(cv::Range(0, (int)kpts.size()), SURF_Descriptor_64_Invoker(kpts, desc, evolution_, options_));
+ cv::parallel_for_(cv::Range(0, (int)kpts.size()), SURF_Descriptor_64_Invoker(kpts, desc, evolution_));
//for (int i = 0; i < (int)(kpts.size()); i++) {
// Compute_Main_Orientation(kpts[i]);
break;
case MSURF_UPRIGHT: // Upright descriptors, not invariant to rotation
{
- cv::parallel_for_(cv::Range(0, (int)kpts.size()), MSURF_Upright_Descriptor_64_Invoker(kpts, desc, evolution_, options_));
+ cv::parallel_for_(cv::Range(0, (int)kpts.size()), MSURF_Upright_Descriptor_64_Invoker(kpts, desc, evolution_));
//for (int i = 0; i < (int)(kpts.size()); i++) {
// Get_MSURF_Upright_Descriptor_64(kpts[i], desc.ptr<float>(i));
break;
case MSURF:
{
- cv::parallel_for_(cv::Range(0, (int)kpts.size()), MSURF_Descriptor_64_Invoker(kpts, desc, evolution_, options_));
+ cv::parallel_for_(cv::Range(0, (int)kpts.size()), MSURF_Descriptor_64_Invoker(kpts, desc, evolution_));
//for (int i = 0; i < (int)(kpts.size()); i++) {
// Compute_Main_Orientation(kpts[i]);
/* ************************************************************************* */
// Inline functions
-/**
- * @brief This function sets default parameters for the A-KAZE detector.
- * @param options AKAZE options
- */
-void setDefaultAKAZEOptions(AKAZEOptions& options);
// Inline functions
void generateDescriptorSubsample(cv::Mat& sampleList, cv::Mat& comparisons,
sderivatives_ = options.sderivatives;
omax_ = options.omax;
nsublevels_ = options.nsublevels;
- save_scale_space_ = options.save_scale_space;
- verbosity_ = options.verbosity;
img_width_ = options.img_width;
img_height_ = options.img_height;
dthreshold_ = options.dthreshold;
//*******************************************************************************
/**
- * @brief KAZE destructor
- */
-KAZEFeatures::~KAZEFeatures(void) {
-
- evolution_.clear();
-}
-
-//*******************************************************************************
-//*******************************************************************************
-
-/**
* @brief This method allocates the memory for the nonlinear diffusion evolution
*/
void KAZEFeatures::Allocate_Memory_Evolution(void) {
//t2 = getTickCount();
//tkcontrast_ = 1000.0*(t2 - t1) / getTickFrequency();
- if (verbosity_ == true) {
- cout << "Computed image evolution step. Evolution time: " << evolution_[0].etime <<
- " Sigma: " << evolution_[0].esigma << endl;
- }
+ //if (verbosity_ == true) {
+ // cout << "Computed image evolution step. Evolution time: " << evolution_[0].etime <<
+ // " Sigma: " << evolution_[0].esigma << endl;
+ //}
// Now generate the rest of evolution levels
for (size_t i = 1; i < evolution_.size(); i++) {
evolution_[i].etime - evolution_[i - 1].etime);
}
- if (verbosity_ == true) {
- cout << "Computed image evolution step " << i << " Evolution time: " << evolution_[i].etime <<
- " Sigma: " << evolution_[i].esigma << endl;
- }
+ //if (verbosity_ == true) {
+ // cout << "Computed image evolution step " << i << " Evolution time: " << evolution_[i].etime <<
+ // " Sigma: " << evolution_[i].esigma << endl;
+ //}
}
//t2 = getTickCount();
int img_width_; // Width of the original image
int img_height_; // Height of the original image
bool save_scale_space_; // For saving scale space images
- bool verbosity_; // Verbosity level
std::vector<TEvolution> evolution_; // Vector of nonlinear diffusion evolution
float kcontrast_; // The contrast parameter for the scalar nonlinear diffusion
float dthreshold_; // Feature detector threshold response
// Constructor
KAZEFeatures(KAZEOptions& options);
- // Destructor
- ~KAZEFeatures(void);
-
// Public methods for KAZE interface
void Allocate_Memory_Evolution(void);
int Create_Nonlinear_Scale_Space(const cv::Mat& img);
img_height_ = img_height;
}
- void Set_Verbosity_Level(bool verbosity) {
- verbosity_ = verbosity;
- }
-
void Set_KContrast(float kcontrast) {
kcontrast_ = kcontrast;
}
return img_height_;
}
- bool Get_Verbosity_Level(void) {
- return verbosity_;
- }
-
float Get_KContrast(void) {
return kcontrast_;
}
static const bool DEFAULT_USE_FED = true; // 0->AOS, 1->FED
static const bool DEFAULT_UPRIGHT = false; // Upright descriptors, not invariant to rotation
static const bool DEFAULT_EXTENDED = false; // Extended descriptor, dimension 128
-static const bool DEFAULT_SAVE_SCALE_SPACE = false; // For saving the scale space images
-static const bool DEFAULT_VERBOSITY = false; // Verbosity level (0->no verbosity)
-static const bool DEFAULT_SHOW_RESULTS = true; // For showing the output image with the detected features plus some ratios
-static const bool DEFAULT_SAVE_KEYPOINTS = false; // For saving the list of keypoints
// Some important configuration variables
static const float DEFAULT_SIGMA_SMOOTHING_DERIVATIVES = 1.0f;
descriptor = DEFAULT_DESCRIPTOR_MODE;
diffusivity = DEFAULT_DIFFUSIVITY_TYPE;
sderivatives = DEFAULT_SIGMA_SMOOTHING_DERIVATIVES;
- save_scale_space = DEFAULT_SAVE_SCALE_SPACE;
- save_keypoints = DEFAULT_SAVE_KEYPOINTS;
- verbosity = DEFAULT_VERBOSITY;
- show_results = DEFAULT_SHOW_RESULTS;
}
float soffset;
bool upright;
bool extended;
int descriptor;
- bool save_scale_space;
- bool save_keypoints;
- bool verbosity;
- bool show_results;
};
struct TEvolution {