|
|
|
@ -219,7 +219,7 @@ MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands, int weight_type) |
|
|
|
|
num_bands_ = 0; |
|
|
|
|
setNumBands(num_bands); |
|
|
|
|
|
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
can_use_gpu_ = try_gpu && cuda::getCudaEnabledDeviceCount(); |
|
|
|
|
gpu_feed_idx_ = 0; |
|
|
|
|
#else |
|
|
|
@ -246,7 +246,7 @@ void MultiBandBlender::prepare(Rect dst_roi) |
|
|
|
|
|
|
|
|
|
Blender::prepare(dst_roi); |
|
|
|
|
|
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
if (can_use_gpu_) |
|
|
|
|
{ |
|
|
|
|
gpu_initialized_ = false; |
|
|
|
@ -332,7 +332,7 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl) |
|
|
|
|
|
|
|
|
|
UMat img; |
|
|
|
|
|
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
// If using gpu save the top left coordinate when running first time after prepare
|
|
|
|
|
if (can_use_gpu_) |
|
|
|
|
{ |
|
|
|
@ -353,7 +353,7 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl) |
|
|
|
|
{ |
|
|
|
|
img = _img.getUMat(); |
|
|
|
|
} |
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
gpu_img_ = _img.getGpuMat(); |
|
|
|
@ -394,7 +394,7 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl) |
|
|
|
|
int bottom = br_new.y - tl.y - img.rows; |
|
|
|
|
int right = br_new.x - tl.x - img.cols; |
|
|
|
|
|
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
if (can_use_gpu_) |
|
|
|
|
{ |
|
|
|
|
if (!gpu_initialized_) |
|
|
|
@ -603,7 +603,7 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl) |
|
|
|
|
void MultiBandBlender::blend(InputOutputArray dst, InputOutputArray dst_mask) |
|
|
|
|
{ |
|
|
|
|
Rect dst_rc(0, 0, dst_roi_final_.width, dst_roi_final_.height); |
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
if (can_use_gpu_) |
|
|
|
|
{ |
|
|
|
|
if (!gpu_initialized_) |
|
|
|
@ -850,7 +850,7 @@ void createLaplacePyr(InputArray img, int num_levels, std::vector<UMat> &pyr) |
|
|
|
|
|
|
|
|
|
void createLaplacePyrGpu(InputArray img, int num_levels, std::vector<UMat> &pyr) |
|
|
|
|
{ |
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
pyr.resize(num_levels + 1); |
|
|
|
|
|
|
|
|
|
std::vector<cuda::GpuMat> gpu_pyr(num_levels + 1); |
|
|
|
@ -891,7 +891,7 @@ void restoreImageFromLaplacePyr(std::vector<UMat> &pyr) |
|
|
|
|
|
|
|
|
|
void restoreImageFromLaplacePyrGpu(std::vector<UMat> &pyr) |
|
|
|
|
{ |
|
|
|
|
#if defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
#if defined(HAVE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAWARPING) |
|
|
|
|
if (pyr.empty()) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|