From bb23288c3db0d16b4cdd1e98b549dd77313cda9d Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 30 Jan 2012 07:59:14 +0000 Subject: [PATCH] fixed bug in SURF_GPU --- modules/gpu/src/cuda/surf.cu | 8 +++----- modules/gpu/src/surf.cpp | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/gpu/src/cuda/surf.cu b/modules/gpu/src/cuda/surf.cu index 1325c95e32..67d474dd9e 100644 --- a/modules/gpu/src/cuda/surf.cu +++ b/modules/gpu/src/cuda/surf.cu @@ -503,9 +503,7 @@ namespace cv { namespace gpu { namespace device __constant__ float c_NY[2][5] = {{0, 0, 4, 2, 1}, {0, 2, 4, 4, -1}}; __global__ void icvCalcOrientation(const float* featureX, const float* featureY, const float* featureSize, float* featureDir) - { - #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 110 - + { __shared__ float s_X[128]; __shared__ float s_Y[128]; __shared__ float s_angle[128]; @@ -597,6 +595,8 @@ namespace cv { namespace gpu { namespace device bestx = sumx; besty = sumy; } + + __syncthreads(); } if (threadIdx.x == 0) @@ -642,8 +642,6 @@ namespace cv { namespace gpu { namespace device featureDir[blockIdx.x] = kp_dir; } } - - #endif } #undef ORI_SEARCH_INC diff --git a/modules/gpu/src/surf.cpp b/modules/gpu/src/surf.cpp index b833312635..a083200763 100644 --- a/modules/gpu/src/surf.cpp +++ b/modules/gpu/src/surf.cpp @@ -200,7 +200,9 @@ namespace keypoints.cols = featureCounter; - if (!upright) + if (upright) + keypoints.row(SURF_GPU::SF_DIR).setTo(Scalar::all(90.0)); + else findOrientation(keypoints); }