From: Vladislav Vinogradov Date: Thu, 18 Apr 2013 06:11:14 +0000 (+0400) Subject: superres module fixes X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3908^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=033dd77504198dfe79bd999085cc135b0a88d489;p=platform%2Fupstream%2Fopencv.git superres module fixes --- diff --git a/modules/superres/CMakeLists.txt b/modules/superres/CMakeLists.txt index 378a2a9..065d8ce 100644 --- a/modules/superres/CMakeLists.txt +++ b/modules/superres/CMakeLists.txt @@ -4,4 +4,6 @@ endif() set(the_description "Super Resolution") ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 -Wundef) -ocv_define_module(superres opencv_imgproc opencv_video OPTIONAL opencv_highgui opencv_gpu opencv_gpuarithm opencv_gpufilters opencv_gpucodec) +ocv_define_module(superres opencv_imgproc opencv_video + OPTIONAL opencv_highgui + opencv_gpuarithm opencv_gpufilters opencv_gpuwarping opencv_gpuimgproc opencv_gpuoptflow opencv_gpucodec) diff --git a/modules/superres/src/btv_l1_gpu.cpp b/modules/superres/src/btv_l1_gpu.cpp index a3f1132..6813187 100644 --- a/modules/superres/src/btv_l1_gpu.cpp +++ b/modules/superres/src/btv_l1_gpu.cpp @@ -50,7 +50,7 @@ using namespace cv::gpu; using namespace cv::superres; using namespace cv::superres::detail; -#if !defined(HAVE_CUDA) || !defined(HAVE_OPENCV_GPU) +#if !defined(HAVE_CUDA) || !defined(HAVE_OPENCV_GPUARITHM) || !defined(HAVE_OPENCV_GPUWARPING) || !defined(HAVE_OPENCV_GPUFILTERS) Ptr cv::superres::createSuperResolution_BTVL1_GPU() { @@ -266,7 +266,12 @@ namespace btvKernelSize_ = 7; blurKernelSize_ = 5; blurSigma_ = 0.0; + +#ifdef HAVE_OPENCV_GPUOPTFLOW opticalFlow_ = createOptFlow_Farneback_GPU(); +#else + opticalFlow_ = createOptFlow_Farneback(); +#endif curBlurKernelSize_ = -1; curBlurSigma_ = -1.0; diff --git a/modules/superres/src/cuda/btv_l1_gpu.cu b/modules/superres/src/cuda/btv_l1_gpu.cu index 58e46fa..22b3e0a 100644 --- a/modules/superres/src/cuda/btv_l1_gpu.cu +++ b/modules/superres/src/cuda/btv_l1_gpu.cu @@ -40,6 +40,10 @@ // //M*/ +#include "opencv2/opencv_modules.hpp" + +#if defined(HAVE_OPENCV_GPUARITHM) && defined(HAVE_OPENCV_GPUWARPING) && defined(HAVE_OPENCV_GPUFILTERS) + #include "opencv2/core/cuda/common.hpp" #include "opencv2/core/cuda/transform.hpp" #include "opencv2/core/cuda/vec_traits.hpp" @@ -232,3 +236,5 @@ namespace btv_l1_cudev template void calcBtvRegularization<3>(PtrStepSzb src, PtrStepSzb dst, int ksize); template void calcBtvRegularization<4>(PtrStepSzb src, PtrStepSzb dst, int ksize); } + +#endif diff --git a/modules/superres/src/input_array_utility.cpp b/modules/superres/src/input_array_utility.cpp index 327d2db..c285020 100644 --- a/modules/superres/src/input_array_utility.cpp +++ b/modules/superres/src/input_array_utility.cpp @@ -177,7 +177,7 @@ namespace switch (src.kind()) { case _InputArray::GPU_MAT: - #ifdef HAVE_OPENCV_GPU + #ifdef HAVE_OPENCV_GPUIMGPROC gpu::cvtColor(src.getGpuMat(), dst.getGpuMatRef(), code, cn); #else CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); diff --git a/modules/superres/src/optical_flow.cpp b/modules/superres/src/optical_flow.cpp index 713ed01..242b91e 100644 --- a/modules/superres/src/optical_flow.cpp +++ b/modules/superres/src/optical_flow.cpp @@ -343,7 +343,7 @@ Ptr cv::superres::createOptFlow_DualTVL1() /////////////////////////////////////////////////////////////////// // GpuOpticalFlow -#ifndef HAVE_OPENCV_GPU +#ifndef HAVE_OPENCV_GPUOPTFLOW Ptr cv::superres::createOptFlow_Farneback_GPU() { @@ -369,7 +369,7 @@ Ptr cv::superres::createOptFlow_PyrLK_GPU() return Ptr(); } -#else // HAVE_OPENCV_GPU +#else // HAVE_OPENCV_GPUOPTFLOW namespace { @@ -717,4 +717,4 @@ Ptr cv::superres::createOptFlow_DualTVL1_GPU() return new DualTVL1_GPU; } -#endif // HAVE_OPENCV_GPU +#endif // HAVE_OPENCV_GPUOPTFLOW diff --git a/modules/superres/src/precomp.hpp b/modules/superres/src/precomp.hpp index 960d9b7..73074c4 100644 --- a/modules/superres/src/precomp.hpp +++ b/modules/superres/src/precomp.hpp @@ -55,9 +55,26 @@ #include "opencv2/video/tracking.hpp" #include "opencv2/core/private.hpp" -#ifdef HAVE_OPENCV_GPU -# include "opencv2/gpu.hpp" -# include "opencv2/core/gpu_private.hpp" +#include "opencv2/core/gpu_private.hpp" + +#ifdef HAVE_OPENCV_GPUARITHM +# include "opencv2/gpuarithm.hpp" +#endif + +#ifdef HAVE_OPENCV_GPUWARPING +# include "opencv2/gpuwarping.hpp" +#endif + +#ifdef HAVE_OPENCV_GPUFILTERS +# include "opencv2/gpufilters.hpp" +#endif + +#ifdef HAVE_OPENCV_GPUIMGPROC +# include "opencv2/gpuimgproc.hpp" +#endif + +#ifdef HAVE_OPENCV_GPUOPTFLOW +# include "opencv2/gpuoptflow.hpp" #endif #ifdef HAVE_OPENCV_GPUCODEC diff --git a/modules/superres/test/test_superres.cpp b/modules/superres/test/test_superres.cpp index b4a546c..07abd04 100644 --- a/modules/superres/test/test_superres.cpp +++ b/modules/superres/test/test_superres.cpp @@ -268,7 +268,7 @@ TEST_F(SuperResolution, BTVL1) RunTest(cv::superres::createSuperResolution_BTVL1()); } -#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) +#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_GPUARITHM) && defined(HAVE_OPENCV_GPUWARPING) && defined(HAVE_OPENCV_GPUFILTERS) TEST_F(SuperResolution, BTVL1_GPU) {