Commit c1bf4532 authored by Ievgen Khvedchenia's avatar Ievgen Khvedchenia

Wrapped nldiffusion functions with details::kaze or details::amaze namespace to…

Wrapped nldiffusion functions with details::kaze or details::amaze namespace to avoid collision of function names
parent c68cbfce
...@@ -114,7 +114,7 @@ struct AKAZEOptions { ...@@ -114,7 +114,7 @@ struct AKAZEOptions {
float kcontrast; ///< The contrast factor parameter float kcontrast; ///< The contrast factor parameter
float kcontrast_percentile; ///< Percentile level for the contrast factor float kcontrast_percentile; ///< Percentile level for the contrast factor
size_t kcontrast_nbins; ///< Number of bins for the contrast factor histogram 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_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 save_keypoints; ///< Set to true for saving the detected keypoints and descriptors
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
using namespace std; using namespace std;
using namespace cv; using namespace cv;
using namespace cv::details::akaze;
/* ************************************************************************* */ /* ************************************************************************* */
/** /**
...@@ -110,8 +111,7 @@ int AKAZEFeatures::Create_Nonlinear_Scale_Space(const cv::Mat& img) { ...@@ -110,8 +111,7 @@ int AKAZEFeatures::Create_Nonlinear_Scale_Space(const cv::Mat& img) {
evolution_[0].Lt.copyTo(evolution_[0].Lsmooth); evolution_[0].Lt.copyTo(evolution_[0].Lsmooth);
// First compute the kcontrast factor // First compute the kcontrast factor
options_.kcontrast = compute_k_percentile(img, options_.kcontrast_percentile, options_.kcontrast = compute_k_percentile(img, options_.kcontrast_percentile, 1.0f, options_.kcontrast_nbins, 0, 0);
1.0f, options_.kcontrast_nbins, 0, 0);
//t2 = cv::getTickCount(); //t2 = cv::getTickCount();
//timing_.kcontrast = 1000.0*(t2 - t1) / cv::getTickFrequency(); //timing_.kcontrast = 1000.0*(t2 - t1) / cv::getTickFrequency();
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
* @author Pablo F. Alcantarilla, Jesus Nuevo * @author Pablo F. Alcantarilla, Jesus Nuevo
*/ */
#pragma once #ifndef AKAZE_NLDIFFUSION_FUNCTIONS_H
#define AKAZE_NLDIFFUSION_FUNCTIONS_H
/* ************************************************************************* */ /* ************************************************************************* */
// Includes // Includes
...@@ -13,20 +14,27 @@ ...@@ -13,20 +14,27 @@
/* ************************************************************************* */ /* ************************************************************************* */
// Declaration of functions // Declaration of functions
void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, const size_t& ksize_x,
const size_t& ksize_y, const float& sigma); namespace cv {
void image_derivatives_scharr(const cv::Mat& src, cv::Mat& dst, namespace details {
const size_t& xorder, const size_t& yorder); namespace akaze {
void pm_g1(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k);
void pm_g2(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k); void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, int ksize_x, int ksize_y, float sigma);
void weickert_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k); void image_derivatives_scharr(const cv::Mat& src, cv::Mat& dst, int xorder, int yorder);
void charbonnier_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k); void pm_g1(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k);
float compute_k_percentile(const cv::Mat& img, float perc, float gscale, void pm_g2(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k);
size_t nbins, size_t ksize_x, size_t ksize_y); void weickert_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k);
void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int, int scale); void charbonnier_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k);
void nld_step_scalar(cv::Mat& Ld, const cv::Mat& c, cv::Mat& Lstep, const float& stepsize); float compute_k_percentile(const cv::Mat& img, float perc, float gscale, int nbins, int ksize_x, int ksize_y);
void downsample_image(const cv::Mat& src, cv::Mat& dst); void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int, int scale);
void halfsample_image(const cv::Mat& src, cv::Mat& dst); void nld_step_scalar(cv::Mat& Ld, const cv::Mat& c, cv::Mat& Lstep, const float& stepsize);
void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, int dx, int dy, int scale); void downsample_image(const cv::Mat& src, cv::Mat& dst);
bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value, void halfsample_image(const cv::Mat& src, cv::Mat& dst);
int row, int col, bool same_img); void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, int dx, int dy, int scale);
bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value, int row, int col, bool same_img);
}
}
}
#endif
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
// Namespaces // Namespaces
using namespace std; using namespace std;
using namespace cv; using namespace cv;
using namespace cv::details::kaze;
//******************************************************************************* //*******************************************************************************
//******************************************************************************* //*******************************************************************************
......
/** /**
* @file nldiffusion_functions.h * @file nldiffusion_functions.h
* @brief Functions for non-linear diffusion applications: * @brief Functions for non-linear diffusion applications:
...@@ -9,43 +8,40 @@ ...@@ -9,43 +8,40 @@
* @author Pablo F. Alcantarilla * @author Pablo F. Alcantarilla
*/ */
#ifndef NLDIFFUSION_FUNCTIONS_H_ #ifndef KAZE_NLDIFFUSION_FUNCTIONS_H
#define NLDIFFUSION_FUNCTIONS_H_ #define KAZE_NLDIFFUSION_FUNCTIONS_H
//******************************************************************************
//******************************************************************************
// Includes // Includes
#include "config.h" #include "precomp.hpp"
//************************************************************************************* //*************************************************************************************
//************************************************************************************* //*************************************************************************************
// Gaussian 2D convolution namespace cv {
void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, namespace details {
int ksize_x, int ksize_y, float sigma); namespace kaze {
// Diffusivity functions // Gaussian 2D convolution
void pm_g1(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, float k); void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, int ksize_x, int ksize_y, float sigma);
void pm_g2(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, float k);
void weickert_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, float k);
float compute_k_percentile(const cv::Mat& img, float perc, float gscale,
int nbins, int ksize_x, int ksize_y);
// Image derivatives // Diffusivity functions
void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, void pm_g1(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, float k);
int xorder, int yorder, int scale); void pm_g2(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, float k);
void compute_derivative_kernels(cv::OutputArray _kx, cv::OutputArray _ky, void weickert_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, float k);
int dx, int dy, int scale); float compute_k_percentile(const cv::Mat& img, float perc, float gscale, int nbins, int ksize_x, int ksize_y);
// Nonlinear diffusion filtering scalar step // Image derivatives
void nld_step_scalar(cv::Mat& Ld, const cv::Mat& c, cv::Mat& Lstep, float stepsize); void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int yorder, int scale);
void compute_derivative_kernels(cv::OutputArray _kx, cv::OutputArray _ky, int dx, int dy, int scale);
// For non-maxima suppresion // Nonlinear diffusion filtering scalar step
bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value, void nld_step_scalar(cv::Mat& Ld, const cv::Mat& c, cv::Mat& Lstep, float stepsize);
int row, int col, bool same_img);
//************************************************************************************* // For non-maxima suppresion
//************************************************************************************* bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value, int row, int col, bool same_img);
}
}
}
#endif // NLDIFFUSION_FUNCTIONS_H_ #endif
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