Misaligned address by cv::cuda::cvtColor within Gstreamer plugin Jetson

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.1
• JetPack Version (valid for Jetson only) 4.x
• TensorRT Version 8.4
• Issue Type( questions, new requirements, bugs) questions

Hello. I’m trying to customize dsexample plugin with cuda based opencv processing.

And i’m struggling an error misalined address for hours.
The error occurs when i run gstreamer pipeline which includes this customzied dsexample
The code goes below.

      frame_meta = (NvDsFrameMeta *) (l_frame->data);
      if (NvBufSurfaceMapEglImage(surface, frame_meta->batch_id)) {
        GST_ELEMENT_ERROR (dsexample, STREAM, FAILED,
        ("failed"), (NULL));
        goto error;
      }

      cv::Mat in_mat;
      NvBufSurfaceMemSet(surface, frame_meta->batch_id, 0, 0);
      const int aDstOrder[] = {2,0,1,3};
      cv::cuda::GpuMat gpuMat, gpuMat2;
      gpuMat = 
           cv::cuda::GpuMat(surface->surfaceList[frame_meta->batch_id].planeParams.height[0],
           surface->surfaceList[frame_meta->batch_id].planeParams.width[0], CV_8UC4,
           (void *) surface->surfaceList[frame_meta->batch_id].mappedAddr.eglImage,
           surface->surfaceList[frame_meta->batch_id].planeParams.pitch[0]);
      cv::cuda::cvtColor(gpuMat, gpuMat2, cv::COLOR_RGBA2BGR);

i think i’m missing some understandings of Jetson architecture.
I searched the Internet for this issue for very hours, but couldn’t find any help.

Give me some advice.
Best regards.

Can below guide help?

Implementing a Custom GStreamer Plugin with OpenCV Integration Example — DeepStream 6.1 Release documentation (nvidia.com)

No. I read the guide before and tried the provided code only to see some errors.

I would appreciate if you could give me other help.
i just can’t get over the issue by myself. i searched the Internet a whole day before i ask help here.

Can you provide the reproduce? Can you conform the input buffer is RGBA format?

Hi @kesong , sorry for delay.

Finally, I was able to achieve my goad by following this post.

I’m not sure what was the cause of my issue, but probably some cuda operation was needed.

Anyway, thanks very much for your help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.