Struggling to convert a camera frame (NvBufSurface) to OpenCV Mat

Hi,
You would need to allocate NvBufSurface in RGBA. Please refer to this patch:
How to create OpenCV cv::Mat from NvBuffer in Jetpack 5.1 - #8 by DaveYYY