|
|
@ -137,10 +137,10 @@ typedef unsigned char uchar; |
|
|
|
template<bool isDefaultNum> |
|
|
|
template<bool isDefaultNum> |
|
|
|
__device__ __forceinline__ int fast_angle_bin(const float& dx, const float& dy) |
|
|
|
__device__ __forceinline__ int fast_angle_bin(const float& dx, const float& dy) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const float angle_quantum = CV_PI / 6.f; |
|
|
|
const float angle_quantum = CV_PI_F / 6.f; |
|
|
|
float angle = atan2(dx, dy) + (angle_quantum / 2.f); |
|
|
|
float angle = atan2(dx, dy) + (angle_quantum / 2.f); |
|
|
|
|
|
|
|
|
|
|
|
if (angle < 0) angle += CV_PI; |
|
|
|
if (angle < 0) angle += CV_PI_F; |
|
|
|
|
|
|
|
|
|
|
|
const float angle_scaling = 1.f / angle_quantum; |
|
|
|
const float angle_scaling = 1.f / angle_quantum; |
|
|
|
return static_cast<int>(angle * angle_scaling) % 6; |
|
|
|
return static_cast<int>(angle * angle_scaling) % 6; |
|
|
@ -174,8 +174,8 @@ typedef unsigned char uchar; |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i = 3; |
|
|
|
int i = 3; |
|
|
|
float2 bin_vector_i; |
|
|
|
float2 bin_vector_i; |
|
|
|
bin_vector_i.x = ::cos(i * (CV_PI / 6.f)); |
|
|
|
bin_vector_i.x = ::cos(i * (CV_PI_F / 6.f)); |
|
|
|
bin_vector_i.y = ::sin(i * (CV_PI / 6.f)); |
|
|
|
bin_vector_i.y = ::sin(i * (CV_PI_F / 6.f)); |
|
|
|
|
|
|
|
|
|
|
|
const float dot_product = fabs(dx * bin_vector_i.x + dy * bin_vector_i.y); |
|
|
|
const float dot_product = fabs(dx * bin_vector_i.x + dy * bin_vector_i.y); |
|
|
|
if(dot_product > max_dot) |
|
|
|
if(dot_product > max_dot) |
|
|
|