renamed gpu namespace -> cuda
This commit is contained in:
@@ -189,7 +189,7 @@ MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands, int weight_type)
|
||||
setNumBands(num_bands);
|
||||
|
||||
#if defined(HAVE_OPENCV_GPUARITHM) && defined(HAVE_OPENCV_GPUWARPING)
|
||||
can_use_gpu_ = try_gpu && gpu::getCudaEnabledDeviceCount();
|
||||
can_use_gpu_ = try_gpu && cuda::getCudaEnabledDeviceCount();
|
||||
#else
|
||||
(void) try_gpu;
|
||||
can_use_gpu_ = false;
|
||||
@@ -494,16 +494,16 @@ void createLaplacePyrGpu(const Mat &img, int num_levels, std::vector<Mat> &pyr)
|
||||
#if defined(HAVE_OPENCV_GPUARITHM) && defined(HAVE_OPENCV_GPUWARPING)
|
||||
pyr.resize(num_levels + 1);
|
||||
|
||||
std::vector<gpu::GpuMat> gpu_pyr(num_levels + 1);
|
||||
std::vector<cuda::GpuMat> gpu_pyr(num_levels + 1);
|
||||
gpu_pyr[0].upload(img);
|
||||
for (int i = 0; i < num_levels; ++i)
|
||||
gpu::pyrDown(gpu_pyr[i], gpu_pyr[i + 1]);
|
||||
cuda::pyrDown(gpu_pyr[i], gpu_pyr[i + 1]);
|
||||
|
||||
gpu::GpuMat tmp;
|
||||
cuda::GpuMat tmp;
|
||||
for (int i = 0; i < num_levels; ++i)
|
||||
{
|
||||
gpu::pyrUp(gpu_pyr[i + 1], tmp);
|
||||
gpu::subtract(gpu_pyr[i], tmp, gpu_pyr[i]);
|
||||
cuda::pyrUp(gpu_pyr[i + 1], tmp);
|
||||
cuda::subtract(gpu_pyr[i], tmp, gpu_pyr[i]);
|
||||
gpu_pyr[i].download(pyr[i]);
|
||||
}
|
||||
|
||||
@@ -535,15 +535,15 @@ void restoreImageFromLaplacePyrGpu(std::vector<Mat> &pyr)
|
||||
if (pyr.empty())
|
||||
return;
|
||||
|
||||
std::vector<gpu::GpuMat> gpu_pyr(pyr.size());
|
||||
std::vector<cuda::GpuMat> gpu_pyr(pyr.size());
|
||||
for (size_t i = 0; i < pyr.size(); ++i)
|
||||
gpu_pyr[i].upload(pyr[i]);
|
||||
|
||||
gpu::GpuMat tmp;
|
||||
cuda::GpuMat tmp;
|
||||
for (size_t i = pyr.size() - 1; i > 0; --i)
|
||||
{
|
||||
gpu::pyrUp(gpu_pyr[i], tmp);
|
||||
gpu::add(tmp, gpu_pyr[i - 1], gpu_pyr[i - 1]);
|
||||
cuda::pyrUp(gpu_pyr[i], tmp);
|
||||
cuda::add(tmp, gpu_pyr[i - 1], gpu_pyr[i - 1]);
|
||||
}
|
||||
|
||||
gpu_pyr[0].download(pyr[0]);
|
||||
|
@@ -44,7 +44,7 @@
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv::detail;
|
||||
using namespace cv::gpu;
|
||||
using namespace cv::cuda;
|
||||
|
||||
#ifdef HAVE_OPENCV_NONFREE
|
||||
#include "opencv2/nonfree.hpp"
|
||||
|
@@ -1423,14 +1423,14 @@ void GraphCutSeamFinderGpu::findInPair(size_t first, size_t second, Rect roi)
|
||||
CV_Error(Error::StsBadArg, "unsupported pixel similarity measure");
|
||||
}
|
||||
|
||||
gpu::GpuMat terminals_d(terminals);
|
||||
gpu::GpuMat leftT_d(leftT);
|
||||
gpu::GpuMat rightT_d(rightT);
|
||||
gpu::GpuMat top_d(top);
|
||||
gpu::GpuMat bottom_d(bottom);
|
||||
gpu::GpuMat labels_d, buf_d;
|
||||
cuda::GpuMat terminals_d(terminals);
|
||||
cuda::GpuMat leftT_d(leftT);
|
||||
cuda::GpuMat rightT_d(rightT);
|
||||
cuda::GpuMat top_d(top);
|
||||
cuda::GpuMat bottom_d(bottom);
|
||||
cuda::GpuMat labels_d, buf_d;
|
||||
|
||||
gpu::graphcut(terminals_d, leftT_d, rightT_d, top_d, bottom_d, labels_d, buf_d);
|
||||
cuda::graphcut(terminals_d, leftT_d, rightT_d, top_d, bottom_d, labels_d, buf_d);
|
||||
|
||||
Mat_<uchar> labels = (Mat)labels_d;
|
||||
for (int y = 0; y < roi.height; ++y)
|
||||
|
@@ -57,7 +57,7 @@ Stitcher Stitcher::createDefault(bool try_use_gpu)
|
||||
stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
if (try_use_gpu && gpu::getCudaEnabledDeviceCount() > 0)
|
||||
if (try_use_gpu && cuda::getCudaEnabledDeviceCount() > 0)
|
||||
{
|
||||
#ifdef HAVE_OPENCV_NONFREE
|
||||
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinderGpu());
|
||||
|
@@ -211,85 +211,85 @@ void SphericalWarper::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_b
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCV_GPUWARPING
|
||||
Rect PlaneWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, gpu::GpuMat &xmap, gpu::GpuMat &ymap)
|
||||
Rect PlaneWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, cuda::GpuMat &xmap, cuda::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)
|
||||
Rect PlaneWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, const Mat &T, cuda::GpuMat &xmap, cuda::GpuMat &ymap)
|
||||
{
|
||||
projector_.setCameraParams(K, R, T);
|
||||
|
||||
Point dst_tl, dst_br;
|
||||
detectResultRoi(src_size, dst_tl, dst_br);
|
||||
|
||||
gpu::buildWarpPlaneMaps(src_size, Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)),
|
||||
cuda::buildWarpPlaneMaps(src_size, Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)),
|
||||
K, R, T, projector_.scale, xmap, ymap);
|
||||
|
||||
return Rect(dst_tl, dst_br);
|
||||
}
|
||||
|
||||
Point PlaneWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
|
||||
gpu::GpuMat &dst)
|
||||
Point PlaneWarperGpu::warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
|
||||
cuda::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)
|
||||
Point PlaneWarperGpu::warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, const Mat &T, int interp_mode, int border_mode,
|
||||
cuda::GpuMat &dst)
|
||||
{
|
||||
Rect dst_roi = buildMaps(src.size(), K, R, T, d_xmap_, d_ymap_);
|
||||
dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type());
|
||||
gpu::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
|
||||
cuda::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
|
||||
return dst_roi.tl();
|
||||
}
|
||||
|
||||
|
||||
Rect SphericalWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, gpu::GpuMat &xmap, gpu::GpuMat &ymap)
|
||||
Rect SphericalWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, cuda::GpuMat &xmap, cuda::GpuMat &ymap)
|
||||
{
|
||||
projector_.setCameraParams(K, R);
|
||||
|
||||
Point dst_tl, dst_br;
|
||||
detectResultRoi(src_size, dst_tl, dst_br);
|
||||
|
||||
gpu::buildWarpSphericalMaps(src_size, Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)),
|
||||
cuda::buildWarpSphericalMaps(src_size, Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)),
|
||||
K, R, projector_.scale, xmap, ymap);
|
||||
|
||||
return Rect(dst_tl, dst_br);
|
||||
}
|
||||
|
||||
|
||||
Point SphericalWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
|
||||
gpu::GpuMat &dst)
|
||||
Point SphericalWarperGpu::warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
|
||||
cuda::GpuMat &dst)
|
||||
{
|
||||
Rect dst_roi = buildMaps(src.size(), K, R, d_xmap_, d_ymap_);
|
||||
dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type());
|
||||
gpu::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
|
||||
cuda::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
|
||||
return dst_roi.tl();
|
||||
}
|
||||
|
||||
|
||||
Rect CylindricalWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, gpu::GpuMat &xmap, gpu::GpuMat &ymap)
|
||||
Rect CylindricalWarperGpu::buildMaps(Size src_size, const Mat &K, const Mat &R, cuda::GpuMat &xmap, cuda::GpuMat &ymap)
|
||||
{
|
||||
projector_.setCameraParams(K, R);
|
||||
|
||||
Point dst_tl, dst_br;
|
||||
detectResultRoi(src_size, dst_tl, dst_br);
|
||||
|
||||
gpu::buildWarpCylindricalMaps(src_size, Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)),
|
||||
cuda::buildWarpCylindricalMaps(src_size, Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1)),
|
||||
K, R, projector_.scale, xmap, ymap);
|
||||
|
||||
return Rect(dst_tl, dst_br);
|
||||
}
|
||||
|
||||
|
||||
Point CylindricalWarperGpu::warp(const gpu::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
|
||||
gpu::GpuMat &dst)
|
||||
Point CylindricalWarperGpu::warp(const cuda::GpuMat &src, const Mat &K, const Mat &R, int interp_mode, int border_mode,
|
||||
cuda::GpuMat &dst)
|
||||
{
|
||||
Rect dst_roi = buildMaps(src.size(), K, R, d_xmap_, d_ymap_);
|
||||
dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type());
|
||||
gpu::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
|
||||
cuda::remap(src, dst, d_xmap_, d_ymap_, interp_mode, border_mode);
|
||||
return dst_roi.tl();
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user