[opencv] 240/251: akaze: getAngle() -> fastAtan2()

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.

commit f6ceeaa2e5e5dde19a3dcc1320e1a9d29e8b9fba
Author: Alexander Alekhin <alexander.alekhin at intel.com>
Date:   Thu Aug 3 17:24:01 2017 +0300

    akaze: getAngle() -> fastAtan2()
---
 modules/features2d/src/kaze/KAZEFeatures.cpp |  4 ++--
 modules/features2d/src/kaze/utils.h          | 25 -------------------------
 2 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/modules/features2d/src/kaze/KAZEFeatures.cpp b/modules/features2d/src/kaze/KAZEFeatures.cpp
index 29d85d3..bbefd4d 100644
--- a/modules/features2d/src/kaze/KAZEFeatures.cpp
+++ b/modules/features2d/src/kaze/KAZEFeatures.cpp
@@ -606,7 +606,7 @@ void KAZEFeatures::Compute_Main_Orientation(KeyPoint &kpt, const std::vector<TEv
                     resY[idx] = 0.0;
                 }
 
-                Ang[idx] = getAngle(resX[idx], resY[idx]);
+                Ang[idx] = fastAtan2(resX[idx], resY[idx]) * (float)(CV_PI / 180.0f);
                 ++idx;
             }
         }
@@ -638,7 +638,7 @@ void KAZEFeatures::Compute_Main_Orientation(KeyPoint &kpt, const std::vector<TEv
         if (sumX*sumX + sumY*sumY > max) {
             // store largest orientation
             max = sumX*sumX + sumY*sumY;
-            kpt.angle = getAngle(sumX, sumY) * 180.f / static_cast<float>(CV_PI);
+            kpt.angle = fastAtan2(sumX, sumY);
         }
     }
 }
diff --git a/modules/features2d/src/kaze/utils.h b/modules/features2d/src/kaze/utils.h
index d9bfbe4..d7af55e 100644
--- a/modules/features2d/src/kaze/utils.h
+++ b/modules/features2d/src/kaze/utils.h
@@ -3,31 +3,6 @@
 
 /* ************************************************************************* */
 /**
- * @brief This function computes the angle from the vector given by (X Y). From 0 to 2*Pi
- */
-inline float getAngle(float x, float y) {
-
-  if (x >= 0 && y >= 0) {
-    return atanf(y / x);
-  }
-
-  if (x < 0 && y >= 0) {
-    return static_cast<float>(CV_PI)-atanf(-y / x);
-  }
-
-  if (x < 0 && y < 0) {
-    return static_cast<float>(CV_PI)+atanf(y / x);
-  }
-
-  if (x >= 0 && y < 0) {
-    return static_cast<float>(2.0 * CV_PI) - atanf(-y / x);
-  }
-
-  return 0;
-}
-
-/* ************************************************************************* */
-/**
  * @brief This function computes the value of a 2D Gaussian function
  * @param x X Position
  * @param y Y Position

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list