Best way to convert Images and preserve the original data? eg: dwImageCPU to dwImageCUDA

Hi,

I have been trying to convert images from one Driveworks API type to the other.Using the format converter does not help since data is not preserved for the new image.What is the best way to change the properties and also preserve the data for the new image type?

Eg problem:
Converting dwImageCPU imageCPU -> dwImageCUDA imageCUDA

Any help would be appreciated.
Thanks!

Dear neli,
Please find the supported formats of format converter in Section “Format Converters” in NVIDIA_Driveworks_Dev_guide.pdf. dwImageCPU has memory on CPU where as dwImageCUDA has memory allocated on GPU. You need to copy data manually to GPU to get dwImageCUDA from dwImageCPU as there no API do to this. You can use image streamer to send image frames from CPU to GPU. Please check if it helps your use case

Hi,

I will try the Image Streamer sample and see if it helps.

I don’t know how to manually copy the data from CPU type image to CUDA. Since the Image Structure are different. The content below has been copied from Driveworks SDK documentation. Which field data should I copy from CPU image to CUDA image?

dwImageCPU

struct dwImageCPU

Data Fields
uint8_t * data[DW_MAX_IMAGE_PLANES] Specifies the raw image data.
size_t pitch[DW_MAX_IMAGE_PLANES] Specifies the pitch of the image in bytes.
dwImageProperties prop Specifies the properites of the image.
dwTime_t timestamp_us Specifies the time, in microseconds, when the image was acquired.

dwImageCUDA

struct dwImageCUDA

Data Fields
cudaArray_t array[DW_MAX_IMAGE_PLANES] Holds the CUDA image plane data.
void * dptr[DW_MAX_IMAGE_PLANES] Holds the pointer to the image planes.
dwImageCUDAMemoryType layout Defines the memory layout of the image.
size_t pitch[DW_MAX_IMAGE_PLANES] Defines the pitch of each plane in bytes.
dwImageProperties prop Defines the properties of the image.
dwTime_t timestamp_us Specifies the time, in microseconds, when the image was acquired.

Dear neli,
you can cudamemcpy* call to copy data from data-> dptr or array based on dwImageCUDAMemoryType. Can you share more details about your use case like why you want to convert dwImageCPU to dwImageCUDA.