NV Multimedia API with OpenCV

Hi,
You need to create the render buffer in RGBA:

    input_params.payloadType = NvBufferPayload_SurfArray;
    input_params.width = ctx->cam_w;
    input_params.height = ctx->cam_h;
    input_params.layout = NvBufferLayout_Pitch;
-    input_params.colorFormat = get_nvbuff_color_fmt(V4L2_PIX_FMT_YUV420M);
+    input_params.colorFormat = NvBufferColorFormat_ABGR32;
    input_params.nvbuf_tag = NvBufferTag_NONE;

    /* Create Render buffer */
    if (-1 == NvBufferCreateEx(&ctx->render_dmabuf_fd, &input_params));

And map the buffer to cv::Mat(CV_8UC4):

+            cv::Mat imgbuf = cv::Mat(_HEIGHT_,
+                                     _WIDTH_,
+                                     CV_8UC4, pdata);

This should get cv::Mat in RGBA.