1 | initial version |
Here is how I solved the issue:
Essentially, if I replace src = src_bgr;
with src_bgr.copyTo(src);
or gpu_src.upload(src_bgr);
it's working.
enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
cv::cuda::HostMem cudamem_src(src_bgr.size(), CV_8UC3, cv::cuda::HostMem::AllocType::SHARED );
cv::cuda::HostMem cudamem_dst(src_bgr.size(), CV_8UC3, cv::cuda::HostMem::AllocType::SHARED);
cv::cuda::GpuMat gpu_src = cudamem_src.createGpuMatHeader();
cv::cuda::GpuMat gpu_dst = cudamem_dst.createGpuMatHeader();
cv::Mat src = cudamem_src.createMatHeader();
cv::Mat dst = cudamem_dst.createMatHeader();
// src_bgr.copyTo(src);
gpu_src.upload(src_bgr);
cv::cuda::remap(gpu_src, gpu_dst, gpu_map1, gpu_map2, cv::INTER_LINEAR);
cv::imwrite("imgout.jpg", dst);
2 | No.2 Revision |
Here is how I solved the issue:
Essentially, if I replace src = src_bgr;
with src_bgr.copyTo(src);
or gpu_src.upload(src_bgr);
it's working.
enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
cv::cuda::HostMem cudamem_src(src_bgr.size(), CV_8UC3, cv::cuda::HostMem::AllocType::SHARED );
cv::cuda::HostMem cudamem_dst(src_bgr.size(), CV_8UC3, cv::cuda::HostMem::AllocType::SHARED);
cv::cuda::GpuMat gpu_src = cudamem_src.createGpuMatHeader();
cv::cuda::GpuMat gpu_dst = cudamem_dst.createGpuMatHeader();
cv::Mat src = cudamem_src.createMatHeader();
cv::Mat dst = cudamem_dst.createMatHeader();
// src_bgr.copyTo(src);
gpu_src.upload(src_bgr);
cv::cuda::remap(gpu_src, gpu_dst, gpu_map1, gpu_map2, cv::INTER_LINEAR);
cv::imwrite("imgout.jpg", dst);
I wonder what's the difference between src = src_bgr;
with src_bgr.copyTo(src);
3 | No.3 Revision |
Here is how I solved the issue:
Essentially, if I replace src = src_bgr;
with src_bgr.copyTo(src);
or gpu_src.upload(src_bgr);
it's working.
enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
cv::cuda::HostMem cudamem_src(src_bgr.size(), CV_8UC3, cv::cuda::HostMem::AllocType::SHARED );
cv::cuda::HostMem cudamem_dst(src_bgr.size(), CV_8UC3, cv::cuda::HostMem::AllocType::SHARED);
cv::cuda::GpuMat gpu_src = cudamem_src.createGpuMatHeader();
cv::cuda::GpuMat gpu_dst = cudamem_dst.createGpuMatHeader();
cv::Mat src = cudamem_src.createMatHeader();
cv::Mat dst = cudamem_dst.createMatHeader();
// src_bgr.copyTo(src);
gpu_src.upload(src_bgr);
cv::cuda::remap(gpu_src, gpu_dst, gpu_map1, gpu_map2, cv::INTER_LINEAR);
cv::imwrite("imgout.jpg", dst);
I wonder what's the difference between src = src_bgr;
with and src_bgr.copyTo(src);