Getting Grayscale image using Argus from IMX219 CSI camera

I see there is buffer NvBufferColorFormat_GRAY8 and ISP seems to support Bayer conversion to Gray, but all examples are for color jpeg images and I, already, spend few days trying to find how to. So, how can I get grayscale image from CSI camera and write it uncompressed (e.g. not using jpeg) like png or give it to CUDA? I need grayscale image to process it using CUDA for computer vision as well as saving few images for camera calibration in opencv.

Thank you.

You can get NvBufferColorFormat_NV12 buffer from Argus and convert to NvBufferColorFormat_GRAY8 by calling NvBufferTransform(). However, NvBufferColorFormat_GRAY8 is not supported by CUDA.
A similar query:

I guess, GRAY8 is not supported by EGL, but for Unified Memory, it should not matter, I guess. Is there a way to avoid using EGL and use Unified/Zero copy memory? or Argus/ISP can export only to EGL buffers?

Argus can output to either EGL Buffers or NvBuffer. If you need the frames in unified memory, you may need to allocate the buffers and copy from the EGL buffers(or NVBuffer).

Hi DaneLLL,

I already used cudaHistogram example as it is exactly what I need - it uses Y channel from YUV image in cuda kernel and Y channel happens to be Grayscale image. Initially, I had troubles understanding it, but now all is good.

1 Like