Image format from capture by CSI Camera

Hi,

I have a question about image bit depth or color space converter when using CSI camera.
My platform is Jetson Nano, JetPack 4.6.1, CSI Camera: IMX219/IMX477/Imx412.
And refer this example and modify for execise:
/usr/src/jetson_multimedia_ap/argus/samples/oneShot

When using iSensorMode to get sensor image information as:
getBayerPhase is BAYER_PHASE_RGGB
getInputBitDepth is 10
getOutputBitDepth is 10

And line 128 in main.cpp, it seems set output pixel format as YCbCr_420_888
iEGLStreamSettings->setPixelFormat(Argus::PIXEL_FMT_YCbCr_420_888);

*YCbCr_420_888: android - YUV_420_888 (byte) format - Stack Overflow ?

In my thinking, EGL Stream will converter Bayer pattern(10-bit) to YCbCr_420_888 automatically after iSession->capture() and get image from iFrame->getImage()

Is it correct?

And how does it convet 10bit to 8bit? Reserve high 8 bits and ignore others?

Nope, Argus::PIXEL_FMT_YCbCr_420_888 is output configure. It’s the configuration of the ISP output format.

Thanks for reply.

So let me confirm it :
The image captured by CSI camera is raw bayer format and be sent to internal ISP to do demosaic to RGB and convert to YUV output?

Yes, that’s correct.

If require lossless compression image, may I use these settings:

PIXEL_FMT_YCbCr_422_888
PIXEL_FMT_YCbCr_444_888

And, may I get original raw bayer format under this setting?

PIXEL_FMT_RAW16

Thanks~

Nope,

  • Current EGLStream Buffer Format Support:

    Format State
    ======================= ==========
    PIXEL_FMT_Y8 Not Supported
    PIXEL_FMT_Y16 Not Supported
    PIXEL_FMT_YCbCr_420_888 Works with all consumers.
    PIXEL_FMT_YCbCr_422_888 Not Supported
    PIXEL_FMT_YCbCr_444_888 Not Supported
    PIXEL_FMT_JPEG_BLOB Not Supported (TODO: Remove format)
    PIXEL_FMT_RAW16 Works with all consumers.

Hi

Is it any possible or plan to support RGB888 format directly?

No plan for Argus, due to ISP HW don’t support it.

I can get correct image(format: “PIXEL_FMT_YCbCr_420_888”), but still want to retrive data in raw bayer format.

So I refer to this links:

Detailed Guide to LibArgus with SurveilsQuad (e-consystems.com)

Jetson nano 获取CSI相机RAW图片并转换为Mat | YangYouji’s WebSite

To change format from PIXEL_FMT_YCbCr_420_888 to PIXEL_FMT_RAW16 as follows:

iEGLStreamSettings->setPixelFormat(Argus::PIXEL_FMT_RAW16);

But run to failure at :

Argus::UniqueObjEGLStream::Frame frame(
iFrameConsumer->acquireFrame(FIVE_SECONDS_IN_NANOSECONDS, &status));

=> because of status is “STATUS_TIMEOUT”

Do you know what happens?

Have a try the cudaBayerDemosaic in MMAPI sample code.

Are those examples unavailable?

I will try “cudaBayerDemosaic” later and reply result to you.
Thanks

This example can run correctly and show image on screen.
But something wrong when I try to put image to VPI.

I open another topic to discuss:

How do I get image from cudaBayerDemosaic and connect to VPI? - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums