How to perform conversion from opencv matrix to dwImageCUDA?

I’ve already convert dwImageCUDA to OpenCV GpuMat and ran my algorithm on it. Now I need to convert it back to show in the streaming window. Is there a way to convert cv::cuda::GpuMat to a dwImageCUDA?

Hi,

Suppose you can use this function to create a buffer for dwRenderEngine:

DW_API_PUBLIC dwStatus dwRenderEngine_createBuffer ( uint32_t *  bufferId,
                                                     dwRenderEnginePrimitiveType type,
                                                     uint32_t vertexStrideBytes,
                                                     uint32_t offsetBytes,
                                                     uint32_t primitiveCount,
                                                     dwRenderEngineHandle_t 	engine 
)

We will check if there is an example can share with you later.
Thanks.

Hi,

You should be able to declare a DriveWorks image from GpuMat like this:

dwImageCUDA oriImage;
...
// oriImage -> cv::cuda::GpuMat
...
dwImageCUDA updatedImage;
memcpy(&updatedImage, oriImage, sizeof(dwImageCUDA));
updatedImage.dptr[0] = opencvImg.data;
dwImageStreamer_postCUDA(&updatedImage, state.cuda2gl);
dwImageStreamer_receiveGL(&outputGL, -1, state.cuda2gl);

Thanks.

AastaLLL,

Thank you for the example. I am using 1.2.400 Release (v0.9.8) and I could not find the functions “dwImageStreamer_postCUDA” and “dwImageStreamer_receiveGL” in the documentation. When I try to compile the code (using my variables), I got an error that the functions don’t exist.

Maybe this will be available in a new SDK version?

Hi,

It should be ‘dwImageStreamer_post’ and ‘dwImageStreamer_waitPosted’.
Could you give it a try?

Thanks.

I found this two functions in SDK 0.6 version but not in the 1.2.400 one. The only functions I have in ImageStreamer.h are:

dwImageStreamerHandle_t
dwImageStreamerCrossProcessMode
dwImageStreamer_consumerReceive
dwImageStreamer_consumerReturn
dwImageStreamer_getCUDAStream
dwImageStreamer_getOutputProperties
dwImageStreamer_initialize
dwImageStreamer_initializeCrossProcess
dwImageStreamer_producerReturn
dwImageStreamer_producerSend
dwImageStreamer_release
dwImageStreamer_setCUDAStream

Maybe they have been replaced or just removed.

Hi,

We will check this issue this week.
Will update information with you later.

Thanks for your patience.

Any news?

Hi,

Sorry for the late update.
Would you mind to update to our latest release and see if this issue still remains first.

Thank.