Named symbol not found in function bindTexture

Hello,

I’m encountering a problem on my gstreamer plugin development on Jetson platform
I’m using OpenCV 4.6.0 compiled WITH_CUDA=ON, CUDA 11.4
I’m doing :

cv::cuda::GpuMat gmat2;

myplugin->gpumat =  new cv::cuda::GpuMat(720,1080, CV_8UC4, (void*)surface->surfaceList[0].dataPtr, surface->surfaceList[0].pitch);

cv::cuda::warpAffine(*myplugin->gpumat, gmat2, *myplugin->rot_mat, myplugin->gpumat->size());

inside gst_myplugin_transform_ip function

then i have the following cv::exception :

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.6.0) /tmp/build_opencv/opencv/modules/core/include/opencv2/core/cuda/common.hpp:102: error: (-217:Gpu API call) named symbol not found in function 'bindTexture'

the gdb backtrace gives the following :

#6  0x0000ffff7797a864 in cv::error(cv::Exception const&) () at /usr/local/lib/libopencv_core.so.406
#7  0x0000ffff7797b74c in cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int) ()
    at /usr/local/lib/libopencv_core.so.406
#8  0x0000ffff785d9d8c in void cv::cuda::device::bindTexture<uchar4>(textureReference const*, cv::cuda::PtrStepSz<uchar4> const&) [clone .constprop.0] ()
    at /usr/local/lib/libopencv_cudawarping.so.406
#9  0x0000ffff785f9024 in cv::cuda::device::imgproc::WarpDispatcher<cv::cuda::device::imgproc::AffineTransform, cv::cuda::device::LinearFilter, cv::cuda::device::BrdConstant, uchar4>::call(cv::cuda::PtrStepSz<uchar4>, cv::cuda::PtrStepSz<uchar4>, int, int, cv::cuda::PtrStepSz<uchar4>, float const*, float const*, CUstream_st*, bool) ()
    at /usr/local/lib/libopencv_cudawarping.so.406
#10 0x0000ffff78635c90 in void cv::cuda::device::imgproc::warpAffine_gpu<uchar4>(cv::cuda::PtrStepSz<unsigned char>, cv::cuda::PtrStepSz<unsigned char>, int, int, float*, cv::cuda::PtrStepSz<unsigned char>, int, int, float const*, CUstream_st*, bool) () at /usr/local/lib/libopencv_cudawarping.so.406
#11 0x0000ffff7856d288 in cv::cuda::warpAffine(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double>, cv::cuda::Stream&) () at /usr/local/lib/libopencv_cudawarping.so.406
#12 0x0000ffff7a1e873c in gst_exadsexample_transform_ip(_GstBaseTransform*, _GstBuffer*) () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_exadsexample.so

I ve asked on Nvidia Forum, looked all over internet, I’m stuck

What could be the causes of such exception ? what could i do to improve resolution of this problem or to improve debugging ? anything actually …

is there a problem with my build ? it seems kinda deep problem between cuda and opencv

my next step is to debug opencv libraries in real-time if its possible …

thx for your support

Do you still get the error if you remove all pointers and create the GpuMat and ‘Mat’ using the default allocators, i.e.

GpuMat gpumat(720,1080,CV_8UC4);
Mat rot_mat(h,w,type);

Hi,

Thank you for your answer.

I don’t have problem with default allocators, even if i let the rot_mat as is

So it seems the problem is about the mapping of GpuMat onto NvSurfaceBuffer ( from nvidia jetson )

Do you mean mapping NvSurfaceBuffer to GpuMat? What is NvSurfaceBuffer I couldn’t find any docs for it?

It looks like you cannot create a texture reference from the memory you are passing to GpuMat. Do you get any errors if you pass a cv::cuda::Stream to cv::cuda::warpAffine to force it to avoid using texture memory?

Oh i’m sorry , its NvBufSurface

I will try with cv::cuda::Stream

Its working by passing through CUDA EGL Interop

as seen in How to create opencv gpumat from nvstream? - #18 by DaneLLL - DeepStream SDK - NVIDIA Developer Forums