1
#ifndef __OPENCV_FEATURES_2D_KAZE_UTILS_H__
2
#define __OPENCV_FEATURES_2D_KAZE_UTILS_H__
4
/* ************************************************************************* */
6
* @brief This function computes the angle from the vector given by (X Y). From 0 to 2*Pi
8
inline float getAngle(float x, float y) {
10
if (x >= 0 && y >= 0) {
14
if (x < 0 && y >= 0) {
15
return static_cast<float>(CV_PI)-atanf(-y / x);
19
return static_cast<float>(CV_PI)+atanf(y / x);
22
if (x >= 0 && y < 0) {
23
return static_cast<float>(2.0 * CV_PI) - atanf(-y / x);
29
/* ************************************************************************* */
31
* @brief This function computes the value of a 2D Gaussian function
34
* @param sig Standard Deviation
36
inline float gaussian(float x, float y, float sigma) {
37
return expf(-(x*x + y*y) / (2.0f*sigma*sigma));
40
/* ************************************************************************* */
42
* @brief This function checks descriptor limits
45
* @param width Image width
46
* @param height Image height
48
inline void checkDescriptorLimits(int &x, int &y, int width, int height) {
67
/* ************************************************************************* */
69
* @brief This funtion rounds float to nearest integer
70
* @param flt Input float
71
* @return dst Nearest integer
73
inline int fRound(float flt) {
74
return (int)(flt + 0.5f);
77
/* ************************************************************************* */
79
* @brief Exponentiation by squaring
80
* @param flt Exponentiation base
81
* @return dst Exponentiation value
83
inline int fastpow(int base, int exp) {