opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.45k stars 5.77k forks source link

cuda::remap - illegal memory access #2712

Open gyzcode opened 4 years ago

gyzcode commented 4 years ago
System information (version)
Detailed description

For some specific data, the cpu version remap works fine, but the cuda version remap can not work. The error message is as follows: OpenCV(4.4.0) Error: Gpu API call (an illegal memory access was encountered) in cv::cuda::device::imgproc::RemapDispatcherNonStream<Filter, B, T>::call, file D:/programming/ opencv_contrib-4.4.0/modules/cudawarping/src/cuda/remap.cu, line 107

Steps to reproduce

map data to reproduce:map.zip

// C++ code example

#include <opencv2/opencv.hpp>
#include <opencv2/cudawarping.hpp>

using namespace cv;
using namespace cv::cuda;

int main(int argc, const char** argv)
{
    FileStorage fs("D:/map.yml", FileStorage::READ);
    Mat map1, map2;
    fs["map1"] >> map1;
    fs["map2"] >> map2;
    fs.release();

    Mat src, dst;
    src = Mat(640, 640, CV_8UC3, Scalar(255,255,255));
    cv::remap(src, dst, map1, map2, INTER_LINEAR);

    imshow("dst", dst);
    waitKey();

    GpuMat gsrc, gdst, gmap1, gmap2;
    gmap1.upload(map1);
    gmap2.upload(map2);
    gsrc.upload(src);
    cuda::remap(gsrc, gdst, gmap1, gmap2, INTER_LINEAR);
    gdst.download(dst);

    imshow("gdst", dst);
    waitKey();

    return 0;
}
Issue submission checklist
alalek commented 4 years ago

Looks like a duplicate of #2361