mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Build fixes for GPU module.
This commit is contained in:
parent
2509fa8080
commit
069f3d8d9a
@ -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) );
|
||||
}
|
||||
|
@ -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()
|
@ -189,7 +189,7 @@ Rect FeatherBlender::createWeightMaps(const vector<Mat> &masks, const vector<Poi
|
||||
MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands, int weight_type)
|
||||
{
|
||||
setNumBands(num_bands);
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
can_use_gpu_ = try_gpu && gpu::getCudaEnabledDeviceCount();
|
||||
#else
|
||||
(void)try_gpu;
|
||||
@ -491,7 +491,7 @@ void createLaplacePyr(const Mat &img, int num_levels, vector<Mat> &pyr)
|
||||
|
||||
void createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
|
||||
{
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
pyr.resize(num_levels + 1);
|
||||
|
||||
vector<gpu::GpuMat> gpu_pyr(num_levels + 1);
|
||||
@ -531,7 +531,7 @@ void restoreImageFromLaplacePyr(vector<Mat> &pyr)
|
||||
|
||||
void restoreImageFromLaplacePyrGpu(vector<Mat> &pyr)
|
||||
{
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
if (pyr.empty())
|
||||
return;
|
||||
|
||||
|
@ -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<ImageFeatures> &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
|
||||
|
@ -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
|
||||
|
@ -1318,7 +1318,7 @@ void GraphCutSeamFinder::find(const vector<Mat> &src, const vector<Point> &corne
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
void GraphCutSeamFinderGpu::find(const vector<Mat> &src, const vector<Point> &corners,
|
||||
vector<Mat> &masks)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user