diff --git a/modules/cuda_efficient_features/src/cuda_efficient_features.cpp b/modules/cuda_efficient_features/src/cuda_efficient_features.cpp index 1a498c4..6b43337 100644 --- a/modules/cuda_efficient_features/src/cuda_efficient_features.cpp +++ b/modules/cuda_efficient_features/src/cuda_efficient_features.cpp @@ -181,14 +181,6 @@ static void createMask(GpuMat& mask, Size imgSize, int border, Stream& stream) mask(ROI).setTo(Scalar::all(255), stream); } -static inline float convertToDegree(float angle) -{ - constexpr float PI = static_cast(CV_PI); - if (angle < 0) - angle += 2.f * PI; - return (180.f / PI) * angle; -} - class EfficientFeaturesImpl : public EfficientFeatures { public: @@ -349,7 +341,7 @@ class EfficientFeaturesImpl : public EfficientFeatures KeyPoint kpt; kpt.pt = Point2f(points[i][0], points[i][1]); kpt.response = responses[i]; - kpt.angle = convertToDegree(angles[i]); + kpt.angle = angles[i]; kpt.octave = octaves[i]; kpt.size = sizes[i]; dst[i] = kpt; diff --git a/modules/cuda_efficient_features/src/cuda_efficient_features.cu b/modules/cuda_efficient_features/src/cuda_efficient_features.cu index 54b5d04..edfc697 100644 --- a/modules/cuda_efficient_features/src/cuda_efficient_features.cu +++ b/modules/cuda_efficient_features/src/cuda_efficient_features.cu @@ -51,6 +51,14 @@ static __device__ inline int distanceSq(short2 pt1, short2 pt2) return dx * dx + dy * dy; } +static __device__ inline float convertToDegree(float angle) +{ + constexpr float PI = static_cast(CV_PI); + if (angle < 0) + angle += 2.f * PI; + return (180.f / PI) * angle; +} + static __device__ inline bool IsMaxPoint(int idx1, const short2* points, const float* responses, const int* blockPtr, const int* pointIds, int gridW, int gridH, int imageRadius, int blockRadius) { @@ -160,7 +168,7 @@ static __device__ float IC_Angle(PtrStepb image, short2 pt) m_01 += dy * y_sum; } - return ::atan2f((float)m_01, (float)m_10); + return convertToDegree(::atan2f((float)m_01, (float)m_10)); } __global__ void nptPerBlockKernel(const short2* points, int npoints, int* nptPerBlock, int gridStep)