Need help to convert nvbuffer to cv::mat using libargus on TX2

Hi ShaneCCC,
Thanks for your reply. Based on your suggestion, I have given it a thought again. According to this post, NvBufferTransform is done inside

iNativeBuf->createNvBuffer(iSensorMode->getResolution(),NvBufferColorFormat_ABGR32, NvBufferLayout_Pitch);

line of code. So from camera, I got the image in YUV420 format (iEGLStreamSettings->setPixelFormat(Argus::PIXEL_FMT_YCbCr_420_888);) and then I call createNvBuffer to convert it to ABGR32 with pitch layout. Then I create the cv::mat by

cv::Mat imgbuf = cv::Mat(iSensorMode->getResolution().height(), iSensorMode->getResolution().width(),CV_8UC4, pdata);

I suspect that it is either the NvBufferColorFormat or NvBufferLayout is to be adjusted or changed. Could you shed more light to this issue?

Thanks

Jon Liu