Converting lraw data to frame images lossless

Hi,

Is there a direct way to extract images (e.g. bmp) from lraw data w/o losing quality ?

I am not seeking for a solution like “converting lraw to mp4 then converting mp4 to the images”.

Thanks in advance.

Hi uuresin,
what camera are you using? GMSL or USB?
Have you tried using one of the samples of Drive Works?

for GMSL please refer to the sample “dwx_camera_gmsl_raw_sample”. this raw format will have no quality loss.
Also the sample “sample_camera_gmsl” uses receive format of DW_IMAGE_FORMAT_RGBA_UINT8 so the data being drawn to the screen is the simple raw RGBRGB… colors. so you can use at that point of drawing any library that saves the image as a bmp format.

Hi,

I am using GMSL camera but the point is I am not trying to export images when camera is connected**.
I am trying to export images from the lraw data after finishing recording process.

**
@dwx_camera_gmsl_raw_sample:
“A camera must be connected to one of the NVIDIA DRIVE platform camera groups.”

Thanks!

Hi uuresin,

than if you are trying to export data from lraw file than please follow the sample sample_camera_replay that accepts among other lraw input format file, then you can use the read RGBA frame data as you wish - instead of displaying it on the screen, you can save it as an image by adding you’re code for that.

Hi shayNV,

As far as I understand, you recommend me to use sample_camera_replay and add my code onto it to save an event as image (instead of displaying it).

I checked sample_camera_replay (under /usr/local/driveworks/bin), however, it seems it’s binary and I do not know how can I add my code onto it?

Hello uuresin,

I suggested you use the sample_camera_replay for it will be a good starting point for you.

I try to elaborate more:
Notice that sample code, no matter what input format you choose, at the end of the onProcess method you will have the m_imageRGBA variable (of type dwImageHandle_t) holding the image RGBA format after conversion (if needed).
note the comment in the code:
// if raw, grab the raw frame (CUDA RAW), pass it through the isp the retrieve a converted frame (CUDA RGBA)
(The reason for that is that in order to display the image onto the screen the format input must be RGBA. and that is why I suggested using this sample code)

at that point, you can use dwImage_getCUDA API to get the CUDA memory of the frame in RGBA format to your disposal, then you can convert it to whatever format you wish and save it wherever you want.

also, notice that there is no event-driven process here.