From 12f16b7a262862d56115ff38ca85bd438499f523 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 18 Apr 2013 10:10:55 +0400 Subject: [PATCH] nonfree module fixes --- modules/nonfree/CMakeLists.txt | 3 ++- modules/nonfree/include/opencv2/nonfree/gpu.hpp | 12 ++---------- modules/nonfree/perf/perf_gpu.cpp | 10 +++++++--- modules/nonfree/perf/perf_precomp.hpp | 5 ++--- modules/nonfree/src/cuda/surf.cu | 5 ++--- modules/nonfree/src/cuda/vibe.cu | 6 ------ modules/nonfree/src/precomp.hpp | 8 +++++--- modules/nonfree/src/surf_gpu.cpp | 10 +++------- modules/nonfree/src/vibe_gpu.cpp | 6 +----- modules/nonfree/test/test_gpu.cpp | 8 ++++++-- modules/nonfree/test/test_precomp.hpp | 2 +- 11 files changed, 31 insertions(+), 44 deletions(-) diff --git a/modules/nonfree/CMakeLists.txt b/modules/nonfree/CMakeLists.txt index 55f6b41..fa73931 100644 --- a/modules/nonfree/CMakeLists.txt +++ b/modules/nonfree/CMakeLists.txt @@ -3,4 +3,5 @@ if(BUILD_ANDROID_PACKAGE) endif() set(the_description "Functionality with possible limitations on the use") -ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpu opencv_ocl) +ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) +ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpuarithm opencv_ocl) diff --git a/modules/nonfree/include/opencv2/nonfree/gpu.hpp b/modules/nonfree/include/opencv2/nonfree/gpu.hpp index aa0c9cb..1be62b2 100644 --- a/modules/nonfree/include/opencv2/nonfree/gpu.hpp +++ b/modules/nonfree/include/opencv2/nonfree/gpu.hpp @@ -43,11 +43,7 @@ #ifndef __OPENCV_NONFREE_GPU_HPP__ #define __OPENCV_NONFREE_GPU_HPP__ -#include "opencv2/opencv_modules.hpp" - -#if defined(HAVE_OPENCV_GPU) - -#include "opencv2/gpu.hpp" +#include "opencv2/core/gpumat.hpp" namespace cv { namespace gpu { @@ -160,10 +156,6 @@ private: GpuMat samples_; }; -} // namespace gpu - -} // namespace cv - -#endif // defined(HAVE_OPENCV_GPU) +}} // namespace cv { namespace gpu { #endif // __OPENCV_NONFREE_GPU_HPP__ diff --git a/modules/nonfree/perf/perf_gpu.cpp b/modules/nonfree/perf/perf_gpu.cpp index eeaf5a7..3caa5a2 100644 --- a/modules/nonfree/perf/perf_gpu.cpp +++ b/modules/nonfree/perf/perf_gpu.cpp @@ -42,7 +42,7 @@ #include "perf_precomp.hpp" -#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) +#ifdef HAVE_CUDA #include "opencv2/ts/gpu_perf.hpp" @@ -65,6 +65,8 @@ using namespace perf; ////////////////////////////////////////////////////////////////////// // SURF +#ifdef HAVE_OPENCV_GPUARITHM + DEF_PARAM_TEST_1(Image, string); PERF_TEST_P(Image, GPU_SURF, @@ -108,6 +110,8 @@ PERF_TEST_P(Image, GPU_SURF, } } +#endif // HAVE_OPENCV_GPUARITHM + ////////////////////////////////////////////////////// // VIBE @@ -177,6 +181,6 @@ PERF_TEST_P(Video_Cn, GPU_VIBE, } } -#endif +#endif // BUILD_WITH_VIDEO_INPUT_SUPPORT -#endif +#endif // HAVE_CUDA diff --git a/modules/nonfree/perf/perf_precomp.hpp b/modules/nonfree/perf/perf_precomp.hpp index 13e1616..5e3f3c3 100644 --- a/modules/nonfree/perf/perf_precomp.hpp +++ b/modules/nonfree/perf/perf_precomp.hpp @@ -19,9 +19,8 @@ # include "opencv2/nonfree/ocl.hpp" #endif -#ifdef HAVE_OPENCV_GPU - #include "opencv2/nonfree/gpu.hpp" - #include "opencv2/ts/gpu_perf.hpp" +#ifdef HAVE_CUDA +# include "opencv2/nonfree/gpu.hpp" #endif #ifdef GTEST_CREATE_SHARED_LIBRARY diff --git a/modules/nonfree/src/cuda/surf.cu b/modules/nonfree/src/cuda/surf.cu index 46e8d2e..cdd54e4 100644 --- a/modules/nonfree/src/cuda/surf.cu +++ b/modules/nonfree/src/cuda/surf.cu @@ -42,7 +42,7 @@ #include "opencv2/opencv_modules.hpp" -#ifdef HAVE_OPENCV_GPU +#ifdef HAVE_OPENCV_GPUARITHM #include "opencv2/core/cuda/common.hpp" #include "opencv2/core/cuda/limits.hpp" @@ -957,5 +957,4 @@ namespace cv { namespace gpu { namespace cudev } // namespace surf }}} // namespace cv { namespace gpu { namespace cudev - -#endif /* CUDA_DISABLER */ +#endif // HAVE_OPENCV_GPUARITHM diff --git a/modules/nonfree/src/cuda/vibe.cu b/modules/nonfree/src/cuda/vibe.cu index b896e6a..951b964 100644 --- a/modules/nonfree/src/cuda/vibe.cu +++ b/modules/nonfree/src/cuda/vibe.cu @@ -40,10 +40,6 @@ // //M*/ -#include "opencv2/opencv_modules.hpp" - -#ifdef HAVE_OPENCV_GPU - #include "opencv2/core/cuda/common.hpp" namespace cv { namespace gpu { namespace cudev @@ -267,5 +263,3 @@ namespace cv { namespace gpu { namespace cudev } } }}} - -#endif diff --git a/modules/nonfree/src/precomp.hpp b/modules/nonfree/src/precomp.hpp index cc0098c..f89e156 100644 --- a/modules/nonfree/src/precomp.hpp +++ b/modules/nonfree/src/precomp.hpp @@ -49,11 +49,13 @@ #include "opencv2/core/utility.hpp" #include "opencv2/core/private.hpp" +#include "opencv2/nonfree/gpu.hpp" +#include "opencv2/core/gpu_private.hpp" + #include "opencv2/opencv_modules.hpp" -#ifdef HAVE_OPENCV_GPU -# include "opencv2/nonfree/gpu.hpp" -# include "opencv2/core/gpu_private.hpp" +#ifdef HAVE_OPENCV_GPUARITHM +# include "opencv2/gpuarithm.hpp" #endif #ifdef HAVE_OPENCV_OCL diff --git a/modules/nonfree/src/surf_gpu.cpp b/modules/nonfree/src/surf_gpu.cpp index 328b3cb..ace9bb5 100644 --- a/modules/nonfree/src/surf_gpu.cpp +++ b/modules/nonfree/src/surf_gpu.cpp @@ -42,12 +42,10 @@ #include "precomp.hpp" -#if defined(HAVE_OPENCV_GPU) - using namespace cv; using namespace cv::gpu; -#if !defined (HAVE_CUDA) +#if !defined (HAVE_CUDA) || !defined (HAVE_OPENCV_GPUARITHM) cv::gpu::SURF_GPU::SURF_GPU() { throw_no_cuda(); } cv::gpu::SURF_GPU::SURF_GPU(double, int, int, bool, float, bool) { throw_no_cuda(); } @@ -144,13 +142,13 @@ namespace bindImgTex(img); - integralBuffered(img, surf_.sum, surf_.intBuffer); + gpu::integralBuffered(img, surf_.sum, surf_.intBuffer); sumOffset = bindSumTex(surf_.sum); if (use_mask) { min(mask, 1.0, surf_.mask1); - integralBuffered(surf_.mask1, surf_.maskSum, surf_.intBuffer); + gpu::integralBuffered(surf_.mask1, surf_.maskSum, surf_.intBuffer); maskOffset = bindMaskSumTex(surf_.maskSum); } } @@ -421,5 +419,3 @@ void cv::gpu::SURF_GPU::releaseMemory() } #endif // !defined (HAVE_CUDA) - -#endif // defined(HAVE_OPENCV_GPU) diff --git a/modules/nonfree/src/vibe_gpu.cpp b/modules/nonfree/src/vibe_gpu.cpp index 6bf9938..2d291fb 100644 --- a/modules/nonfree/src/vibe_gpu.cpp +++ b/modules/nonfree/src/vibe_gpu.cpp @@ -42,9 +42,7 @@ #include "precomp.hpp" -#if defined(HAVE_OPENCV_GPU) - -#if !defined HAVE_CUDA || defined(CUDA_DISABLER) +#ifndef HAVE_CUDA cv::gpu::VIBE_GPU::VIBE_GPU(unsigned long) { throw_no_cuda(); } void cv::gpu::VIBE_GPU::initialize(const GpuMat&, Stream&) { throw_no_cuda(); } @@ -137,5 +135,3 @@ void cv::gpu::VIBE_GPU::release() } #endif - -#endif // defined(HAVE_OPENCV_GPU) diff --git a/modules/nonfree/test/test_gpu.cpp b/modules/nonfree/test/test_gpu.cpp index 30aec35..42b2d06 100644 --- a/modules/nonfree/test/test_gpu.cpp +++ b/modules/nonfree/test/test_gpu.cpp @@ -42,13 +42,15 @@ #include "test_precomp.hpp" -#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) +#ifdef HAVE_CUDA using namespace cvtest; ///////////////////////////////////////////////////////////////////////////////////////////////// // SURF +#ifdef HAVE_OPENCV_GPUARITHM + namespace { IMPLEMENT_PARAM_CLASS(SURF_HessianThreshold, double) @@ -191,6 +193,8 @@ INSTANTIATE_TEST_CASE_P(GPU_Features2D, SURF, testing::Combine( testing::Values(SURF_Extended(false), SURF_Extended(true)), testing::Values(SURF_Upright(false), SURF_Upright(true)))); +#endif // HAVE_OPENCV_GPUARITHM + ////////////////////////////////////////////////////// // VIBE @@ -229,4 +233,4 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, VIBE, testing::Combine( testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4)), WHOLE_SUBMAT)); -#endif +#endif // HAVE_CUDA diff --git a/modules/nonfree/test/test_precomp.hpp b/modules/nonfree/test/test_precomp.hpp index cacf372..563dad4 100644 --- a/modules/nonfree/test/test_precomp.hpp +++ b/modules/nonfree/test/test_precomp.hpp @@ -24,7 +24,7 @@ # include "opencv2/nonfree/ocl.hpp" #endif -#ifdef HAVE_OPENCV_GPU +#ifdef HAVE_CUDA # include "opencv2/nonfree/gpu.hpp" #endif -- 2.7.4