How do I get RGB data from Nvmedia interface?

I’m working on a PX2 project, and we want to use the streaming data capturing from camera (ar0231) to do some DNN applications.
Now, we are using ipp_raw as our capturing side.
In this architecture, we try to send out images with RGB format since that’s the color format our applications could handle.
But I only find that outputSurfType can only be configured as RGBA. Is it possible to do some change to make the output as RGB.

NVM_SURF_FMT_DEFINE_ATTR(surfFormatAttrs);
NVM_SURF_FMT_SET_ATTR_RGBA(surfFormatAttrs, RGBA, UINT, 8, PL);
args->outputSurfType = NvMediaSurfaceFormatGetType(surfFormatAttrs, NVM_SURF_FMT_ATTR_MAX);

Dear zhuce_cgf,
There is no inbuilt function to Extract RGB from RGBA. you need to access them byte by byte to extract individual channels.

Thanks for the answer. I understand your answer. THen is there a method to get RGB directly from nvmedia? (I mean not converted from YUV or RGBA, the output is RGB at the first time.)

Thanks again.

Dear zhuce_cgf,
There is no method to get RGB directly via NvMedia. You can get RGBA and you need to extract the RGB channels carefully from it.

OK. I see. Then I need to get the RGBA first. But I find that the image is kind of weird when I set the output RGBA instead of YUV. On the other hand, the YUV image is quite normal when I set the output surface YUV. Do you have any clue about this situation?

Thanks for the answer.

Dear zhuce_cgf,
You can check converting YUV to RGBA using NvMedia2DBlitEx() and then sent it to your network. Please check NVMedia API documentation and grep for the usage of NvMedia2DBlitEx() in samples