superres module fixes
authorVladislav Vinogradov <vlad.vinogradov@itseez.com>
Thu, 18 Apr 2013 06:11:14 +0000 (10:11 +0400)
committerVladislav Vinogradov <vlad.vinogradov@itseez.com>
Thu, 18 Apr 2013 08:36:11 +0000 (12:36 +0400)
modules/superres/CMakeLists.txt
modules/superres/src/btv_l1_gpu.cpp
modules/superres/src/cuda/btv_l1_gpu.cu
modules/superres/src/input_array_utility.cpp
modules/superres/src/optical_flow.cpp
modules/superres/src/precomp.hpp
modules/superres/test/test_superres.cpp

index 378a2a9..065d8ce 100644 (file)
@@ -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)
index a3f1132..6813187 100644 (file)
@@ -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<SuperResolution> 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;
index 58e46fa..22b3e0a 100644 (file)
 //
 //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
index 327d2db..c285020 100644 (file)
@@ -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");
index 713ed01..242b91e 100644 (file)
@@ -343,7 +343,7 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1()
 ///////////////////////////////////////////////////////////////////
 // GpuOpticalFlow
 
-#ifndef HAVE_OPENCV_GPU
+#ifndef HAVE_OPENCV_GPUOPTFLOW
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_GPU()
 {
@@ -369,7 +369,7 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_GPU()
     return Ptr<DenseOpticalFlowExt>();
 }
 
-#else // HAVE_OPENCV_GPU
+#else // HAVE_OPENCV_GPUOPTFLOW
 
 namespace
 {
@@ -717,4 +717,4 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_GPU()
     return new DualTVL1_GPU;
 }
 
-#endif // HAVE_OPENCV_GPU
+#endif // HAVE_OPENCV_GPUOPTFLOW
index 960d9b7..73074c4 100644 (file)
 #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
index b4a546c..07abd04 100644 (file)
@@ -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)
 {