fixed build under linux
authorVladislav Vinogradov <no@email>
Mon, 13 Feb 2012 13:19:06 +0000 (13:19 +0000)
committerVladislav Vinogradov <no@email>
Mon, 13 Feb 2012 13:19:06 +0000 (13:19 +0000)
added PyrLKOpticalFlowDense performance test

modules/gpu/CMakeLists.txt
modules/gpu/perf/perf_video.cpp
modules/gpu/src/cuda/surf.cu

index 70428a4..c5576e6 100644 (file)
@@ -3,7 +3,7 @@ if(ANDROID OR IOS)
 endif()
 
 set(the_description "GPU-accelerated Computer Vision")
-ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect)
+ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect opencv_video)
 
 ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda")
 
index b349bc5..4ba1780 100644 (file)
@@ -193,4 +193,36 @@ INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine
                             testing::Values(17, 21)\r
                         ));\r
 \r
+//////////////////////////////////////////////////////\r
+// PyrLKOpticalFlowDense\r
+\r
+GPU_PERF_TEST_1(PyrLKOpticalFlowDense, cv::gpu::DeviceInfo)\r
+{\r
+    cv::gpu::DeviceInfo devInfo = GetParam();\r
+\r
+    cv::gpu::setDevice(devInfo.deviceID());\r
+\r
+    cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
+    cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);\r
+\r
+    ASSERT_FALSE(frame0_host.empty());\r
+    ASSERT_FALSE(frame1_host.empty());\r
+\r
+    cv::gpu::GpuMat frame0(frame0_host);\r
+    cv::gpu::GpuMat frame1(frame1_host);\r
+    cv::gpu::GpuMat u; \r
+    cv::gpu::GpuMat v;\r
+\r
+    cv::gpu::PyrLKOpticalFlow pyrLK;\r
+\r
+    declare.time(10);\r
+\r
+    TEST_CYCLE()\r
+    {\r
+        pyrLK.dense(frame0, frame1, u, v);\r
+    }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowDense, ALL_DEVICES);\r
+\r
 #endif\r
index 67d474d..9d265cc 100644 (file)
@@ -541,8 +541,8 @@ namespace cv { namespace gpu { namespace device
                     \r
                         angle = atan2f(Y, X);\r
                         if (angle < 0)\r
-                            angle += 2.0f * CV_PI;\r
-                        angle *= 180.0f / CV_PI;\r
+                            angle += 2.0f * CV_PI_F;\r
+                        angle *= 180.0f / CV_PI_F;\r
                     }\r
                 }\r
                 s_X[tid] = X;\r
@@ -636,8 +636,8 @@ namespace cv { namespace gpu { namespace device
                 {\r
                     float kp_dir = atan2f(besty, bestx);\r
                     if (kp_dir < 0)\r
-                        kp_dir += 2.0f * CV_PI;\r
-                    kp_dir *= 180.0f / CV_PI;\r
+                        kp_dir += 2.0f * CV_PI_F;\r
+                    kp_dir *= 180.0f / CV_PI_F;\r
 \r
                     featureDir[blockIdx.x] = kp_dir;\r
                 }\r
@@ -724,7 +724,7 @@ namespace cv { namespace gpu { namespace device
             const float centerX = featureX[blockIdx.x];\r
             const float centerY = featureY[blockIdx.x];\r
             const float size = featureSize[blockIdx.x];\r
-            const float descriptor_dir = featureDir[blockIdx.x] * (float)(CV_PI / 180);\r
+            const float descriptor_dir = featureDir[blockIdx.x] * (float)(CV_PI_F / 180.0f);\r
 \r
             /* The sampling intervals and wavelet sized for selecting an orientation\r
              and building the keypoint descriptor are defined relative to 's' */\r
@@ -817,6 +817,7 @@ namespace cv { namespace gpu { namespace device
             calc_dx_dy(sdx, sdy, featureX, featureY, featureSize, featureDir);\r
             __syncthreads();\r
 \r
+\r
             const int tid = threadIdx.y * blockDim.x + threadIdx.x;\r
 \r
             if (tid < 25)\r