Skip to content

Commit f6ceeaa

Browse files
committed
akaze: getAngle() -> fastAtan2()
1 parent 6847cc9 commit f6ceeaa

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

modules/features2d/src/kaze/KAZEFeatures.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void KAZEFeatures::Compute_Main_Orientation(KeyPoint &kpt, const std::vector<TEv
606606
resY[idx] = 0.0;
607607
}
608608

609-
Ang[idx] = getAngle(resX[idx], resY[idx]);
609+
Ang[idx] = fastAtan2(resX[idx], resY[idx]) * (float)(CV_PI / 180.0f);
610610
++idx;
611611
}
612612
}
@@ -638,7 +638,7 @@ void KAZEFeatures::Compute_Main_Orientation(KeyPoint &kpt, const std::vector<TEv
638638
if (sumX*sumX + sumY*sumY > max) {
639639
// store largest orientation
640640
max = sumX*sumX + sumY*sumY;
641-
kpt.angle = getAngle(sumX, sumY) * 180.f / static_cast<float>(CV_PI);
641+
kpt.angle = fastAtan2(sumX, sumY);
642642
}
643643
}
644644
}

modules/features2d/src/kaze/utils.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
#ifndef __OPENCV_FEATURES_2D_KAZE_UTILS_H__
22
#define __OPENCV_FEATURES_2D_KAZE_UTILS_H__
33

4-
/* ************************************************************************* */
5-
/**
6-
* @brief This function computes the angle from the vector given by (X Y). From 0 to 2*Pi
7-
*/
8-
inline float getAngle(float x, float y) {
9-
10-
if (x >= 0 && y >= 0) {
11-
return atanf(y / x);
12-
}
13-
14-
if (x < 0 && y >= 0) {
15-
return static_cast<float>(CV_PI)-atanf(-y / x);
16-
}
17-
18-
if (x < 0 && y < 0) {
19-
return static_cast<float>(CV_PI)+atanf(y / x);
20-
}
21-
22-
if (x >= 0 && y < 0) {
23-
return static_cast<float>(2.0 * CV_PI) - atanf(-y / x);
24-
}
25-
26-
return 0;
27-
}
28-
294
/* ************************************************************************* */
305
/**
316
* @brief This function computes the value of a 2D Gaussian function

0 commit comments

Comments
 (0)