Commit 9dd4a22a authored by Anatoly Baksheev's avatar Anatoly Baksheev

temporary added NPP_staging, functionality from the library will be moved to NPP with next release.

parent e5c5a1cb
This diff is collapsed.
set(name "gpu")
#"opencv_features2d" "opencv_flann" "opencv_objdetect" - only headers needed
set(DEPS "opencv_core" "opencv_imgproc" "opencv_objdetect" "opencv_features2d" "opencv_flann")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu)
set(the_target "opencv_${name}")
project(${the_target})
set(DEPS "opencv_core" "opencv_imgproc" "opencv_objdetect" "opencv_features2d" "opencv_flann") #"opencv_features2d" "opencv_flann" "opencv_objdetect" - only headers needed
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu)
add_definitions(-DCVAPI_EXPORTS)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include"
......@@ -43,7 +40,7 @@ if (HAVE_CUDA)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_path_to_findnpp})
find_package(NPP 3.2.16 REQUIRED)
message(STATUS "NPP detected: " ${NPP_VERSION})
include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_NPP_INCLUDES})
if (UNIX OR APPLE)
......@@ -79,6 +76,11 @@ endif()
add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs} ${lib_device_hdrs} ${cuda_objs})
IF (HAVE_CUDA)
include(FindNPP_staging.cmake)
include_directories(${NPPST_INC})
target_link_libraries(${the_target} ${NPPST_LIB})
endif()
if(PCHSupport_FOUND)
set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp)
......@@ -108,7 +110,7 @@ set_target_properties(${the_target} PROPERTIES
)
# Add the required libraries for linking:
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS})
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS} )
if (HAVE_CUDA)
target_link_libraries(${the_target} ${CUDA_LIBRARIES} ${CUDA_NPP_LIBRARIES})
......
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(BIT_SUFF 32)
else()
set(BIT_SUFF 64)
endif()
if (APPLE)
set(PLATFORM_SUFF Darwin)
elseif (UNIX)
set(PLATFORM_SUFF Linux)
else()
set(PLATFORM_SUFF Windows)
endif()
set(LIB_FILE NPP_staging_static_${PLATFORM_SUFF}_${BIT_SUFF}_v1)
find_library(NPPST_LIB
NAMES "${LIB_FILE}" "lib${LIB_FILE}"
PATHS "${CMAKE_SOURCE_DIR}/3rdparty/NPP_staging"
DOC "NPP staging library"
)
SET(NPPST_INC "${CMAKE_SOURCE_DIR}//3rdparty/NPP_staging")
\ No newline at end of file
......@@ -1305,8 +1305,67 @@ namespace cv
explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(L2Dist) {}
explicit BruteForceMatcher_GPU(L2<T> /*d*/) : BruteForceMatcher_GPU_base(L2Dist) {}
};
}
////////////////////////////////// CascadeClassifier //////////////////////////////////////////
// The cascade classifier class for object detection.
class CV_EXPORTS CascadeClassifier
{
public:
struct CV_EXPORTS DTreeNode
{
int featureIdx;
float threshold; // for ordered features only
int left;
int right;
};
struct CV_EXPORTS DTree
{
int nodeCount;
};
struct CV_EXPORTS Stage
{
int first;
int ntrees;
float threshold;
};
enum { BOOST = 0 };
enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2,FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 };
CascadeClassifier();
CascadeClassifier(const string& filename);
~CascadeClassifier();
bool empty() const;
bool load(const string& filename);
bool read(const FileNode& node);
void detectMultiScale( const Mat& image, vector<Rect>& objects, double scaleFactor=1.1,
int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size());
bool setImage( Ptr<FeatureEvaluator>&, const Mat& );
int runAt( Ptr<FeatureEvaluator>&, Point );
bool isStumpBased;
int stageType;
int featureType;
int ncategories;
Size origWinSize;
vector<Stage> stages;
vector<DTree> classifiers;
vector<DTreeNode> nodes;
vector<float> leaves;
vector<int> subsets;
Ptr<FeatureEvaluator> feval;
Ptr<CvHaarClassifierCascade> oldCascade;
};
}
//! Speckle filtering - filters small connected components on diparity image.
//! It sets pixel (x,y) to newVal if it coresponds to small CC with size < maxSpeckleSize.
......
/*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 bpied warranties, including, but not limited to, the bpied
// 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"
using namespace cv;
using namespace cv::gpu;
using namespace std;
#if !defined (HAVE_CUDA)
cv::gpu::CascadeClassifier::CascadeClassifier() { throw_nogpu(); }
cv::gpu::CascadeClassifier::CascadeClassifier(const string&) { throw_nogpu(); }
cv::gpu::CascadeClassifier::~CascadeClassifier() { throw_nogpu(); }
bool cv::gpu::CascadeClassifier::empty() const { throw_nogpu(); return true; }
bool cv::gpu::CascadeClassifier::load(const string& filename) { throw_nogpu(); return true; }
bool cv::gpu::CascadeClassifier::read(const FileNode& node) { throw_nogpu(); return true; }
void cv::gpu::CascadeClassifier::detectMultiScale( const Mat&, vector<Rect>&, double, int, int, Size, Size) { throw_nogpu(); }
#else
cv::gpu::CascadeClassifier::CascadeClassifier()
{
}
cv::gpu::CascadeClassifier::CascadeClassifier(const string& filename)
{
}
cv::gpu::CascadeClassifier::~CascadeClassifier()
{
}
bool cv::gpu::CascadeClassifier::empty() const
{
int *a = (int*)&nppiStTranspose_32u_C1R;
return *a == 0xFFFFF;
return true;
}
bool cv::gpu::CascadeClassifier::load(const string& filename)
{
return true;
}
bool cv::gpu::CascadeClassifier::read(const FileNode& node)
{
return true;
}
void cv::gpu::CascadeClassifier::detectMultiScale( const Mat& image, vector<Rect>& objects, double scaleFactor,
int minNeighbors, int flags, Size minSize, Size maxSize)
{
}
#endif
\ No newline at end of file
......@@ -66,6 +66,7 @@
#include "cuda_runtime_api.h"
#include "opencv2/gpu/stream_accessor.hpp"
#include "npp.h"
#include "npp_staging.h"
#define CUDART_MINIMUM_REQUIRED_VERSION 3020
#define NPP_MINIMUM_REQUIRED_VERSION 3216
......@@ -78,6 +79,7 @@
#error "Insufficient NPP version, please update it."
#endif
static inline void throw_nogpu() { CV_Error(CV_GpuNotSupported, "The called functionality is disabled for current build or platform"); }
#else /* defined(HAVE_CUDA) */
......
......@@ -55,12 +55,7 @@ struct CV_GpuStereoBMTest : public CvTest
void run_stress()
{
//cv::setBreakOnError(true);
int winsz[] = { 13, 15, 17, 19 };
int disps[] = { 128, 160, 192, 256};
Size res[] = { Size(1027, 768), Size(1280, 1024), Size(1600, 1152), Size(1920, 1080) };
{
RNG rng;
for(int i = 0; i < 10; ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment