diff --git a/apps/sft/CMakeLists.txt b/apps/sft/CMakeLists.txt index c7bd187a28..8b950225c8 100644 --- a/apps/sft/CMakeLists.txt +++ b/apps/sft/CMakeLists.txt @@ -1,7 +1,7 @@ set(name sft) set(the_target opencv_${name}) -set(OPENCV_${the_target}_DEPS opencv_core opencv_softcascade opencv_highgui opencv_imgproc opencv_ml OPTIONAL opencv_gpu opencv_objdetect opencv_featurest2d) +set(OPENCV_${the_target}_DEPS opencv_core opencv_softcascade opencv_highgui opencv_imgproc opencv_ml) ocv_check_dependencies(${OPENCV_${the_target}_DEPS}) if(NOT OCV_DEPENDENCIES_FOUND) diff --git a/doc/check_docs2.py b/doc/check_docs2.py index 72661431e7..963c7ff1da 100755 --- a/doc/check_docs2.py +++ b/doc/check_docs2.py @@ -199,6 +199,7 @@ def process_module(module, path): if module == "gpu": hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "cuda_devptrs.hpp")) hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "gpumat.hpp")) + hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "stream_accessor.hpp")) decls = [] for hname in hdrlist: diff --git a/modules/core/include/opencv2/core/stream_accessor.hpp b/modules/core/include/opencv2/core/stream_accessor.hpp index 30dcc6042b..9748bef80c 100644 --- a/modules/core/include/opencv2/core/stream_accessor.hpp +++ b/modules/core/include/opencv2/core/stream_accessor.hpp @@ -40,8 +40,8 @@ // //M*/ -#ifndef __OPENCV_GPU_STREAM_ACCESSOR_HPP__ -#define __OPENCV_GPU_STREAM_ACCESSOR_HPP__ +#ifndef __OPENCV_CUDA_STREAM_ACCESSOR_HPP__ +#define __OPENCV_CUDA_STREAM_ACCESSOR_HPP__ #include "opencv2/core/gpumat.hpp" #include "cuda_runtime_api.h" @@ -61,4 +61,4 @@ namespace cv } } -#endif /* __OPENCV_GPU_STREAM_ACCESSOR_HPP__ */ \ No newline at end of file +#endif /* __OPENCV_CUDA_STREAM_ACCESSOR_HPP__ */ \ No newline at end of file diff --git a/modules/core/src/cudastream.cpp b/modules/core/src/cudastream.cpp index c22db87195..6244af9e5e 100644 --- a/modules/core/src/cudastream.cpp +++ b/modules/core/src/cudastream.cpp @@ -74,33 +74,6 @@ void cv::gpu::Stream::release() { throw_nogpu(); } #include "opencv2/core/stream_accessor.hpp" -namespace -{ -#if defined(__GNUC__) - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) - #define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__, __func__) -#else /* defined(__CUDACC__) || defined(__MSVC__) */ - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) - #define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__) -#endif - - inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") - { - if (cudaSuccess != err) - cv::gpu::error(cudaGetErrorString(err), file, line, func); - } - - inline void ___nppSafeCall(int err, const char *file, const int line, const char *func = "") - { - if (err < 0) - { - std::ostringstream msg; - msg << "NPP API Call Error: " << err; - cv::gpu::error(msg.str().c_str(), file, line, func); - } - } -} - namespace cv { namespace gpu { void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream); diff --git a/modules/core/src/gpumat.cpp b/modules/core/src/gpumat.cpp index 2a9331f877..cc7442a664 100644 --- a/modules/core/src/gpumat.cpp +++ b/modules/core/src/gpumat.cpp @@ -72,19 +72,11 @@ using namespace cv::gpu; namespace { #if defined(__GNUC__) - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) #define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__, __func__) #else /* defined(__CUDACC__) || defined(__MSVC__) */ - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) #define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__) #endif - inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") - { - if (cudaSuccess != err) - cv::gpu::error(cudaGetErrorString(err), file, line, func); - } - inline void ___nppSafeCall(int err, const char *file, const int line, const char *func = "") { if (err < 0) diff --git a/modules/core/src/matrix_operations.cpp b/modules/core/src/matrix_operations.cpp index eace5181d9..f16a72cb0b 100644 --- a/modules/core/src/matrix_operations.cpp +++ b/modules/core/src/matrix_operations.cpp @@ -190,33 +190,6 @@ void cv::gpu::CudaMem::release() { CV_Error(CV_GpuNotSupported, "The library is GpuMat cv::gpu::CudaMem::createGpuMatHeader () const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); return GpuMat(); } #else /* !defined (HAVE_CUDA) */ -#include -namespace -{ -#if defined(__GNUC__) - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) - #define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__, __func__) -#else /* defined(__CUDACC__) || defined(__MSVC__) */ - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) - #define nppSafeCall(expr) ___nppSafeCall(expr, __FILE__, __LINE__) -#endif - - inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") - { - if (cudaSuccess != err) - cv::gpu::error(cudaGetErrorString(err), file, line, func); - } - - inline void ___nppSafeCall(int err, const char *file, const int line, const char *func = "") - { - if (err < 0) - { - std::ostringstream msg; - msg << "NPP API Call Error: " << err; - cv::gpu::error(msg.str().c_str(), file, line, func); - } - } -} void cv::gpu::registerPageLocked(Mat& m) { diff --git a/modules/core/src/opengl_interop.cpp b/modules/core/src/opengl_interop.cpp index cf2cc47cfb..fb4c53f629 100644 --- a/modules/core/src/opengl_interop.cpp +++ b/modules/core/src/opengl_interop.cpp @@ -67,18 +67,6 @@ namespace void throw_nocuda() { CV_Error(CV_GpuNotSupported, "The library is compiled without GPU support"); } #else void throw_nocuda() { CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); } - - #if defined(__GNUC__) - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) - #else /* defined(__CUDACC__) || defined(__MSVC__) */ - #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) - #endif - - void ___cudaSafeCall(cudaError_t err, const char* file, const int line, const char* func = "") - { - if (cudaSuccess != err) - cv::gpu::error(cudaGetErrorString(err), file, line, func); - } #endif #endif } diff --git a/modules/core/src/precomp.hpp b/modules/core/src/precomp.hpp index edfbda65e9..30ce3d17b1 100644 --- a/modules/core/src/precomp.hpp +++ b/modules/core/src/precomp.hpp @@ -66,6 +66,25 @@ #define GET_OPTIMIZED(func) (func) #endif +#ifdef HAVE_CUDA +# include +# include "opencv2/core/gpumat.hpp" + +# if defined(__GNUC__) +# define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) +# else +# define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) +# endif + +static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") +{ + if (cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), file, line, func); +} + +#else +# define cudaSafeCall(expr) +#endif + namespace cv { diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp index ee42816dbd..d82211bf38 100644 --- a/modules/gpu/include/opencv2/gpu/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu/gpu.hpp @@ -7,11 +7,12 @@ // copy or use the software. // // -// License Agreement +// License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, @@ -22,7 +23,7 @@ // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. +// and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. diff --git a/modules/gpu/include/opencv2/gpu/stream_accessor.hpp b/modules/gpu/include/opencv2/gpu/stream_accessor.hpp deleted file mode 100644 index 1797749b65..0000000000 --- a/modules/gpu/include/opencv2/gpu/stream_accessor.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// -// -// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. -// -// By downloading, copying, installing or using the software you agree to this license. -// If you do not agree to this license, do not download, install, -// copy or use the software. -// -// -// License Agreement -// For Open Source Computer Vision Library -// -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. -// Copyright (C) 2009, Willow Garage Inc., all rights reserved. -// Third party copyrights are property of their respective owners. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistribution's of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution's in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other GpuMaterials provided with the distribution. -// -// * The name of the copyright holders may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// This software is provided by the copyright holders and contributors "as is" and -// any express or implied warranties, including, but not limited to, the implied -// warranties of merchantability and fitness for a particular purpose are disclaimed. -// In no event shall the Intel Corporation or contributors be liable for any direct, -// indirect, incidental, special, exemplary, or consequential damages -// (including, but not limited to, procurement of substitute goods or services; -// loss of use, data, or profits; or business interruption) however caused -// and on any theory of liability, whether in contract, strict liability, -// or tort (including negligence or otherwise) arising in any way out of -// the use of this software, even if advised of the possibility of such damage. -// -//M*/ - -#ifndef __OPENCV_GPU_STREAM_ACCESSOR_HPP__ -#define __OPENCV_GPU_STREAM_ACCESSOR_HPP__ - -#include "opencv2/gpu.hpp" -#include "cuda_runtime_api.h" - -namespace cv -{ - namespace gpu - { - // This is only header file that depends on Cuda. All other headers are independent. - // So if you use OpenCV binaries you do noot need to install Cuda Toolkit. - // But of you wanna use GPU by yourself, may get cuda stream instance using the class below. - // In this case you have to install Cuda Toolkit. - struct StreamAccessor - { - CV_EXPORTS static cudaStream_t getStream(const cv::gpu::Stream& stream); - }; - } -} - -#endif /* __OPENCV_GPU_STREAM_ACCESSOR_HPP__ */ \ No newline at end of file diff --git a/modules/gpu/src/precomp.hpp b/modules/gpu/src/precomp.hpp index 1aa442b99b..caa46cfc8a 100644 --- a/modules/gpu/src/precomp.hpp +++ b/modules/gpu/src/precomp.hpp @@ -106,7 +106,7 @@ #endif #include "internal_shared.hpp" - #include "opencv2/gpu/stream_accessor.hpp" + #include "opencv2/core/stream_accessor.hpp" #include "nvidia/core/NCV.hpp" #include "nvidia/NPP_staging/NPP_staging.hpp" diff --git a/modules/softcascade/src/cuda/icf-sc.cu b/modules/softcascade/src/cuda/icf-sc.cu index 9020fa375b..8d65aad0e6 100644 --- a/modules/softcascade/src/cuda/icf-sc.cu +++ b/modules/softcascade/src/cuda/icf-sc.cu @@ -44,18 +44,18 @@ #include #include -namespace -{ +namespace cv { namespace softcascade { namespace internal { +void error(const char *error_string, const char *file, const int line, const char *func); +}}} #if defined(__GNUC__) #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__) #else /* defined(__CUDACC__) || defined(__MSVC__) */ #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__) #endif - inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") - { - // if (cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), file, line, func); - } +static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "") +{ + if (cudaSuccess != err) cv::softcascade::internal::error(cudaGetErrorString(err), file, line, func); } #ifndef CV_PI diff --git a/samples/cpp/peopledetect.cpp b/samples/cpp/peopledetect.cpp index 85d77b851e..c737352718 100644 --- a/samples/cpp/peopledetect.cpp +++ b/samples/cpp/peopledetect.cpp @@ -1,6 +1,6 @@ -#include "opencv2/imgproc.hpp" -#include "opencv2/objdetect.hpp" -#include "opencv2/highgui.hpp" +#include +#include +#include #include #include