parent
9b00c14fff
commit
5120322cea
16 changed files with 504 additions and 249 deletions
@ -1,59 +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) 2008-2012, 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" |
|
||||||
|
|
||||||
namespace cv { namespace gpu |
|
||||||
{ |
|
||||||
|
|
||||||
CV_INIT_ALGORITHM(SCascade, "CascadeDetector.SCascade", |
|
||||||
obj.info()->addParam(obj, "minScale", obj.minScale); |
|
||||||
obj.info()->addParam(obj, "maxScale", obj.maxScale); |
|
||||||
obj.info()->addParam(obj, "scales", obj.scales)); |
|
||||||
|
|
||||||
bool initModule_gpu(void) |
|
||||||
{ |
|
||||||
Ptr<Algorithm> sc = createSCascade(); |
|
||||||
return sc->info() != 0; |
|
||||||
} |
|
||||||
|
|
||||||
} } |
|
@ -1,3 +1,50 @@ |
|||||||
|
macro(ocv_glob_cuda_powered_module_sources) |
||||||
|
file(GLOB_RECURSE lib_srcs "src/*.cpp") |
||||||
|
file(GLOB_RECURSE lib_int_hdrs "src/*.hpp" "src/*.h") |
||||||
|
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h") |
||||||
|
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h") |
||||||
|
|
||||||
|
file(GLOB_RECURSE lib_device_srcs "src/*.cu") |
||||||
|
set(device_objs "") |
||||||
|
set(lib_device_hdrs "") |
||||||
|
|
||||||
|
if (HAVE_CUDA AND lib_device_srcs) |
||||||
|
ocv_include_directories(${CUDA_INCLUDE_DIRS}) |
||||||
|
file(GLOB_RECURSE lib_device_hdrs "src/cuda/*.hpp") |
||||||
|
|
||||||
|
ocv_cuda_compile(device_objs ${lib_device_srcs}) |
||||||
|
source_group("Src\\Cuda" FILES ${lib_device_srcs} ${lib_device_hdrs}) |
||||||
|
if (lib_device_hdrs) |
||||||
|
list(REMOVE_ITEM lib_int_hdrs ${lib_device_hdrs}) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
ocv_set_module_sources(${ARGN} HEADERS ${lib_hdrs} ${lib_hdrs_detail} |
||||||
|
SOURCES ${lib_srcs} ${lib_int_hdrs} ${device_objs} ${lib_device_srcs} ${lib_device_hdrs}) |
||||||
|
|
||||||
|
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs}) |
||||||
|
source_group("Include" FILES ${lib_hdrs}) |
||||||
|
source_group("Include\\detail" FILES ${lib_hdrs_detail}) |
||||||
|
endmacro() |
||||||
|
|
||||||
set(the_description "Soft Cascade detection and training") |
set(the_description "Soft Cascade detection and training") |
||||||
ocv_define_module(softcascade opencv_core opencv_imgproc opencv_ml) |
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4310 -Wundef -Wmissing-declarations) |
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4310) |
set(cuda_deps "") |
||||||
|
set(cuda_include "") |
||||||
|
|
||||||
|
if (NAVE_CUDA) |
||||||
|
set(cuda_deps ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) |
||||||
|
endif() |
||||||
|
ocv_add_module(softcascade opencv_core opencv_imgproc opencv_ml OPTIONAL opencv_gpu ${cuda_deps}) |
||||||
|
|
||||||
|
if(HAVE_CUDA) |
||||||
|
ocv_module_include_directories(${CUDA_INCLUDE_DIRS}) |
||||||
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) |
||||||
|
endif() |
||||||
|
|
||||||
|
ocv_glob_cuda_powered_module_sources() |
||||||
|
ocv_create_module() |
||||||
|
ocv_add_precompiled_headers(${the_module}) |
||||||
|
|
||||||
|
ocv_add_accuracy_tests() |
||||||
|
ocv_add_perf_tests() |
||||||
|
@ -0,0 +1,109 @@ |
|||||||
|
/*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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Intel License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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" |
||||||
|
|
||||||
|
#ifdef HAVE_CUDA |
||||||
|
|
||||||
|
|
||||||
|
using namespace std; |
||||||
|
using namespace cv; |
||||||
|
using namespace cv::gpu; |
||||||
|
using namespace cvtest; |
||||||
|
using namespace testing; |
||||||
|
using namespace testing::internal; |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Gpu devices
|
||||||
|
|
||||||
|
bool supportFeature(const DeviceInfo& info, FeatureSet feature) |
||||||
|
{ |
||||||
|
return TargetArchs::builtWith(feature) && info.supports(feature); |
||||||
|
} |
||||||
|
|
||||||
|
DeviceManager& DeviceManager::instance() |
||||||
|
{ |
||||||
|
static DeviceManager obj; |
||||||
|
return obj; |
||||||
|
} |
||||||
|
|
||||||
|
void DeviceManager::load(int i) |
||||||
|
{ |
||||||
|
devices_.clear(); |
||||||
|
devices_.reserve(1); |
||||||
|
|
||||||
|
std::ostringstream msg; |
||||||
|
|
||||||
|
if (i < 0 || i >= getCudaEnabledDeviceCount()) |
||||||
|
{ |
||||||
|
msg << "Incorrect device number - " << i; |
||||||
|
CV_Error(CV_StsBadArg, msg.str()); |
||||||
|
} |
||||||
|
|
||||||
|
DeviceInfo info(i); |
||||||
|
|
||||||
|
if (!info.isCompatible()) |
||||||
|
{ |
||||||
|
msg << "Device " << i << " [" << info.name() << "] is NOT compatible with current GPU module build"; |
||||||
|
CV_Error(CV_StsBadArg, msg.str()); |
||||||
|
} |
||||||
|
|
||||||
|
devices_.push_back(info); |
||||||
|
} |
||||||
|
|
||||||
|
void DeviceManager::loadAll() |
||||||
|
{ |
||||||
|
int deviceCount = getCudaEnabledDeviceCount(); |
||||||
|
|
||||||
|
devices_.clear(); |
||||||
|
devices_.reserve(deviceCount); |
||||||
|
|
||||||
|
for (int i = 0; i < deviceCount; ++i) |
||||||
|
{ |
||||||
|
DeviceInfo info(i); |
||||||
|
if (info.isCompatible()) |
||||||
|
{ |
||||||
|
devices_.push_back(info); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endif // HAVE_CUDA
|
@ -0,0 +1,73 @@ |
|||||||
|
/*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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Intel License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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_SOFTCASCADE_TEST_UTILITY_HPP__ |
||||||
|
#define __OPENCV_SOFTCASCADE_TEST_UTILITY_HPP__ |
||||||
|
|
||||||
|
#include "opencv2/core/core.hpp" |
||||||
|
#include "opencv2/core/gpumat.hpp" |
||||||
|
#include "opencv2/ts/ts.hpp" |
||||||
|
#include "opencv2/ts/ts_perf.hpp" |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Gpu devices
|
||||||
|
//! return true if device supports specified feature and gpu module was built with support the feature.
|
||||||
|
bool supportFeature(const cv::gpu::DeviceInfo& info, cv::gpu::FeatureSet feature); |
||||||
|
|
||||||
|
class DeviceManager |
||||||
|
{ |
||||||
|
public: |
||||||
|
static DeviceManager& instance(); |
||||||
|
|
||||||
|
void load(int i); |
||||||
|
void loadAll(); |
||||||
|
|
||||||
|
const std::vector<cv::gpu::DeviceInfo>& values() const { return devices_; } |
||||||
|
|
||||||
|
private: |
||||||
|
std::vector<cv::gpu::DeviceInfo> devices_; |
||||||
|
DeviceManager() {loadAll();} |
||||||
|
}; |
||||||
|
|
||||||
|
#define ALL_DEVICES testing::ValuesIn(DeviceManager::instance().values()) |
||||||
|
|
||||||
|
|
||||||
|
#endif // __OPENCV_GPU_TEST_UTILITY_HPP__
|
Loading…
Reference in new issue