set(the_description "Images stitching")
-if (ENABLE_DYNAMIC_CUDA)
+if(ENABLE_DYNAMIC_CUDA)
+ add_definitions(-DDYNAMIC_CUDA_SUPPORT)
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_nonfree)
else()
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_gpu opencv_nonfree)
-endif()
\ No newline at end of file
+endif()
#define __OPENCV_STITCHING_MATCHERS_HPP__
#include "opencv2/core/core.hpp"
+#include "opencv2/core/gpumat.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/opencv_modules.hpp"
-#if defined(HAVE_OPENCV_NONFREE) && defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_NONFREE)
#include "opencv2/nonfree/gpu.hpp"
#endif
};
-#if defined(HAVE_OPENCV_NONFREE) && defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_NONFREE)
class CV_EXPORTS SurfFeaturesFinderGpu : public FeaturesFinder
{
public:
#include <set>
#include "opencv2/core/core.hpp"
-#include "opencv2/opencv_modules.hpp"
+#include "opencv2/core/gpumat.hpp"
namespace cv {
namespace detail {
};
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder
{
public:
float terminal_cost_;
float bad_region_penalty_;
};
-#endif
} // namespace detail
} // namespace cv
#define __OPENCV_STITCHING_WARPERS_HPP__
#include "opencv2/core/core.hpp"
+#include "opencv2/core/gpumat.hpp"
#include "opencv2/imgproc/imgproc.hpp"
-#include "opencv2/opencv_modules.hpp"
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
-# include "opencv2/gpu/gpu.hpp"
-#endif
namespace cv {
namespace detail {
};
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
{
public:
private:
gpu::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
};
-#endif
struct SphericalPortraitProjector : ProjectorBase
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
class PlaneWarperGpu: public WarperCreator
{
public:
public:
Ptr<detail::RotationWarper> create(float scale) const { return new detail::SphericalWarperGpu(scale); }
};
-#endif
} // namespace cv
MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands, int weight_type)
{
setNumBands(num_bands);
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
can_use_gpu_ = try_gpu && gpu::getCudaEnabledDeviceCount();
#else
(void)try_gpu;
void createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
{
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
pyr.resize(num_levels + 1);
vector<gpu::GpuMat> gpu_pyr(num_levels + 1);
(void)img;
(void)num_levels;
(void)pyr;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
#endif
}
void restoreImageFromLaplacePyrGpu(vector<Mat> &pyr)
{
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
if (pyr.empty())
return;
gpu_pyr[0].download(pyr[0]);
#else
(void)pyr;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
#endif
}
using namespace std;
using namespace cv;
using namespace cv::detail;
-
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
using namespace cv::gpu;
-#endif
#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"
float match_conf_;
};
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
class GpuMatcher : public FeaturesMatcher
{
public:
LOG("1->2 & 2->1 matches: " << matches_info.matches.size() << endl);
}
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
void GpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo& matches_info)
{
matches_info.matches.clear();
}
}
-#if defined(HAVE_OPENCV_NONFREE) && defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_NONFREE) && defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
SurfFeaturesFinderGpu::SurfFeaturesFinderGpu(double hess_thresh, int num_octaves, int num_layers,
int num_octaves_descr, int num_layers_descr)
{
keypoints_.release();
descriptors_.release();
}
+#elif defined(HAVE_OPENCV_NONFREE)
+SurfFeaturesFinderGpu::SurfFeaturesFinderGpu(double hess_thresh, int num_octaves, int num_layers,
+ int num_octaves_descr, int num_layers_descr)
+{
+ (void)hess_thresh;
+ (void)num_octaves;
+ (void)num_layers;
+ (void)num_octaves_descr;
+ (void)num_layers_descr;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+}
+
+
+void SurfFeaturesFinderGpu::find(const Mat &image, ImageFeatures &features)
+{
+ (void)image;
+ (void)features;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+}
+
+void SurfFeaturesFinderGpu::collectGarbage()
+{
+}
#endif
BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu, float match_conf, int num_matches_thresh1, int num_matches_thresh2)
{
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
if (try_use_gpu && getCudaEnabledDeviceCount() > 0)
impl_ = new GpuMatcher(match_conf);
else
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/calib3d/calib3d.hpp"
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
#include "opencv2/gpu/gpu.hpp"
#ifdef HAVE_OPENCV_NONFREE
}
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
void GraphCutSeamFinderGpu::find(const vector<Mat> &src, const vector<Point> &corners,
vector<Mat> &masks)
{
}
}
}
+#else
+void GraphCutSeamFinderGpu::find(const vector<Mat> &src, const vector<Point> &corners,
+ vector<Mat> &masks)
+{
+ (void)src;
+ (void)corners;
+ (void)masks;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+}
+
+
+void GraphCutSeamFinderGpu::findInPair(size_t first, size_t second, Rect roi)
+{
+ (void)first;
+ (void)second;
+ (void)roi;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+}
+
+
+void GraphCutSeamFinderGpu::setGraphWeightsColor(const Mat &img1, const Mat &img2, const Mat &mask1, const Mat &mask2,
+ Mat &terminals, Mat &leftT, Mat &rightT, Mat &top, Mat &bottom)
+{
+ (void)img1;
+ (void)img2;
+ (void)mask1;
+ (void)mask2;
+ (void)terminals;
+ (void)leftT;
+ (void)rightT;
+ (void)top;
+ (void)bottom;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+}
+
+
+void GraphCutSeamFinderGpu::setGraphWeightsColorGrad(
+ const Mat &img1, const Mat &img2, const Mat &dx1, const Mat &dx2,
+ const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
+ Mat &terminals, Mat &leftT, Mat &rightT, Mat &top, Mat &bottom)
+{
+ (void)img1;
+ (void)img2;
+ (void)dx1;
+ (void)dx2;
+ (void)dy1;
+ (void)dy2;
+ (void)mask1;
+ (void)mask2;
+ (void)terminals;
+ (void)leftT;
+ (void)rightT;
+ (void)top;
+ (void)bottom;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+}
#endif
} // namespace detail
stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(try_use_gpu));
stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
if (try_use_gpu && gpu::getCudaEnabledDeviceCount() > 0)
{
#if defined(HAVE_OPENCV_NONFREE)
}
-#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT)
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);
gpu::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
return dst_roi.tl();
}
+#else
+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);
+}
+
+Rect PlaneWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, gpu::GpuMat &xmap, gpu::GpuMat &ymap)
+{
+ (void)src_size;
+ (void)K;
+ (void)R;
+ (void)T;
+ (void)xmap;
+ (void)ymap;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+ return Rect();
+}
+
+Point PlaneWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
+ gpu::GpuMat &dst)
+{
+ return warp(src, K, R, Mat::zeros(3, 1, CV_32F), interp_mode, border_mode, dst);
+}
+
+
+Point PlaneWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode,
+ gpu::GpuMat &dst)
+{
+ (void)src;
+ (void)K;
+ (void)R;
+ (void)T;
+ (void)interp_mode;
+ (void)border_mode;
+ (void)dst;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+ return Point();
+}
+
+
+Rect SphericalWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, gpu::GpuMat &xmap, gpu::GpuMat &ymap)
+{
+ (void)src_size;
+ (void)K;
+ (void)R;
+ (void)xmap;
+ (void)ymap;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+ return Rect();
+}
+
+
+Point SphericalWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
+ gpu::GpuMat &dst)
+{
+ (void)src;
+ (void)K;
+ (void)R;
+ (void)interp_mode;
+ (void)border_mode;
+ (void)dst;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+ return Point();
+}
+
+
+Rect CylindricalWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, gpu::GpuMat &xmap, gpu::GpuMat &ymap)
+{
+ (void)src_size;
+ (void)K;
+ (void)R;
+ (void)xmap;
+ (void)ymap;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+ return Rect();
+}
+
+
+Point CylindricalWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
+ gpu::GpuMat &dst)
+{
+ (void)src;
+ (void)K;
+ (void)R;
+ (void)interp_mode;
+ (void)border_mode;
+ (void)dst;
+ CV_Error(CV_StsNotImplemented, "CUDA optimization is unavailable");
+ return Point();
+}
#endif
void SphericalPortraitWarper::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)