1 /**
2  * @file AKAZE.h
3  * @brief Main class for detecting and computing binary descriptors in an
4  * accelerated nonlinear scale space
5  * @date Mar 27, 2013
6  * @author Pablo F. Alcantarilla, Jesus Nuevo
7  */
8 
9 #ifndef __OPENCV_FEATURES_2D_AKAZE_FEATURES_H__
10 #define __OPENCV_FEATURES_2D_AKAZE_FEATURES_H__
11 
12 /* ************************************************************************* */
13 // Includes
14 #include "AKAZEConfig.h"
15 #include "TEvolution.h"
16 
17 namespace cv
18 {
19 
20 /* ************************************************************************* */
21 // AKAZE Class Declaration
22 class AKAZEFeatures {
23 
24 private:
25 
26   AKAZEOptions options_;                ///< Configuration options for AKAZE
27   std::vector<TEvolution> evolution_;        ///< Vector of nonlinear diffusion evolution
28 
29   /// FED parameters
30   int ncycles_;                  ///< Number of cycles
31   bool reordering_;              ///< Flag for reordering time steps
32   std::vector<std::vector<float > > tsteps_;  ///< Vector of FED dynamic time steps
33   std::vector<int> nsteps_;      ///< Vector of number of steps per cycle
34 
35   /// Matrices for the M-LDB descriptor computation
36   cv::Mat descriptorSamples_;  // List of positions in the grids to sample LDB bits from.
37   cv::Mat descriptorBits_;
38   cv::Mat bitMask_;
39 
40 public:
41 
42   /// Constructor with input arguments
43   AKAZEFeatures(const AKAZEOptions& options);
44 
45   /// Scale Space methods
46   void Allocate_Memory_Evolution();
47   int Create_Nonlinear_Scale_Space(const cv::Mat& img);
48   void Feature_Detection(std::vector<cv::KeyPoint>& kpts);
49   void Compute_Determinant_Hessian_Response(void);
50   void Compute_Multiscale_Derivatives(void);
51   void Find_Scale_Space_Extrema(std::vector<cv::KeyPoint>& kpts);
52   void Do_Subpixel_Refinement(std::vector<cv::KeyPoint>& kpts);
53 
54   /// Feature description methods
55   void Compute_Descriptors(std::vector<cv::KeyPoint>& kpts, cv::Mat& desc);
56   static void Compute_Main_Orientation(cv::KeyPoint& kpt, const std::vector<TEvolution>& evolution_);
57 };
58 
59 /* ************************************************************************* */
60 /// Inline functions
61 void generateDescriptorSubsample(cv::Mat& sampleList, cv::Mat& comparisons,
62                                  int nbits, int pattern_size, int nchannels);
63 
64 }
65 
66 #endif
67