From a6648b537285c529292a6411e7e9b76219400492 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 10 Apr 2013 13:17:15 +0400 Subject: [PATCH] gpuobjdetect module for object detection --- modules/gpu/CMakeLists.txt | 2 +- modules/gpu/doc/gpu.rst | 1 - modules/gpu/include/opencv2/gpu.hpp | 117 +------------- modules/gpunvidia/include/opencv2/gpunvidia.hpp | 1 + .../opencv2/gpunvidia}/NCVBroxOpticalFlow.hpp | 0 .../src/cuda/NCVBroxOpticalFlow.cu | 2 +- modules/gpuobjdetect/CMakeLists.txt | 9 ++ modules/gpuobjdetect/doc/gpuobjdetect.rst | 8 + .../{gpu => gpuobjdetect}/doc/object_detection.rst | 0 .../gpuobjdetect/include/opencv2/gpuobjdetect.hpp | 172 +++++++++++++++++++++ modules/gpuobjdetect/perf/perf_main.cpp | 47 ++++++ .../{gpu => gpuobjdetect}/perf/perf_objdetect.cpp | 0 modules/gpuobjdetect/perf/perf_precomp.cpp | 43 ++++++ modules/gpuobjdetect/perf/perf_precomp.hpp | 65 ++++++++ .../src/cascadeclassifier.cpp | 0 modules/{gpu => gpuobjdetect}/src/cuda/hog.cu | 0 modules/{gpu => gpuobjdetect}/src/cuda/lbp.cu | 0 modules/{gpu => gpuobjdetect}/src/cuda/lbp.hpp | 0 modules/{gpu => gpuobjdetect}/src/hog.cpp | 0 modules/gpuobjdetect/src/precomp.cpp | 43 ++++++ modules/gpuobjdetect/src/precomp.hpp | 60 +++++++ modules/gpuobjdetect/test/test_main.cpp | 45 ++++++ .../{gpu => gpuobjdetect}/test/test_objdetect.cpp | 0 modules/gpuobjdetect/test/test_precomp.cpp | 43 ++++++ modules/gpuobjdetect/test/test_precomp.hpp | 63 ++++++++ modules/gpuvideo/src/precomp.hpp | 1 - samples/cpp/CMakeLists.txt | 1 + samples/gpu/CMakeLists.txt | 2 +- samples/gpu/opticalflow_nvidia_api.cpp | 1 - 29 files changed, 604 insertions(+), 122 deletions(-) rename modules/{gpuvideo/include/opencv2/gpuvideo => gpunvidia/include/opencv2/gpunvidia}/NCVBroxOpticalFlow.hpp (100%) rename modules/{gpuvideo => gpunvidia}/src/cuda/NCVBroxOpticalFlow.cu (99%) create mode 100644 modules/gpuobjdetect/CMakeLists.txt create mode 100644 modules/gpuobjdetect/doc/gpuobjdetect.rst rename modules/{gpu => gpuobjdetect}/doc/object_detection.rst (100%) create mode 100644 modules/gpuobjdetect/include/opencv2/gpuobjdetect.hpp create mode 100644 modules/gpuobjdetect/perf/perf_main.cpp rename modules/{gpu => gpuobjdetect}/perf/perf_objdetect.cpp (100%) create mode 100644 modules/gpuobjdetect/perf/perf_precomp.cpp create mode 100644 modules/gpuobjdetect/perf/perf_precomp.hpp rename modules/{gpu => gpuobjdetect}/src/cascadeclassifier.cpp (100%) rename modules/{gpu => gpuobjdetect}/src/cuda/hog.cu (100%) rename modules/{gpu => gpuobjdetect}/src/cuda/lbp.cu (100%) rename modules/{gpu => gpuobjdetect}/src/cuda/lbp.hpp (100%) rename modules/{gpu => gpuobjdetect}/src/hog.cpp (100%) create mode 100644 modules/gpuobjdetect/src/precomp.cpp create mode 100644 modules/gpuobjdetect/src/precomp.hpp create mode 100644 modules/gpuobjdetect/test/test_main.cpp rename modules/{gpu => gpuobjdetect}/test/test_objdetect.cpp (100%) create mode 100644 modules/gpuobjdetect/test/test_precomp.cpp create mode 100644 modules/gpuobjdetect/test/test_precomp.hpp diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt index 95de678..55faa39 100644 --- a/modules/gpu/CMakeLists.txt +++ b/modules/gpu/CMakeLists.txt @@ -5,7 +5,7 @@ endif() set(the_description "GPU-accelerated Computer Vision") ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_photo opencv_legacy - opencv_gpuarithm opencv_gpufilters opencv_gpuimgproc opencv_gpufeatures2d opencv_gpuvideo opencv_gpucalib3d + opencv_gpuarithm opencv_gpufilters opencv_gpuimgproc opencv_gpufeatures2d opencv_gpuvideo opencv_gpucalib3d opencv_gpuobjdetect OPTIONAL opencv_gpunvidia) ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda") diff --git a/modules/gpu/doc/gpu.rst b/modules/gpu/doc/gpu.rst index bc3b9bd..d98f90d 100644 --- a/modules/gpu/doc/gpu.rst +++ b/modules/gpu/doc/gpu.rst @@ -8,4 +8,3 @@ gpu. GPU-accelerated Computer Vision introduction initalization_and_information data_structures - object_detection diff --git a/modules/gpu/include/opencv2/gpu.hpp b/modules/gpu/include/opencv2/gpu.hpp index b3fea3f..d613586 100644 --- a/modules/gpu/include/opencv2/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu.hpp @@ -56,6 +56,7 @@ #include "opencv2/gpufeatures2d.hpp" #include "opencv2/gpuvideo.hpp" #include "opencv2/gpucalib3d.hpp" +#include "opencv2/gpuobjdetect.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/objdetect.hpp" @@ -92,96 +93,7 @@ namespace cv { namespace gpu { -//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector ////////////// -struct CV_EXPORTS HOGConfidence -{ - double scale; - std::vector locations; - std::vector confidences; - std::vector part_scores[4]; -}; - -struct CV_EXPORTS HOGDescriptor -{ - enum { DEFAULT_WIN_SIGMA = -1 }; - enum { DEFAULT_NLEVELS = 64 }; - enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL }; - - HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16), - Size block_stride=Size(8, 8), Size cell_size=Size(8, 8), - int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA, - double threshold_L2hys=0.2, bool gamma_correction=true, - int nlevels=DEFAULT_NLEVELS); - - size_t getDescriptorSize() const; - size_t getBlockHistogramSize() const; - - void setSVMDetector(const std::vector& detector); - - static std::vector getDefaultPeopleDetector(); - static std::vector getPeopleDetector48x96(); - static std::vector getPeopleDetector64x128(); - - void detect(const GpuMat& img, std::vector& found_locations, - double hit_threshold=0, Size win_stride=Size(), - Size padding=Size()); - - void detectMultiScale(const GpuMat& img, std::vector& found_locations, - double hit_threshold=0, Size win_stride=Size(), - Size padding=Size(), double scale0=1.05, - int group_threshold=2); - - void computeConfidence(const GpuMat& img, std::vector& hits, double hit_threshold, - Size win_stride, Size padding, std::vector& locations, std::vector& confidences); - - void computeConfidenceMultiScale(const GpuMat& img, std::vector& found_locations, - double hit_threshold, Size win_stride, Size padding, - std::vector &conf_out, int group_threshold); - - void getDescriptors(const GpuMat& img, Size win_stride, - GpuMat& descriptors, - int descr_format=DESCR_FORMAT_COL_BY_COL); - - Size win_size; - Size block_size; - Size block_stride; - Size cell_size; - int nbins; - double win_sigma; - double threshold_L2hys; - bool gamma_correction; - int nlevels; - -protected: - void computeBlockHistograms(const GpuMat& img); - void computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle); - double getWinSigma() const; - bool checkDetectorSize() const; - - static int numPartsWithin(int size, int part_size, int stride); - static Size numPartsWithin(Size size, Size part_size, Size stride); - - // Coefficients of the separating plane - float free_coef; - GpuMat detector; - - // Results of the last classification step - GpuMat labels, labels_buf; - Mat labels_host; - - // Results of the last histogram evaluation step - GpuMat block_hists, block_hists_buf; - - // Gradients conputation results - GpuMat grad, qangle, grad_buf, qangle_buf; - - // returns subbuffer with required size, reallocates buffer if nessesary. - static GpuMat getBuffer(const Size& sz, int type, GpuMat& buf); - static GpuMat getBuffer(int rows, int cols, int type, GpuMat& buf); - - std::vector image_scales; -}; ////////////////////////////////// BruteForceMatcher ////////////////////////////////// @@ -213,34 +125,7 @@ public: }; ////////////////////////////////// CascadeClassifier_GPU ////////////////////////////////////////// -// The cascade classifier class for object detection: supports old haar and new lbp xlm formats and nvbin for haar cascades olny. -class CV_EXPORTS CascadeClassifier_GPU -{ -public: - CascadeClassifier_GPU(); - CascadeClassifier_GPU(const String& filename); - ~CascadeClassifier_GPU(); - - bool empty() const; - bool load(const String& filename); - void release(); - - /* returns number of detected objects */ - int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor = 1.2, int minNeighbors = 4, Size minSize = Size()); - int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4); - bool findLargestObject; - bool visualizeInPlace; - - Size getClassifierSize() const; - -private: - struct CascadeClassifierImpl; - CascadeClassifierImpl* impl; - struct HaarCascade; - struct LbpCascade; - friend class CascadeClassifier_GPU_LBP; -}; ////////////////////////////////// FAST ////////////////////////////////////////// diff --git a/modules/gpunvidia/include/opencv2/gpunvidia.hpp b/modules/gpunvidia/include/opencv2/gpunvidia.hpp index 4c07417..47555f8 100644 --- a/modules/gpunvidia/include/opencv2/gpunvidia.hpp +++ b/modules/gpunvidia/include/opencv2/gpunvidia.hpp @@ -47,5 +47,6 @@ #include "opencv2/gpunvidia/NPP_staging.hpp" #include "opencv2/gpunvidia/NCVPyramid.hpp" #include "opencv2/gpunvidia/NCVHaarObjectDetection.hpp" +#include "opencv2/gpunvidia/NCVBroxOpticalFlow.hpp" #endif /* __OPENCV_GPUNVIDIA_HPP__ */ diff --git a/modules/gpuvideo/include/opencv2/gpuvideo/NCVBroxOpticalFlow.hpp b/modules/gpunvidia/include/opencv2/gpunvidia/NCVBroxOpticalFlow.hpp similarity index 100% rename from modules/gpuvideo/include/opencv2/gpuvideo/NCVBroxOpticalFlow.hpp rename to modules/gpunvidia/include/opencv2/gpunvidia/NCVBroxOpticalFlow.hpp diff --git a/modules/gpuvideo/src/cuda/NCVBroxOpticalFlow.cu b/modules/gpunvidia/src/cuda/NCVBroxOpticalFlow.cu similarity index 99% rename from modules/gpuvideo/src/cuda/NCVBroxOpticalFlow.cu rename to modules/gpunvidia/src/cuda/NCVBroxOpticalFlow.cu index 427d4fa..4faba63 100644 --- a/modules/gpuvideo/src/cuda/NCVBroxOpticalFlow.cu +++ b/modules/gpunvidia/src/cuda/NCVBroxOpticalFlow.cu @@ -64,7 +64,7 @@ #include "opencv2/core/cuda/utility.hpp" #include "opencv2/gpunvidia/NPP_staging.hpp" -#include "opencv2/gpuvideo/NCVBroxOpticalFlow.hpp" +#include "opencv2/gpunvidia/NCVBroxOpticalFlow.hpp" typedef NCVVectorAlloc FloatVector; diff --git a/modules/gpuobjdetect/CMakeLists.txt b/modules/gpuobjdetect/CMakeLists.txt new file mode 100644 index 0000000..745c02b --- /dev/null +++ b/modules/gpuobjdetect/CMakeLists.txt @@ -0,0 +1,9 @@ +if(ANDROID OR IOS) + ocv_module_disable(gpuobjdetect) +endif() + +set(the_description "GPU-accelerated Object Detection") + +ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations) + +ocv_define_module(gpuobjdetect opencv_objdetect opencv_gpuimgproc OPTIONAL opencv_gpunvidia) diff --git a/modules/gpuobjdetect/doc/gpuobjdetect.rst b/modules/gpuobjdetect/doc/gpuobjdetect.rst new file mode 100644 index 0000000..c53225d --- /dev/null +++ b/modules/gpuobjdetect/doc/gpuobjdetect.rst @@ -0,0 +1,8 @@ +************************************* +gpu. GPU-accelerated Object Detection +************************************* + +.. toctree:: + :maxdepth: 1 + + object_detection diff --git a/modules/gpu/doc/object_detection.rst b/modules/gpuobjdetect/doc/object_detection.rst similarity index 100% rename from modules/gpu/doc/object_detection.rst rename to modules/gpuobjdetect/doc/object_detection.rst diff --git a/modules/gpuobjdetect/include/opencv2/gpuobjdetect.hpp b/modules/gpuobjdetect/include/opencv2/gpuobjdetect.hpp new file mode 100644 index 0000000..ab665b3 --- /dev/null +++ b/modules/gpuobjdetect/include/opencv2/gpuobjdetect.hpp @@ -0,0 +1,172 @@ +/*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 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. +// +// 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_GPUOBJDETECT_HPP__ +#define __OPENCV_GPUOBJDETECT_HPP__ + +#include "opencv2/core/gpumat.hpp" + +namespace cv { namespace gpu { + +//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector ////////////// +struct CV_EXPORTS HOGConfidence +{ + double scale; + std::vector locations; + std::vector confidences; + std::vector part_scores[4]; +}; + +struct CV_EXPORTS HOGDescriptor +{ + enum { DEFAULT_WIN_SIGMA = -1 }; + enum { DEFAULT_NLEVELS = 64 }; + enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL }; + + HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16), + Size block_stride=Size(8, 8), Size cell_size=Size(8, 8), + int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA, + double threshold_L2hys=0.2, bool gamma_correction=true, + int nlevels=DEFAULT_NLEVELS); + + size_t getDescriptorSize() const; + size_t getBlockHistogramSize() const; + + void setSVMDetector(const std::vector& detector); + + static std::vector getDefaultPeopleDetector(); + static std::vector getPeopleDetector48x96(); + static std::vector getPeopleDetector64x128(); + + void detect(const GpuMat& img, std::vector& found_locations, + double hit_threshold=0, Size win_stride=Size(), + Size padding=Size()); + + void detectMultiScale(const GpuMat& img, std::vector& found_locations, + double hit_threshold=0, Size win_stride=Size(), + Size padding=Size(), double scale0=1.05, + int group_threshold=2); + + void computeConfidence(const GpuMat& img, std::vector& hits, double hit_threshold, + Size win_stride, Size padding, std::vector& locations, std::vector& confidences); + + void computeConfidenceMultiScale(const GpuMat& img, std::vector& found_locations, + double hit_threshold, Size win_stride, Size padding, + std::vector &conf_out, int group_threshold); + + void getDescriptors(const GpuMat& img, Size win_stride, + GpuMat& descriptors, + int descr_format=DESCR_FORMAT_COL_BY_COL); + + Size win_size; + Size block_size; + Size block_stride; + Size cell_size; + int nbins; + double win_sigma; + double threshold_L2hys; + bool gamma_correction; + int nlevels; + +protected: + void computeBlockHistograms(const GpuMat& img); + void computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle); + + double getWinSigma() const; + bool checkDetectorSize() const; + + static int numPartsWithin(int size, int part_size, int stride); + static Size numPartsWithin(Size size, Size part_size, Size stride); + + // Coefficients of the separating plane + float free_coef; + GpuMat detector; + + // Results of the last classification step + GpuMat labels, labels_buf; + Mat labels_host; + + // Results of the last histogram evaluation step + GpuMat block_hists, block_hists_buf; + + // Gradients conputation results + GpuMat grad, qangle, grad_buf, qangle_buf; + + // returns subbuffer with required size, reallocates buffer if nessesary. + static GpuMat getBuffer(const Size& sz, int type, GpuMat& buf); + static GpuMat getBuffer(int rows, int cols, int type, GpuMat& buf); + + std::vector image_scales; +}; + +// The cascade classifier class for object detection: supports old haar and new lbp xlm formats and nvbin for haar cascades olny. +class CV_EXPORTS CascadeClassifier_GPU +{ +public: + CascadeClassifier_GPU(); + CascadeClassifier_GPU(const String& filename); + ~CascadeClassifier_GPU(); + + bool empty() const; + bool load(const String& filename); + void release(); + + /* returns number of detected objects */ + int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor = 1.2, int minNeighbors = 4, Size minSize = Size()); + int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4); + + bool findLargestObject; + bool visualizeInPlace; + + Size getClassifierSize() const; + +private: + struct CascadeClassifierImpl; + CascadeClassifierImpl* impl; + struct HaarCascade; + struct LbpCascade; + friend class CascadeClassifier_GPU_LBP; +}; + +}} // namespace cv { namespace gpu { + +#endif /* __OPENCV_GPUOBJDETECT_HPP__ */ diff --git a/modules/gpuobjdetect/perf/perf_main.cpp b/modules/gpuobjdetect/perf/perf_main.cpp new file mode 100644 index 0000000..b35791c --- /dev/null +++ b/modules/gpuobjdetect/perf/perf_main.cpp @@ -0,0 +1,47 @@ +/*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 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. +// +// 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*/ + +#include "perf_precomp.hpp" + +using namespace perf; + +CV_PERF_TEST_MAIN(gpuarithm, printCudaInfo()) diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpuobjdetect/perf/perf_objdetect.cpp similarity index 100% rename from modules/gpu/perf/perf_objdetect.cpp rename to modules/gpuobjdetect/perf/perf_objdetect.cpp diff --git a/modules/gpuobjdetect/perf/perf_precomp.cpp b/modules/gpuobjdetect/perf/perf_precomp.cpp new file mode 100644 index 0000000..81f16e8 --- /dev/null +++ b/modules/gpuobjdetect/perf/perf_precomp.cpp @@ -0,0 +1,43 @@ +/*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 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. +// +// 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*/ + +#include "perf_precomp.hpp" diff --git a/modules/gpuobjdetect/perf/perf_precomp.hpp b/modules/gpuobjdetect/perf/perf_precomp.hpp new file mode 100644 index 0000000..2a1acac --- /dev/null +++ b/modules/gpuobjdetect/perf/perf_precomp.hpp @@ -0,0 +1,65 @@ +/*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 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. +// +// 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*/ + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-declarations" +# if defined __clang__ || defined __APPLE__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma GCC diagnostic ignored "-Wextra" +# endif +#endif + +#ifndef __OPENCV_PERF_PRECOMP_HPP__ +#define __OPENCV_PERF_PRECOMP_HPP__ + +#include "opencv2/ts.hpp" +#include "opencv2/ts/gpu_perf.hpp" + +#include "opencv2/gpuobjdetect.hpp" + +#include "opencv2/objdetect.hpp" + +#ifdef GTEST_CREATE_SHARED_LIBRARY +#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined +#endif + +#endif diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpuobjdetect/src/cascadeclassifier.cpp similarity index 100% rename from modules/gpu/src/cascadeclassifier.cpp rename to modules/gpuobjdetect/src/cascadeclassifier.cpp diff --git a/modules/gpu/src/cuda/hog.cu b/modules/gpuobjdetect/src/cuda/hog.cu similarity index 100% rename from modules/gpu/src/cuda/hog.cu rename to modules/gpuobjdetect/src/cuda/hog.cu diff --git a/modules/gpu/src/cuda/lbp.cu b/modules/gpuobjdetect/src/cuda/lbp.cu similarity index 100% rename from modules/gpu/src/cuda/lbp.cu rename to modules/gpuobjdetect/src/cuda/lbp.cu diff --git a/modules/gpu/src/cuda/lbp.hpp b/modules/gpuobjdetect/src/cuda/lbp.hpp similarity index 100% rename from modules/gpu/src/cuda/lbp.hpp rename to modules/gpuobjdetect/src/cuda/lbp.hpp diff --git a/modules/gpu/src/hog.cpp b/modules/gpuobjdetect/src/hog.cpp similarity index 100% rename from modules/gpu/src/hog.cpp rename to modules/gpuobjdetect/src/hog.cpp diff --git a/modules/gpuobjdetect/src/precomp.cpp b/modules/gpuobjdetect/src/precomp.cpp new file mode 100644 index 0000000..3c01a25 --- /dev/null +++ b/modules/gpuobjdetect/src/precomp.cpp @@ -0,0 +1,43 @@ +/*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 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. +// +// 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*/ + +#include "precomp.hpp" diff --git a/modules/gpuobjdetect/src/precomp.hpp b/modules/gpuobjdetect/src/precomp.hpp new file mode 100644 index 0000000..4705849 --- /dev/null +++ b/modules/gpuobjdetect/src/precomp.hpp @@ -0,0 +1,60 @@ +/*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 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. +// +// 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_PRECOMP_H__ +#define __OPENCV_PRECOMP_H__ + +#include "opencv2/gpuobjdetect.hpp" +#include "opencv2/gpuimgproc.hpp" +#include "opencv2/gpuarithm.hpp" + +#include "opencv2/objdetect.hpp" + +#include "opencv2/core/gpu_private.hpp" + +#include "opencv2/opencv_modules.hpp" + +#ifdef HAVE_OPENCV_GPUNVIDIA +# include "opencv2/gpunvidia/private.hpp" +#endif + +#endif /* __OPENCV_PRECOMP_H__ */ diff --git a/modules/gpuobjdetect/test/test_main.cpp b/modules/gpuobjdetect/test/test_main.cpp new file mode 100644 index 0000000..eea3d7c --- /dev/null +++ b/modules/gpuobjdetect/test/test_main.cpp @@ -0,0 +1,45 @@ +/*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 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. +// +// 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*/ + +#include "test_precomp.hpp" + +CV_GPU_TEST_MAIN("gpu") diff --git a/modules/gpu/test/test_objdetect.cpp b/modules/gpuobjdetect/test/test_objdetect.cpp similarity index 100% rename from modules/gpu/test/test_objdetect.cpp rename to modules/gpuobjdetect/test/test_objdetect.cpp diff --git a/modules/gpuobjdetect/test/test_precomp.cpp b/modules/gpuobjdetect/test/test_precomp.cpp new file mode 100644 index 0000000..0fb6521 --- /dev/null +++ b/modules/gpuobjdetect/test/test_precomp.cpp @@ -0,0 +1,43 @@ +/*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 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. +// +// 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*/ + +#include "test_precomp.hpp" diff --git a/modules/gpuobjdetect/test/test_precomp.hpp b/modules/gpuobjdetect/test/test_precomp.hpp new file mode 100644 index 0000000..13527ba --- /dev/null +++ b/modules/gpuobjdetect/test/test_precomp.hpp @@ -0,0 +1,63 @@ +/*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 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. +// +// 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*/ + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-declarations" +# if defined __clang__ || defined __APPLE__ +# pragma GCC diagnostic ignored "-Wmissing-prototypes" +# pragma GCC diagnostic ignored "-Wextra" +# endif +#endif + +#ifndef __OPENCV_TEST_PRECOMP_HPP__ +#define __OPENCV_TEST_PRECOMP_HPP__ + +#include + +#include "opencv2/ts.hpp" +#include "opencv2/ts/gpu_test.hpp" + +#include "opencv2/gpuobjdetect.hpp" + +#include "opencv2/objdetect.hpp" + +#endif diff --git a/modules/gpuvideo/src/precomp.hpp b/modules/gpuvideo/src/precomp.hpp index e105817..276eb22 100644 --- a/modules/gpuvideo/src/precomp.hpp +++ b/modules/gpuvideo/src/precomp.hpp @@ -59,7 +59,6 @@ #ifdef HAVE_OPENCV_GPUNVIDIA # include "opencv2/gpunvidia/private.hpp" -# include "opencv2/gpuvideo/NCVBroxOpticalFlow.hpp" #endif #ifdef HAVE_CUDA diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index be87beb..e90bcb6 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -23,6 +23,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpufeatures2d/include") ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpuvideo/include") ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpucalib3d/include") + ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpuobjdetect/include") ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include") endif() diff --git a/samples/gpu/CMakeLists.txt b/samples/gpu/CMakeLists.txt index 85360f5..3bf5069 100644 --- a/samples/gpu/CMakeLists.txt +++ b/samples/gpu/CMakeLists.txt @@ -2,7 +2,7 @@ SET(OPENCV_GPU_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc ope opencv_ml opencv_video opencv_objdetect opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_gpu opencv_nonfree opencv_softcascade opencv_superres - opencv_gpucodec opencv_gpuarithm opencv_gpufilters opencv_gpunvidia opencv_gpuimgproc opencv_gpufeatures2d opencv_gpuvideo + opencv_gpucodec opencv_gpuarithm opencv_gpufilters opencv_gpunvidia opencv_gpuimgproc opencv_gpufeatures2d opencv_gpuvideo opencv_gpuobjdetect opencv_gpucalib3d) ocv_check_dependencies(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) diff --git a/samples/gpu/opticalflow_nvidia_api.cpp b/samples/gpu/opticalflow_nvidia_api.cpp index 3c11029..e4fc93c 100644 --- a/samples/gpu/opticalflow_nvidia_api.cpp +++ b/samples/gpu/opticalflow_nvidia_api.cpp @@ -17,7 +17,6 @@ #ifdef HAVE_CUDA #include "opencv2/gpunvidia.hpp" -#include "opencv2/gpuvideo/NCVBroxOpticalFlow.hpp" #endif #if !defined(HAVE_CUDA) -- 2.7.4