Hello, I’m trying to develop a gstreamer plugin from the deepstream gst-plugin example on Jetson AGX Orin, where I rotate the input buffer by a constant.
I want to use the cv::cuda::WarpAffine function , with the available “NvBufSurface* surface” inside transform_ip function, map cv::cuda::GpuMat to it, and also use the “NvBufSurface* inter_buf” from the example
GStreamer crash with cv::Exception "…cuda/gpu_mat.cu:386: error: (-217:Gpu API call) invalid argument in function ‘setTo’ "
I don’t know how to progress from here, if it is related to image format like CV_8UC3, or some CUDA initialization. I don’t know how to debug the openCV library.
I posted my whole code on GitHub - ZeroVital/DsExample at DsExample_0.1 if someone have clue on the problem , DsExample has been simplified to maximum
Here, the most important lines :
dsexample->gpumat = new cv::cuda::GpuMat(dsexample->processing_height, dsexample->processing_width,
CV_8UC3, surface->surfaceList[0].dataPtr, dsexample->processing_width * RGB_BYTES_PER_PIXEL);
//Memset the memory
NvBufSurfaceMemSet (dsexample->inter_buf, 0, 0, 0);
dsexample->rot_gpumat = new cv::cuda::GpuMat(dsexample->processing_height, dsexample->processing_width,
CV_8UC3, dsexample->inter_buf->surfaceList[0].dataPtr, dsexample->processing_width * RGB_BYTES_PER_PIXEL);
dsexample->pt_rot = new cv::Point2f(dsexample->processing_height/2., dsexample->processing_width/2.);
dsexample->rot_mat = new cv::Mat(2, 3, CV_64F);
*dsexample->rot_mat = cv::getRotationMatrix2D(*dsexample->pt_rot, 10, 1.0); // 10° rotation for example
cv::cuda::warpAffine(*dsexample->gpumat, *dsexample->rot_gpumat, *dsexample->rot_mat, dsexample->gpumat->size());
Also, after success on WarpAffine, how should i replace the input_buffer of gstreamer for the next element ? is transform_ip the right tool for the job ?
Thank you for your support.
Regards,
Anton