mirror of
https://github.com/opencv/opencv.git
synced 2025-06-08 01:53:19 +08:00
akaze: getAngle() -> fastAtan2()
This commit is contained in:
parent
6847cc9f1c
commit
f6ceeaa2e5
@ -606,7 +606,7 @@ void KAZEFeatures::Compute_Main_Orientation(KeyPoint &kpt, const std::vector<TEv
|
|||||||
resY[idx] = 0.0;
|
resY[idx] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ang[idx] = getAngle(resX[idx], resY[idx]);
|
Ang[idx] = fastAtan2(resX[idx], resY[idx]) * (float)(CV_PI / 180.0f);
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ void KAZEFeatures::Compute_Main_Orientation(KeyPoint &kpt, const std::vector<TEv
|
|||||||
if (sumX*sumX + sumY*sumY > max) {
|
if (sumX*sumX + sumY*sumY > max) {
|
||||||
// store largest orientation
|
// store largest orientation
|
||||||
max = sumX*sumX + sumY*sumY;
|
max = sumX*sumX + sumY*sumY;
|
||||||
kpt.angle = getAngle(sumX, sumY) * 180.f / static_cast<float>(CV_PI);
|
kpt.angle = fastAtan2(sumX, sumY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,6 @@
|
|||||||
#ifndef __OPENCV_FEATURES_2D_KAZE_UTILS_H__
|
#ifndef __OPENCV_FEATURES_2D_KAZE_UTILS_H__
|
||||||
#define __OPENCV_FEATURES_2D_KAZE_UTILS_H__
|
#define __OPENCV_FEATURES_2D_KAZE_UTILS_H__
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
/**
|
|
||||||
* @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
|
* @brief This function computes the value of a 2D Gaussian function
|
||||||
|
Loading…
Reference in New Issue
Block a user