How to create OpenCV cv::Mat from NvBuffer in Jetpack 5.1

Hi,
Please refer to this patch:
NVBuffer (FD) to opencv Mat - #6 by DaneLLL

And replace NvBuffer APIs with NvBufSurfaceMap()/NvBufSurfaceUnMap()