Prepare KAZE and AKAZE sources for integration

pull/2673/head
Ievgen Khvedchenia 11 years ago
parent 7a59435490
commit 703e012a5b
  1. 56
      modules/features2d/src/akaze/AKAZE.cpp
  2. 11
      modules/features2d/src/akaze/AKAZE.h
  3. 46
      modules/features2d/src/akaze/config.h
  4. 60
      modules/features2d/src/kaze/KAZE.cpp
  5. 11
      modules/features2d/src/kaze/KAZE.h
  6. 48
      modules/features2d/src/kaze/config.h

@ -33,7 +33,7 @@ using namespace cv;
* @param options AKAZE configuration options
* @note This constructor allocates memory for the nonlinear scale space
*/
AKAZE::AKAZE(const AKAZEOptions& options) {
AKAZEFeatures::AKAZEFeatures(const AKAZEOptions& options) {
soffset_ = options.soffset;
factor_size_ = DEFAULT_FACTOR_SIZE;
@ -75,7 +75,7 @@ AKAZE::AKAZE(const AKAZEOptions& options) {
/**
* @brief AKAZE destructor
*/
AKAZE::~AKAZE(void) {
AKAZEFeatures::~AKAZEFeatures(void) {
evolution_.clear();
}
@ -86,7 +86,7 @@ AKAZE::~AKAZE(void) {
/**
* @brief This method allocates the memory for the nonlinear diffusion evolution
*/
void AKAZE::Allocate_Memory_Evolution(void) {
void AKAZEFeatures::Allocate_Memory_Evolution(void) {
float rfactor = 0.0;
int level_height = 0, level_width = 0;
@ -145,7 +145,7 @@ void AKAZE::Allocate_Memory_Evolution(void) {
* @param img Input image for which the nonlinear scale space needs to be created
* @return 0 if the nonlinear scale space was created successfully, -1 otherwise
*/
int AKAZE::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
int AKAZEFeatures::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
double t1 = 0.0, t2 = 0.0;
@ -222,7 +222,7 @@ int AKAZE::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
* @brief This method selects interesting keypoints through the nonlinear scale space
* @param kpts Vector of detected keypoints
*/
void AKAZE::Feature_Detection(std::vector<cv::KeyPoint>& kpts) {
void AKAZEFeatures::Feature_Detection(std::vector<cv::KeyPoint>& kpts) {
double t1 = 0.0, t2 = 0.0;
@ -242,7 +242,7 @@ void AKAZE::Feature_Detection(std::vector<cv::KeyPoint>& kpts) {
/**
* @brief This method computes the multiscale derivatives for the nonlinear scale space
*/
void AKAZE::Compute_Multiscale_Derivatives(void) {
void AKAZEFeatures::Compute_Multiscale_Derivatives(void) {
double t1 = 0.0, t2 = 0.0;
@ -279,7 +279,7 @@ void AKAZE::Compute_Multiscale_Derivatives(void) {
* @brief This method computes the feature detector response for the nonlinear scale space
* @note We use the Hessian determinant as the feature detector response
*/
void AKAZE::Compute_Determinant_Hessian_Response(void) {
void AKAZEFeatures::Compute_Determinant_Hessian_Response(void) {
// Firstly compute the multiscale derivatives
Compute_Multiscale_Derivatives();
@ -307,7 +307,7 @@ void AKAZE::Compute_Determinant_Hessian_Response(void) {
* @brief This method finds extrema in the nonlinear scale space
* @param kpts Vector of detected keypoints
*/
void AKAZE::Find_Scale_Space_Extrema(std::vector<cv::KeyPoint>& kpts) {
void AKAZEFeatures::Find_Scale_Space_Extrema(std::vector<cv::KeyPoint>& kpts) {
double t1 = 0.0, t2 = 0.0;
float value = 0.0;
@ -418,7 +418,7 @@ void AKAZE::Find_Scale_Space_Extrema(std::vector<cv::KeyPoint>& kpts) {
* @brief This method performs subpixel refinement of the detected keypoints
* @param kpts Vector of detected keypoints
*/
void AKAZE::Do_Subpixel_Refinement(std::vector<cv::KeyPoint>& kpts) {
void AKAZEFeatures::Do_Subpixel_Refinement(std::vector<cv::KeyPoint>& kpts) {
double t1 = 0.0, t2 = 0.0;
float Dx = 0.0, Dy = 0.0, ratio = 0.0;
@ -493,7 +493,7 @@ void AKAZE::Do_Subpixel_Refinement(std::vector<cv::KeyPoint>& kpts) {
* @param kpts Vector of keypoints
* @param mdist Maximum distance in pixels
*/
void AKAZE::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts, float mdist) {
void AKAZEFeatures::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts, float mdist) {
vector<KeyPoint> aux;
vector<int> to_delete;
@ -545,7 +545,7 @@ void AKAZE::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts, float
* @param kpts Vector of detected keypoints
* @param desc Matrix to store the descriptors
*/
void AKAZE::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc) {
void AKAZEFeatures::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc) {
double t1 = 0.0, t2 = 0.0;
@ -653,7 +653,7 @@ void AKAZE::Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc)
* @note The orientation is computed using a similar approach as described in the
* original SURF method. See Bay et al., Speeded Up Robust Features, ECCV 2006
*/
void AKAZE::Compute_Main_Orientation_SURF(cv::KeyPoint& kpt) {
void AKAZEFeatures::Compute_Main_Orientation_SURF(cv::KeyPoint& kpt) {
int ix = 0, iy = 0, idx = 0, s = 0, level = 0;
float xf = 0.0, yf = 0.0, gweight = 0.0, ratio = 0.0;
@ -728,7 +728,7 @@ void AKAZE::Compute_Main_Orientation_SURF(cv::KeyPoint& kpt) {
* Gaussian weighting is performed. The descriptor is inspired from Bay et al.,
* Speeded Up Robust Features, ECCV, 2006
*/
void AKAZE::Get_SURF_Descriptor_Upright_64(const cv::KeyPoint& kpt, float *desc) {
void AKAZEFeatures::Get_SURF_Descriptor_Upright_64(const cv::KeyPoint& kpt, float *desc) {
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0;
float rx = 0.0, ry = 0.0, len = 0.0, xf = 0.0, yf = 0.0;
@ -819,7 +819,7 @@ void AKAZE::Get_SURF_Descriptor_Upright_64(const cv::KeyPoint& kpt, float *desc)
* Gaussian weighting is performed. The descriptor is inspired from Bay et al.,
* Speeded Up Robust Features, ECCV, 2006
*/
void AKAZE::Get_SURF_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
void AKAZEFeatures::Get_SURF_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0;
float rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, len = 0.0, xf = 0.0, yf = 0.0;
@ -918,7 +918,7 @@ void AKAZE::Get_SURF_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
* from Agrawal et al., CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching,
* ECCV 2008
*/
void AKAZE::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
void AKAZEFeatures::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0, gauss_s1 = 0.0, gauss_s2 = 0.0;
float rx = 0.0, ry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, ys = 0.0, xs = 0.0;
@ -1041,7 +1041,7 @@ void AKAZE::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint& kpt, float *desc
* from Agrawal et al., CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching,
* ECCV 2008
*/
void AKAZE::Get_MSURF_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
void AKAZEFeatures::Get_MSURF_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0, gauss_s1 = 0.0, gauss_s2 = 0.0;
float rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, ys = 0.0, xs = 0.0;
@ -1165,7 +1165,7 @@ void AKAZE::Get_MSURF_Descriptor_64(const cv::KeyPoint& kpt, float *desc) {
* @param kpt Input keypoint
* @param desc Descriptor vector
*/
void AKAZE::Get_Upright_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned char *desc) {
void AKAZEFeatures::Get_Upright_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned char *desc) {
float di = 0.0, dx = 0.0, dy = 0.0;
float ri = 0.0, rx = 0.0, ry = 0.0, xf = 0.0, yf = 0.0;
@ -1378,7 +1378,7 @@ void AKAZE::Get_Upright_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned c
* @param kpt Input keypoint
* @param desc Descriptor vector
*/
void AKAZE::Get_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned char *desc) {
void AKAZEFeatures::Get_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned char *desc) {
float di = 0.0, dx = 0.0, dy = 0.0, ratio = 0.0;
float ri = 0.0, rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, xf = 0.0, yf = 0.0;
@ -1680,7 +1680,7 @@ void AKAZE::Get_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned char *des
* @param kpt Input keypoint
* @param desc Descriptor vector
*/
void AKAZE::Get_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *desc) {
void AKAZEFeatures::Get_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *desc) {
float di, dx, dy;
float rx, ry;
@ -1772,7 +1772,7 @@ void AKAZE::Get_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *d
* @param kpt Input keypoint
* @param desc Descriptor vector
*/
void AKAZE::Get_Upright_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *desc) {
void AKAZEFeatures::Get_Upright_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *desc) {
float di = 0.0f, dx = 0.0f, dy = 0.0f;
float rx = 0.0f, ry = 0.0f;
@ -1851,22 +1851,6 @@ void AKAZE::Get_Upright_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned
//*************************************************************************************
//*************************************************************************************
/**
* @brief This method displays the computation times
*/
void AKAZE::Show_Computation_Times(void) {
cout << "(*) Time Scale Space: " << tscale_ << endl;
cout << "(*) Time Detector: " << tdetector_ << endl;
cout << " - Time Derivatives: " << tderivatives_ << endl;
cout << " - Time Extrema: " << textrema_ << endl;
cout << " - Time Subpixel: " << tsubpixel_ << endl;
cout << "(*) Time Descriptor: " << tdescriptor_ << endl;
}
//*************************************************************************************
//*************************************************************************************
/**
* @brief This function computes a (quasi-random) list of bits to be taken
* from the full descriptor. To speed the extraction, the function creates

@ -22,7 +22,7 @@
//*************************************************************************************
// AKAZE Class Declaration
class AKAZE {
class AKAZEFeatures {
private:
@ -72,10 +72,10 @@ private:
public:
// Constructor
AKAZE(const AKAZEOptions &options);
AKAZEFeatures(const AKAZEOptions &options);
// Destructor
~AKAZE(void);
~AKAZEFeatures(void);
// Setters
void Set_Octave_Max(const int& omax) {
@ -144,11 +144,6 @@ public:
void Get_MLDB_Full_Descriptor(const cv::KeyPoint& kpt, unsigned char *desc);
void Get_Upright_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *desc);
void Get_MLDB_Descriptor_Subset(const cv::KeyPoint& kpt, unsigned char *desc);
// Methods for saving some results and showing computation times
void Save_Scale_Space(void);
void Save_Detector_Responses(void);
void Show_Computation_Times(void);
};
//*************************************************************************************

@ -1,5 +1,5 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
#ifndef __OPENCV_FEATURES_2D_AKAZE_CONFIG_HPP__
#define __OPENCV_FEATURES_2D_AKAZE_CONFIG_HPP__
// STL
#include <string>
@ -17,7 +17,7 @@
#endif
// Lookup table for 2d gaussian (sigma = 2.5) where (0,0) is top left and (6,6) is bottom right
const float gauss25[7][7] = {
static const float gauss25[7][7] = {
{0.02546481f, 0.02350698f, 0.01849125f, 0.01239505f, 0.00708017f, 0.00344629f, 0.00142946f},
{0.02350698f, 0.02169968f, 0.01706957f, 0.01144208f, 0.00653582f, 0.00318132f, 0.00131956f},
{0.01849125f, 0.01706957f, 0.01342740f, 0.00900066f, 0.00514126f, 0.00250252f, 0.00103800f},
@ -29,24 +29,24 @@ const float gauss25[7][7] = {
// Scale Space parameters
const float DEFAULT_SCALE_OFFSET = 1.60f; // Base scale offset (sigma units)
const float DEFAULT_FACTOR_SIZE = 1.5f; // Factor for the multiscale derivatives
const int DEFAULT_OCTAVE_MIN = 0; // Initial octave level (-1 means that the size of the input image is duplicated)
const int DEFAULT_OCTAVE_MAX = 4; // Maximum octave evolution of the image 2^sigma (coarsest scale sigma units)
const int DEFAULT_NSUBLEVELS = 4; // Default number of sublevels per scale level
const int DEFAULT_DIFFUSIVITY_TYPE = 1;
const float KCONTRAST_PERCENTILE = 0.7f;
const int KCONTRAST_NBINS = 300;
const float DEFAULT_SIGMA_SMOOTHING_DERIVATIVES = 1.0f;
const float DEFAULT_KCONTRAST = .01f;
static const float DEFAULT_SCALE_OFFSET = 1.60f; // Base scale offset (sigma units)
static const float DEFAULT_FACTOR_SIZE = 1.5f; // Factor for the multiscale derivatives
static const int DEFAULT_OCTAVE_MIN = 0; // Initial octave level (-1 means that the size of the input image is duplicated)
static const int DEFAULT_OCTAVE_MAX = 4; // Maximum octave evolution of the image 2^sigma (coarsest scale sigma units)
static const int DEFAULT_NSUBLEVELS = 4; // Default number of sublevels per scale level
static const int DEFAULT_DIFFUSIVITY_TYPE = 1;
static const float KCONTRAST_PERCENTILE = 0.7f;
static const int KCONTRAST_NBINS = 300;
static const float DEFAULT_SIGMA_SMOOTHING_DERIVATIVES = 1.0f;
static const float DEFAULT_KCONTRAST = .01f;
// Detector Parameters
const float DEFAULT_DETECTOR_THRESHOLD = 0.001f; // Detector response threshold to accept point
const float DEFAULT_MIN_DETECTOR_THRESHOLD = 0.00001f; // Minimum Detector response threshold to accept point
const int DEFAULT_LDB_DESCRIPTOR_SIZE = 0; // Use 0 for the full descriptor, or the number of bits
const int DEFAULT_LDB_PATTERN_SIZE = 10; // Actual patch size is 2*pattern_size*point.scale;
const int DEFAULT_LDB_CHANNELS = 3;
static const float DEFAULT_DETECTOR_THRESHOLD = 0.001f; // Detector response threshold to accept point
static const float DEFAULT_MIN_DETECTOR_THRESHOLD = 0.00001f; // Minimum Detector response threshold to accept point
static const int DEFAULT_LDB_DESCRIPTOR_SIZE = 0; // Use 0 for the full descriptor, or the number of bits
static const int DEFAULT_LDB_PATTERN_SIZE = 10; // Actual patch size is 2*pattern_size*point.scale;
static const int DEFAULT_LDB_CHANNELS = 3;
// Descriptor Parameters
enum DESCRIPTOR_TYPE
@ -59,13 +59,13 @@ enum DESCRIPTOR_TYPE
MLDB = 5
};
const int DEFAULT_DESCRIPTOR = MLDB;
static const int DEFAULT_DESCRIPTOR = MLDB;
// Some debugging options
const bool DEFAULT_SAVE_SCALE_SPACE = false; // For saving the scale space images
const bool DEFAULT_VERBOSITY = false; // Verbosity level (0->no verbosity)
const bool DEFAULT_SHOW_RESULTS = true; // For showing the output image with the detected features plus some ratios
const bool DEFAULT_SAVE_KEYPOINTS = false; // For saving the list of keypoints
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
// Options structure
struct AKAZEOptions

@ -35,7 +35,7 @@ using namespace cv;
* @param options KAZE configuration options
* @note The constructor allocates memory for the nonlinear scale space
*/
KAZE::KAZE(KAZEOptions& options) {
KAZEFeatures::KAZEFeatures(KAZEOptions& options) {
soffset_ = options.soffset;
sderivatives_ = options.sderivatives;
@ -71,7 +71,7 @@ KAZE::KAZE(KAZEOptions& options) {
/**
* @brief KAZE destructor
*/
KAZE::~KAZE(void) {
KAZEFeatures::~KAZEFeatures(void) {
evolution_.clear();
}
@ -82,7 +82,7 @@ KAZE::~KAZE(void) {
/**
* @brief This method allocates the memory for the nonlinear diffusion evolution
*/
void KAZE::Allocate_Memory_Evolution(void) {
void KAZEFeatures::Allocate_Memory_Evolution(void) {
// Allocate the dimension of the matrices for the evolution
for (int i = 0; i <= omax_-1; i++) {
@ -145,7 +145,7 @@ void KAZE::Allocate_Memory_Evolution(void) {
* @param img Input image for which the nonlinear scale space needs to be created
* @return 0 if the nonlinear scale space was created successfully. -1 otherwise
*/
int KAZE::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
int KAZEFeatures::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
double t2 = 0.0, t1 = 0.0;
@ -226,7 +226,7 @@ int KAZE::Create_Nonlinear_Scale_Space(const cv::Mat &img) {
* @param img Input image
* @param kpercentile Percentile of the gradient histogram
*/
void KAZE::Compute_KContrast(const cv::Mat &img, const float &kpercentile) {
void KAZEFeatures::Compute_KContrast(const cv::Mat &img, const float &kpercentile) {
if (verbosity_ == true) {
cout << "Computing Kcontrast factor." << endl;
@ -248,7 +248,7 @@ void KAZE::Compute_KContrast(const cv::Mat &img, const float &kpercentile) {
/**
* @brief This method computes the multiscale derivatives for the nonlinear scale space
*/
void KAZE::Compute_Multiscale_Derivatives(void)
void KAZEFeatures::Compute_Multiscale_Derivatives(void)
{
double t2 = 0.0, t1 = 0.0;
t1 = getTickCount();
@ -288,7 +288,7 @@ void KAZE::Compute_Multiscale_Derivatives(void)
* @brief This method computes the feature detector response for the nonlinear scale space
* @note We use the Hessian determinant as feature detector
*/
void KAZE::Compute_Detector_Response(void) {
void KAZEFeatures::Compute_Detector_Response(void) {
double t2 = 0.0, t1 = 0.0;
float lxx = 0.0, lxy = 0.0, lyy = 0.0;
@ -326,7 +326,7 @@ void KAZE::Compute_Detector_Response(void) {
* @brief This method selects interesting keypoints through the nonlinear scale space
* @param kpts Vector of keypoints
*/
void KAZE::Feature_Detection(std::vector<cv::KeyPoint>& kpts) {
void KAZEFeatures::Feature_Detection(std::vector<cv::KeyPoint>& kpts) {
double t2 = 0.0, t1 = 0.0;
t1 = getTickCount();
@ -353,7 +353,7 @@ void KAZE::Feature_Detection(std::vector<cv::KeyPoint>& kpts) {
* @param kpts Vector of keypoints
* @note We compute features for each of the nonlinear scale space level in a different processing thread
*/
void KAZE::Determinant_Hessian_Parallel(std::vector<cv::KeyPoint>& kpts) {
void KAZEFeatures::Determinant_Hessian_Parallel(std::vector<cv::KeyPoint>& kpts) {
int level = 0;
float dist = 0.0, smax = 3.0;
@ -444,7 +444,7 @@ void KAZE::Determinant_Hessian_Parallel(std::vector<cv::KeyPoint>& kpts) {
* at a given nonlinear scale level
* @param level Index in the nonlinear scale space evolution
*/
void KAZE::Find_Extremum_Threading(const int& level) {
void KAZEFeatures::Find_Extremum_Threading(const int& level) {
float value = 0.0;
bool is_extremum = false;
@ -497,7 +497,7 @@ void KAZE::Find_Extremum_Threading(const int& level) {
* @brief This method performs subpixel refinement of the detected keypoints
* @param kpts Vector of detected keypoints
*/
void KAZE::Do_Subpixel_Refinement(std::vector<cv::KeyPoint> &kpts) {
void KAZEFeatures::Do_Subpixel_Refinement(std::vector<cv::KeyPoint> &kpts) {
int step = 1;
int x = 0, y = 0;
@ -603,7 +603,7 @@ void KAZE::Do_Subpixel_Refinement(std::vector<cv::KeyPoint> &kpts) {
* @param kpts Vector of keypoints
* @param mdist Maximum distance in pixels
*/
void KAZE::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts, const float& mdist) {
void KAZEFeatures::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts, const float& mdist) {
vector<KeyPoint> aux;
vector<int> to_delete;
@ -659,7 +659,7 @@ void KAZE::Feature_Suppression_Distance(std::vector<cv::KeyPoint>& kpts, const f
* @param kpts Vector of keypoints
* @param desc Matrix with the feature descriptors
*/
void KAZE::Feature_Description(std::vector<cv::KeyPoint> &kpts, cv::Mat &desc) {
void KAZEFeatures::Feature_Description(std::vector<cv::KeyPoint> &kpts, cv::Mat &desc) {
double t2 = 0.0, t1 = 0.0;
t1 = getTickCount();
@ -807,7 +807,7 @@ void KAZE::Feature_Description(std::vector<cv::KeyPoint> &kpts, cv::Mat &desc) {
* @note The orientation is computed using a similar approach as described in the
* original SURF method. See Bay et al., Speeded Up Robust Features, ECCV 2006
*/
void KAZE::Compute_Main_Orientation_SURF(cv::KeyPoint &kpt)
void KAZEFeatures::Compute_Main_Orientation_SURF(cv::KeyPoint &kpt)
{
int ix = 0, iy = 0, idx = 0, s = 0, level = 0;
float xf = 0.0, yf = 0.0, gweight = 0.0;
@ -888,7 +888,7 @@ void KAZE::Compute_Main_Orientation_SURF(cv::KeyPoint &kpt)
* Gaussian weighting is performed. The descriptor is inspired from Bay et al.,
* Speeded Up Robust Features, ECCV, 2006
*/
void KAZE::Get_SURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_SURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
{
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0;
float rx = 0.0, ry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, sample_x = 0.0, sample_y = 0.0;
@ -987,7 +987,7 @@ void KAZE::Get_SURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
* Gaussian weighting is performed. The descriptor is inspired from Bay et al.,
* Speeded Up Robust Features, ECCV, 2006
*/
void KAZE::Get_SURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc) {
void KAZEFeatures::Get_SURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc) {
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0;
float rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, len = 0.0, xf = 0.0, yf = 0.0;
@ -1094,7 +1094,7 @@ void KAZE::Get_SURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc) {
* from Agrawal et al., CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching,
* ECCV 2008
*/
void KAZE::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
{
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0, gauss_s1 = 0.0, gauss_s2 = 0.0;
float rx = 0.0, ry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, ys = 0.0, xs = 0.0;
@ -1226,7 +1226,7 @@ void KAZE::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
* from Agrawal et al., CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching,
* ECCV 2008
*/
void KAZE::Get_MSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_MSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
{
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0, gauss_s1 = 0.0, gauss_s2 = 0.0;
float rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, ys = 0.0, xs = 0.0;
@ -1359,7 +1359,7 @@ void KAZE::Get_MSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
* G-SURF descriptor as described in Pablo F. Alcantarilla, Luis M. Bergasa and
* Andrew J. Davison, Gauge-SURF Descriptors, Image and Vision Computing 31(1), 2013
*/
void KAZE::Get_GSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_GSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
{
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0;
float rx = 0.0, ry = 0.0, rxx = 0.0, rxy = 0.0, ryy = 0.0, len = 0.0, xf = 0.0, yf = 0.0;
@ -1494,7 +1494,7 @@ void KAZE::Get_GSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
* G-SURF descriptor as described in Pablo F. Alcantarilla, Luis M. Bergasa and
* Andrew J. Davison, Gauge-SURF Descriptors, Image and Vision Computing 31(1), 2013
*/
void KAZE::Get_GSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_GSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
{
float dx = 0.0, dy = 0.0, mdx = 0.0, mdy = 0.0;
float rx = 0.0, ry = 0.0, rxx = 0.0, rxy = 0.0, ryy = 0.0, len = 0.0, xf = 0.0, yf = 0.0;
@ -1633,7 +1633,7 @@ void KAZE::Get_GSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc)
* Gaussian weighting is performed. The descriptor is inspired from Bay et al.,
* Speeded Up Robust Features, ECCV, 2006
*/
void KAZE::Get_SURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_SURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
{
float rx = 0.0, ry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, sample_x = 0.0, sample_y = 0.0;
float fx = 0.0, fy = 0.0, res1 = 0.0, res2 = 0.0, res3 = 0.0, res4 = 0.0;
@ -1752,7 +1752,7 @@ void KAZE::Get_SURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
* Gaussian weighting is performed. The descriptor is inspired from Bay et al.,
* Speeded Up Robust Features, ECCV, 2006
*/
void KAZE::Get_SURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_SURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
{
float rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, len = 0.0, xf = 0.0, yf = 0.0;
float sample_x = 0.0, sample_y = 0.0, co = 0.0, si = 0.0, angle = 0.0;
@ -1880,7 +1880,7 @@ void KAZE::Get_SURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
* from Agrawal et al., CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching,
* ECCV 2008
*/
void KAZE::Get_MSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
void KAZEFeatures::Get_MSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
float gauss_s1 = 0.0, gauss_s2 = 0.0;
float rx = 0.0, ry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, ys = 0.0, xs = 0.0;
@ -2036,7 +2036,7 @@ void KAZE::Get_MSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc
* from Agrawal et al., CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching,
* ECCV 2008
*/
void KAZE::Get_MSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
void KAZEFeatures::Get_MSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
float gauss_s1 = 0.0, gauss_s2 = 0.0;
float rx = 0.0, ry = 0.0, rrx = 0.0, rry = 0.0, len = 0.0, xf = 0.0, yf = 0.0, ys = 0.0, xs = 0.0;
@ -2197,7 +2197,7 @@ void KAZE::Get_MSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
* G-SURF descriptor as described in Pablo F. Alcantarilla, Luis M. Bergasa and
* Andrew J. Davison, Gauge-SURF Descriptors, Image and Vision Computing 31(1), 2013
*/
void KAZE::Get_GSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
void KAZEFeatures::Get_GSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc)
{
float len = 0.0, xf = 0.0, yf = 0.0, sample_x = 0.0, sample_y = 0.0;
float rx = 0.0, ry = 0.0, rxx = 0.0, rxy = 0.0, ryy = 0.0, modg = 0.0;
@ -2350,7 +2350,7 @@ void KAZE::Get_GSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, float *desc
* G-SURF descriptor as described in Pablo F. Alcantarilla, Luis M. Bergasa and
* Andrew J. Davison, Gauge-SURF Descriptors, Image and Vision Computing 31(1), 2013
*/
void KAZE::Get_GSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
void KAZEFeatures::Get_GSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
float len = 0.0, xf = 0.0, yf = 0.0;
float rx = 0.0, ry = 0.0, rxx = 0.0, rxy = 0.0, ryy = 0.0;
@ -2509,7 +2509,7 @@ void KAZE::Get_GSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) {
* If c is a matrix of the same size as Ld, the diffusion will be nonlinear
* The stepsize can be arbitrarilly large
*/
void KAZE::AOS_Step_Scalar(cv::Mat &Ld, const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize) {
void KAZEFeatures::AOS_Step_Scalar(cv::Mat &Ld, const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize) {
#ifdef _OPENMP
#pragma omp sections
@ -2540,7 +2540,7 @@ void KAZE::AOS_Step_Scalar(cv::Mat &Ld, const cv::Mat &Ldprev, const cv::Mat &c,
* @param c Conductivity image
* @param stepsize Stepsize for the nonlinear diffusion evolution
*/
void KAZE::AOS_Rows(const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize) {
void KAZEFeatures::AOS_Rows(const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize) {
// Operate on rows
for (int i = 0; i < qr_.rows; i++) {
@ -2581,7 +2581,7 @@ void KAZE::AOS_Rows(const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsi
* @param c Conductivity image
* @param stepsize Stepsize for the nonlinear diffusion evolution
*/
void KAZE::AOS_Columns(const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize) {
void KAZEFeatures::AOS_Columns(const cv::Mat &Ldprev, const cv::Mat &c, const float& stepsize) {
// Operate on columns
for (int j = 0; j < qc_.cols; j++) {
@ -2624,7 +2624,7 @@ void KAZE::AOS_Columns(const cv::Mat &Ldprev, const cv::Mat &c, const float& ste
* @brief This method does the Thomas algorithm for solving a tridiagonal linear system
* @note The matrix A must be strictly diagonally dominant for a stable solution
*/
void KAZE::Thomas(const cv::Mat &a, const cv::Mat &b, const cv::Mat &Ld, cv::Mat &x) {
void KAZEFeatures::Thomas(const cv::Mat &a, const cv::Mat &b, const cv::Mat &Ld, cv::Mat &x) {
// Auxiliary variables
int n = a.rows;

@ -23,7 +23,7 @@
//*************************************************************************************
// KAZE Class Declaration
class KAZE {
class KAZEFeatures {
private:
@ -69,10 +69,10 @@ private:
public:
// Constructor
KAZE(KAZEOptions& options);
KAZEFeatures(KAZEOptions& options);
// Destructor
~KAZE(void);
~KAZEFeatures(void);
// Public methods for KAZE interface
void Allocate_Memory_Evolution(void);
@ -80,11 +80,6 @@ public:
void Feature_Detection(std::vector<cv::KeyPoint>& kpts);
void Feature_Description(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc);
// Methods for saving the scale space set of images and detector responses
void Save_Nonlinear_Scale_Space(void);
void Save_Detector_Responses(void);
void Save_Flow_Responses(void);
private:
// Feature Detection Methods

@ -6,8 +6,8 @@
* @author Pablo F. Alcantarilla
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
#ifndef __OPENCV_FEATURES_2D_KAZE_CONFIG_HPP__
#define __OPENCV_FEATURES_2D_KAZE_CONFIG_HPP__
//******************************************************************************
//******************************************************************************
@ -38,30 +38,30 @@
#define NMAX_CHAR 400
// Some default options
const float DEFAULT_SCALE_OFFSET = 1.60; // Base scale offset (sigma units)
const float DEFAULT_OCTAVE_MAX = 4.0; // Maximum octave evolution of the image 2^sigma (coarsest scale sigma units)
const int DEFAULT_NSUBLEVELS = 4; // Default number of sublevels per scale level
const float DEFAULT_DETECTOR_THRESHOLD = 0.001; // Detector response threshold to accept point
const float DEFAULT_MIN_DETECTOR_THRESHOLD = 0.00001; // Minimum Detector response threshold to accept point
const int DEFAULT_DESCRIPTOR_MODE = 1; // Descriptor Mode 0->SURF, 1->M-SURF
const bool DEFAULT_USE_FED = true; // 0->AOS, 1->FED
const bool DEFAULT_UPRIGHT = false; // Upright descriptors, not invariant to rotation
const bool DEFAULT_EXTENDED = false; // Extended descriptor, dimension 128
const bool DEFAULT_SAVE_SCALE_SPACE = false; // For saving the scale space images
const bool DEFAULT_VERBOSITY = false; // Verbosity level (0->no verbosity)
const bool DEFAULT_SHOW_RESULTS = true; // For showing the output image with the detected features plus some ratios
const bool DEFAULT_SAVE_KEYPOINTS = false; // For saving the list of keypoints
static const float DEFAULT_SCALE_OFFSET = 1.60; // Base scale offset (sigma units)
static const float DEFAULT_OCTAVE_MAX = 4.0; // Maximum octave evolution of the image 2^sigma (coarsest scale sigma units)
static const int DEFAULT_NSUBLEVELS = 4; // Default number of sublevels per scale level
static const float DEFAULT_DETECTOR_THRESHOLD = 0.001; // Detector response threshold to accept point
static const float DEFAULT_MIN_DETECTOR_THRESHOLD = 0.00001; // Minimum Detector response threshold to accept point
static const int DEFAULT_DESCRIPTOR_MODE = 1; // Descriptor Mode 0->SURF, 1->M-SURF
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
const float DEFAULT_SIGMA_SMOOTHING_DERIVATIVES = 1.0;
const float DEFAULT_KCONTRAST = .01;
const float KCONTRAST_PERCENTILE = 0.7;
const int KCONTRAST_NBINS = 300;
const bool COMPUTE_KCONTRAST = true;
const int DEFAULT_DIFFUSIVITY_TYPE = 1; // 0 -> PM G1, 1 -> PM G2, 2 -> Weickert
const bool USE_CLIPPING_NORMALIZATION = false;
const float CLIPPING_NORMALIZATION_RATIO = 1.6;
const int CLIPPING_NORMALIZATION_NITER = 5;
static const float DEFAULT_SIGMA_SMOOTHING_DERIVATIVES = 1.0;
static const float DEFAULT_KCONTRAST = .01;
static const float KCONTRAST_PERCENTILE = 0.7;
static const int KCONTRAST_NBINS = 300;
static const bool COMPUTE_KCONTRAST = true;
static const int DEFAULT_DIFFUSIVITY_TYPE = 1; // 0 -> PM G1, 1 -> PM G2, 2 -> Weickert
static const bool USE_CLIPPING_NORMALIZATION = false;
static const float CLIPPING_NORMALIZATION_RATIO = 1.6;
static const int CLIPPING_NORMALIZATION_NITER = 5;
//*************************************************************************************
//*************************************************************************************

Loading…
Cancel
Save