Yes, I am exactly using that example as a starting pint.
It uses JPG encoder to save the image in a file, but I need to get the data real-time and avoid encoding latencies, unfortunately I did not find any examples of reading the RGB data from IImage2d.
There is another example which requests RGB data instead (demosaicOutput), which uses PIXEL_FMT_LegacyRGBA but this does not work for getting more than one frame, in the same example for the setting PIXEL_FMT_YCbCr_420_888, works properly in a loop, but RGBA format freezes on the second iFrameConsumer->acquireFrame request.
Thank you for your response, this was very helpful, I was able to get the ARGB image.
Since I need to get the best performance I want to avoid any copies and color conversions,
Is there a way to use the YUV_444 format and then construct opencv cuda GPU mat in YUV format and avoid color conversions, ideally even extra copies?
I tried using the NVBUF_COLOR_FORMAT_YUV444color format, but getting an error at reading the the data. I assume this is because YUV444 is multi-planar but not sure if there is a fast way to construct a GPU mat from YUV444 data.
I got the RGBA mat, but the conversion and especially registering the image cuGraphicsResourceGetMappedEglFrame are a bit slow since I have 3 4032x3040 videos at 30FPS.
I have another question about using the YUV format,
In my case, it’s not even mandatory to create an opencv Mat as long as I can access channel data with Cuda. I can modify my processing to expect each channel separately as long as they are available in Cuda.
Are there any resources on how I can access each channel without copying them to CPU and then moving it back?