Commit 2daa14e3 authored by Ievgen Khvedchenia's avatar Ievgen Khvedchenia

Clean-up from dead code.

parent a134e068
......@@ -43,58 +43,34 @@ enum DIFFUSIVITY_TYPE {
CHARBONNIER = 3
};
/* ************************************************************************* */
/// 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
......@@ -115,10 +91,6 @@ struct AKAZEOptions {
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
};
/* ************************************************************************* */
......
......@@ -547,11 +547,10 @@ void AKAZEFeatures::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts
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)
{
}
......@@ -569,17 +568,15 @@ private:
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)
{
}
......@@ -598,17 +595,15 @@ private:
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)
{
}
......@@ -626,17 +621,15 @@ private:
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)
{
}
......@@ -655,7 +648,6 @@ private:
std::vector<cv::KeyPoint>* keypoints_;
cv::Mat* descriptors_;
std::vector<TEvolution>* evolution_;
AKAZEOptions* options_;
};
class Upright_MLDB_Full_Descriptor_Invoker : public cv::ParallelLoopBody
......@@ -823,7 +815,7 @@ void AKAZEFeatures::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat
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));
......@@ -832,7 +824,7 @@ void AKAZEFeatures::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat
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]);
......@@ -842,7 +834,7 @@ void AKAZEFeatures::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat
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));
......@@ -851,7 +843,7 @@ void AKAZEFeatures::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat
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]);
......
......@@ -80,11 +80,6 @@ public:
/* ************************************************************************* */
// 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,
......
......@@ -42,8 +42,6 @@ KAZEFeatures::KAZEFeatures(KAZEOptions& options) {
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;
......@@ -71,17 +69,6 @@ KAZEFeatures::KAZEFeatures(KAZEOptions& options) {
//*******************************************************************************
//*******************************************************************************
/**
* @brief KAZE destructor
*/
KAZEFeatures::~KAZEFeatures(void) {
evolution_.clear();
}
//*******************************************************************************
//*******************************************************************************
/**
* @brief This method allocates the memory for the nonlinear diffusion evolution
*/
......@@ -171,10 +158,10 @@ int KAZEFeatures::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
//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++) {
......@@ -209,10 +196,10 @@ int KAZEFeatures::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
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();
......
......@@ -34,7 +34,6 @@ private:
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
......@@ -71,9 +70,6 @@ public:
// 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);
......@@ -155,10 +151,6 @@ public:
img_height_ = img_height;
}
void Set_Verbosity_Level(bool verbosity) {
verbosity_ = verbosity;
}
void Set_KContrast(float kcontrast) {
kcontrast_ = kcontrast;
}
......@@ -216,10 +208,6 @@ public:
return img_height_;
}
bool Get_Verbosity_Level(void) {
return verbosity_;
}
float Get_KContrast(void) {
return kcontrast_;
}
......
......@@ -39,10 +39,6 @@ static const int DEFAULT_DESCRIPTOR_MODE = 1; // Descriptor Mode 0->SURF, 1->M-S
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;
......@@ -72,10 +68,6 @@ struct KAZEOptions {
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;
......@@ -90,10 +82,6 @@ struct KAZEOptions {
bool upright;
bool extended;
int descriptor;
bool save_scale_space;
bool save_keypoints;
bool verbosity;
bool show_results;
};
struct TEvolution {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment