Pyramid Laplace Cuda
Hi guys, I'm trying to use laplacianPyramid with cuda, I found this implementation from modules:
void createLaplacePyrGpu(const Mat &img, int levels, vector<Mat> &pyr)
{
#ifdef HAVE_OPENCV_GPU
pyr.resize(levels + 1);
vector<cuda::GpuMat> gpu_pyr(levels + 1);
gpu_pyr[0].upload(img);
for (int i = 0; i < levels; ++i){
cuda::pyrDown(gpu_pyr[i], gpu_pyr[i + 1]);
}
cuda::GpuMat tmp,tmp2;
for (int i = 0; i < levels; ++i)
{
cuda::pyrUp(gpu_pyr[i + 1], tmp);
cuda::subtract(gpu_pyr[i], tmp, gpu_pyr[i]);
gpu_pyr[i].download(pyr[i]);
}
gpu_pyr[levels].download(pyr[levels]);
#else
(void)img;
(void)levels;
(void)pyr;
#endif
}
With an input image of 960x1080 pixels, at the last iteration of the second for, the function subtract fails, because the two GpuMat are differents.
In the example code, the input image "img", was came from a cv::copyMakeBorder, but I don't get how to build the image with borders for to avoid the error?
Any help?
Thanks for your time.
Mau