Conversion and difference between DW_CAMERA_RAW_IMAGE and DW_CAMERA_PROCESSED_IMAGE

Hi,

I’m writing a code where I have to get dwImageNvMedia from camera in raw (DW_CAMERA_RAW_IMAGE) format, and convert it to dwImageNvMedia RGBA. I found an example in driveworks where they are using DW_CAMERA_PROCESSED_IMAGE from camera and converting that dwImageNvMedia directly to RGBA.

I tried to change the code to get dwImageNvMedia camera image in DW_CAMERA_RAW_IMAGE format, but if I try to convert that dwImageNvMedia to RGBA, following the example from camera_multiple_gmsl, I get NvMedia2DBlitEx: Bad surface type combination error.

Sample code:

// image properties

dwImageProperties cameraImageProperties;
dwSensorCamera_getImageProperties(&cameraImageProperties, DW_CAMERA_RAW_IMAGE, sensor);
dwImageProperties displayImageProperties = cameraImageProperties;
displayImageProperties.pxlFormat = DW_IMAGE_RGBA;
displayImageProperties.planeCount = 1;

// init converter!

result = dwImageFormatConverter_initialize(&raw2rgba, cameraImageProperties.type, sdk);

// init rgba dwImageNvMedia

dwImageNvMedia rgba{};
result = dwImageNvMedia_create(&rgba, &displayImageProperties, sdk);

// get image from camera and try to convert it!

result = dwSensorCamera_getImageNvMedia(&frameNVMraw, DW_CAMERA_RAW_IMAGE, frameHandle);
result = dwImageFormatConverter_copyConvertNvMedia(frameNVMrgba, frameNVMraw, raw2rgba);
–> error (NvMedia2DBlitEx: Bad surface type combination)

Furthermore,
what’s the easiest way to change driveworks example to use DW_CAMERA_RAW_IMAGE insted of DW_CAMERA_PROCESSED_IMAGE ?

Also, is it possible to get DW_CAMERA_RAW_IMAGE from camera, convert it to YUV format and get DW_CAMERA_PROCESSED_IMAGE out of it. Like a converter between DW_CAMERA_RAW_IMAGE and DW_CAMERA_PROCESSED_IMAGE?

Thanks in advance,
Anja

Dear Anja,
NvMedia2DBlitEx Does not support RAW to RGBA conversion. So you are getting the error “Bad surface type combination”. Driveworks does not have direct mechanism to convert DW_CAMERA_RAW_IMAGE to YUV. You may have to use NVMedia APIs to construct an IPP pipeline to convert RAW to YUV using ISP. Please find NVMedia samples at <DriveInstall_PATH>/5050aL_SDK/DriveSDK/drive-t186ref-linux/samples/nvmedia on Host machine. Please refer to NvMedia Documentation at http://docs.nvidia.com/drive/nvvib_docs/index.html#page/NVIDIA%20DRIVE%20Linux%20SDK%20Development%20Guide%2FMultimedia%2Fmultimedia_guide.html%23

Could please tell why you are looking for this use case?