diff --git a/modules/core/src/gpumat.cpp b/modules/core/src/gpumat.cpp index 17d46abcc7..7a7b91d1dd 100644 --- a/modules/core/src/gpumat.cpp +++ b/modules/core/src/gpumat.cpp @@ -752,5 +752,5 @@ void cv::gpu::error(const char *error_string, const char *file, const int line, cerr.flush(); } else - ::cv::error( ::cv::Exception(code, error_string, func, file, line) ); + cv::error( cv::Exception(code, error_string, func, file, line) ); } diff --git a/modules/gpu/perf4au/CMakeLists.txt b/modules/gpu/perf4au/CMakeLists.txt index 376e7b2706..13efe7ffa3 100644 --- a/modules/gpu/perf4au/CMakeLists.txt +++ b/modules/gpu/perf4au/CMakeLists.txt @@ -2,26 +2,28 @@ set(PERF4AU_REQUIRED_DEPS opencv_core opencv_imgproc opencv_highgui opencv_video ocv_check_dependencies(${PERF4AU_REQUIRED_DEPS}) -set(the_target gpu_perf4au) -project(${the_target}) +if (OCV_DEPENDENCIES_FOUND) + set(the_target gpu_perf4au) + project(${the_target}) -ocv_include_modules(${PERF4AU_REQUIRED_DEPS}) + ocv_include_modules(${PERF4AU_REQUIRED_DEPS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS) + if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") -endif() + endif() -file(GLOB srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h *.hpp) -add_executable(${the_target} ${srcs}) + file(GLOB srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h *.hpp) + add_executable(${the_target} ${srcs}) -target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${PERF4AU_REQUIRED_DEPS}) + target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${PERF4AU_REQUIRED_DEPS}) -if(ENABLE_SOLUTION_FOLDERS) - set_target_properties(${the_target} PROPERTIES FOLDER "tests performance") -endif() + if(ENABLE_SOLUTION_FOLDERS) + set_target_properties(${the_target} PROPERTIES FOLDER "tests performance") + endif() -if(WIN32) + if(WIN32) if(MSVC AND NOT BUILD_SHARED_LIBS) - set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") endif() -endif() + endif() +endif() \ No newline at end of file diff --git a/modules/stitching/src/blenders.cpp b/modules/stitching/src/blenders.cpp index e65023a55d..fb3c0d666b 100644 --- a/modules/stitching/src/blenders.cpp +++ b/modules/stitching/src/blenders.cpp @@ -189,7 +189,7 @@ Rect FeatherBlender::createWeightMaps(const vector &masks, const vector &pyr) void createLaplacePyrGpu(const Mat &img, int num_levels, vector &pyr) { -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) pyr.resize(num_levels + 1); vector gpu_pyr(num_levels + 1); @@ -531,7 +531,7 @@ void restoreImageFromLaplacePyr(vector &pyr) void restoreImageFromLaplacePyrGpu(vector &pyr) { -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) if (pyr.empty()) return; diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index d918cfff29..d86206233f 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -46,7 +46,7 @@ using namespace std; using namespace cv; using namespace cv::detail; -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) using namespace cv::gpu; #endif @@ -129,7 +129,7 @@ private: float match_conf_; }; -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) class GpuMatcher : public FeaturesMatcher { public: @@ -204,7 +204,7 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat LOG("1->2 & 2->1 matches: " << matches_info.matches.size() << endl); } -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) void GpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo& matches_info) { matches_info.matches.clear(); @@ -432,7 +432,7 @@ void OrbFeaturesFinder::find(const Mat &image, ImageFeatures &features) } } -#if defined(HAVE_OPENCV_NONFREE) && defined(HAVE_OPENCV_GPU) +#if defined(HAVE_OPENCV_NONFREE) && defined(HAVE_OPENCV_GPU) && !defined(ANDROID) SurfFeaturesFinderGpu::SurfFeaturesFinderGpu(double hess_thresh, int num_octaves, int num_layers, int num_octaves_descr, int num_layers_descr) { @@ -533,7 +533,7 @@ void FeaturesMatcher::operator ()(const vector &features, vector< BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu, float match_conf, int num_matches_thresh1, int num_matches_thresh2) { -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) if (try_use_gpu && getCudaEnabledDeviceCount() > 0) impl_ = new GpuMatcher(match_conf); else diff --git a/modules/stitching/src/precomp.hpp b/modules/stitching/src/precomp.hpp index 1050856d31..54b6721437 100644 --- a/modules/stitching/src/precomp.hpp +++ b/modules/stitching/src/precomp.hpp @@ -68,7 +68,7 @@ #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/calib3d/calib3d.hpp" -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) #include "opencv2/gpu/gpu.hpp" #ifdef HAVE_OPENCV_NONFREE diff --git a/modules/stitching/src/seam_finders.cpp b/modules/stitching/src/seam_finders.cpp index 784209c935..a198c1ebb4 100644 --- a/modules/stitching/src/seam_finders.cpp +++ b/modules/stitching/src/seam_finders.cpp @@ -1318,7 +1318,7 @@ void GraphCutSeamFinder::find(const vector &src, const vector &corne } -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) void GraphCutSeamFinderGpu::find(const vector &src, const vector &corners, vector &masks) { diff --git a/modules/stitching/src/stitcher.cpp b/modules/stitching/src/stitcher.cpp index 5da26f6dbf..4a36ab0a45 100644 --- a/modules/stitching/src/stitcher.cpp +++ b/modules/stitching/src/stitcher.cpp @@ -58,7 +58,7 @@ Stitcher Stitcher::createDefault(bool try_use_gpu) stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(try_use_gpu)); stitcher.setBundleAdjuster(new detail::BundleAdjusterRay()); -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) if (try_use_gpu && gpu::getCudaEnabledDeviceCount() > 0) { #if defined(HAVE_OPENCV_NONFREE) diff --git a/modules/stitching/src/warpers.cpp b/modules/stitching/src/warpers.cpp index 932958c6f7..935831950f 100644 --- a/modules/stitching/src/warpers.cpp +++ b/modules/stitching/src/warpers.cpp @@ -212,7 +212,7 @@ void SphericalWarper::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_b } -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) Rect PlaneWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, gpu::GpuMat &xmap, gpu::GpuMat &ymap) { return buildMaps(src_size, K, R, Mat::zeros(3, 1, CV_32F), xmap, ymap); diff --git a/modules/videostab/include/opencv2/videostab/optical_flow.hpp b/modules/videostab/include/opencv2/videostab/optical_flow.hpp index 18b7d3f283..2c1742fc79 100644 --- a/modules/videostab/include/opencv2/videostab/optical_flow.hpp +++ b/modules/videostab/include/opencv2/videostab/optical_flow.hpp @@ -46,7 +46,7 @@ #include "opencv2/core/core.hpp" #include "opencv2/opencv_modules.hpp" -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) # include "opencv2/gpu/gpu.hpp" #endif @@ -98,7 +98,7 @@ public: OutputArray status, OutputArray errors); }; -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) class CV_EXPORTS DensePyrLkOptFlowEstimatorGpu : public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator { diff --git a/modules/videostab/src/inpainting.cpp b/modules/videostab/src/inpainting.cpp index 4377c007c8..c6568e071e 100644 --- a/modules/videostab/src/inpainting.cpp +++ b/modules/videostab/src/inpainting.cpp @@ -323,7 +323,7 @@ public: MotionInpainter::MotionInpainter() { -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) setOptFlowEstimator(new DensePyrLkOptFlowEstimatorGpu()); #else CV_Error(CV_StsNotImplemented, "Current implementation of MotionInpainter requires GPU"); diff --git a/modules/videostab/src/optical_flow.cpp b/modules/videostab/src/optical_flow.cpp index 46100fdb59..3441df1683 100644 --- a/modules/videostab/src/optical_flow.cpp +++ b/modules/videostab/src/optical_flow.cpp @@ -59,7 +59,7 @@ void SparsePyrLkOptFlowEstimator::run( } -#ifdef HAVE_OPENCV_GPU +#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) DensePyrLkOptFlowEstimatorGpu::DensePyrLkOptFlowEstimatorGpu() { CV_Assert(gpu::getCudaEnabledDeviceCount() > 0);