# GetcudaImage error: 

**URL:** <https://forums.developer.nvidia.com/t/getcudaimage-error/76218>\
**Category:** DriveWorks\
**Created:** [June 11, 2019, 11:25am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218 "2019-06-11T11:25:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 11, 2019, 11:25am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/1 "2019-06-11T11:25:02Z")

</div>

I am using driveworks showing images and doing other things. In one thread I capture cuda image use interface dwSensorCamera\_getImage(&image\_handle, DW\_CAMERA\_OUTPUT\_CUDA\_RGBA\_UINT8, frame\_handle).  
In another thread I get image from the handle “CHECK\_DW\_ERROR(dwImage\_getCUDA(&rgba\_image, frame\_data.frame\_handle))”, if the thread is much slower than the capture, the procedure will crash and print error like “Driveworks exception thrown: DW\_CUDA\_ERROR: Call failed cuEGLStreamConsumerAcquireFrame : unspecified launch failure”.  
How can I solve this problem? Thanks!

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 12, 2019, 9:05am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/2 "2019-06-12T09:05:05Z")

</div>

Hi yxiang,

In our documentation you do find more information on how to proceed if you look for Image Processing-\>Image.

To answer your problem your calls are not thread safe, so what you can do to “solve this problem” is simply using streamers as here:

```auto
// Thread 1:
dwImageStreamer_initialize(...);
while(true)
{
    // CODE: Get an image to stream
    dwImageStreamer_producerSend(...);
    dwImageStreamer_producerReturn(TIMEOUT);
}
dwImageStreamer_release(...);
// Thread 2:
// CODE: If the streamer has been initialized on thread 1
while(true)
{
    dwImageStreamer_consumerReceive(TIMEOUT);
    // CODE: Use the streamed image
    dwImageStreamer_consumerReturn(...);
}

```

Besides you do find some samples on how to use our streamers in the DW package as well.

All clear?

Best regards,  
Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 14, 2019, 2:31am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/3 "2019-06-14T02:31:57Z")

</div>

OK, very thanks. I will have a try.

> [@FabianWeise](#):
>
> Hi yxiang,
> 
> In our documentation you do find more information on how to proceed if you look for Image Processing-\>Image.
> 
> To answer your problem your calls are not thread safe, so what you can do to “solve this problem” is simply using streamers as here:
> 
> ```auto
> // Thread 1:
> dwImageStreamer_initialize(...);
> while(true)
> {
> // CODE: Get an image to stream
> dwImageStreamer_producerSend(...);
> dwImageStreamer_producerReturn(TIMEOUT);
> }
> dwImageStreamer_release(...);
> // Thread 2:
> // CODE: If the streamer has been initialized on thread 1
> while(true)
> {
> dwImageStreamer_consumerReceive(TIMEOUT);
> // CODE: Use the streamed image
> dwImageStreamer_consumerReturn(...);
> }
> 
> ```
> 
> Besides you do find some samples on how to use our streamers in the DW package as well.
> 
> All clear?
> 
> Best regards,  
> Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 14, 2019, 2:48am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/4 "2019-06-14T02:48:01Z")

</div>

And another question, I used the below codes getting cuda image and did something with the image  
while(true)  
{  
dwSensorCamera\_readFrame(&frame\_handle, camera\_idx, 500000, sal\_sensor\_);  
CHECK\_DW\_ERROR(dwSensorCamera\_getImage(&image\_handle, DW\_CAMERA\_OUTPUT\_CUDA\_RGBA\_UINT8, frame\_handle));  
CHECK\_DW\_ERROR(dwImage\_getCUDA(&rgba\_image, image\_handle));  
Process(rgba\_image); //maybe cost 100ms  
}  
when I run the procedure, the warnings were always printed:  
[14-6-2019 10:21:6] CameraGMSL: Frame: 627 CaptureTimestamp: 2252328673 - ICP DROP in camera 0  
[14-6-2019 10:21:6] CameraGMSL: Frame: 627 CaptureTimestamp: 2252328699 - ICP DROP in camera 1  
[14-6-2019 10:21:6] CameraGMSL: Frame: 612 CaptureTimestamp: 2252348693 - ICP DROP in camera 2  
[14-6-2019 10:21:6] CameraGMSL: Frame: 612 CaptureTimestamp: 2252348720 - ICP DROP in camera 3  
I think maybe it get the next image waited so long time.  
How can I solve this problem， avoid the warnings printed?  
Thanks!

> [@FabianWeise](#):
>
> Hi yxiang,
> 
> In our documentation you do find more information on how to proceed if you look for Image Processing-\>Image.
> 
> To answer your problem your calls are not thread safe, so what you can do to “solve this problem” is simply using streamers as here:
> 
> ```auto
> // Thread 1:
> dwImageStreamer_initialize(...);
> while(true)
> {
> // CODE: Get an image to stream
> dwImageStreamer_producerSend(...);
> dwImageStreamer_producerReturn(TIMEOUT);
> }
> dwImageStreamer_release(...);
> // Thread 2:
> // CODE: If the streamer has been initialized on thread 1
> while(true)
> {
> dwImageStreamer_consumerReceive(TIMEOUT);
> // CODE: Use the streamed image
> dwImageStreamer_consumerReturn(...);
> }
> 
> ```
> 
> Besides you do find some samples on how to use our streamers in the DW package as well.
> 
> All clear?
> 
> Best regards,  
> Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 17, 2019, 6:43am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/5 "2019-06-17T06:43:18Z")

</div>

Hi, I tried to use your method but it does not work. I used producer-consumer mode to make thread safe.

```auto
//Thread 1:
while(true)
{
    dwSensorCamera_readFrame();
    dwSensorCamera_getImage(.., DW_CAMERA_OUTPUT_CUDA_RGBA_UINT8, ..);
    dwImage_copyConvert(frames_produced_,...);
}
//Thread 2:
while(true)
{
    dwImage_getCUDA(dwImageCUDA, frames_consumed_);
    //use the image
}

```

As I think call the function dwSensorCamera\_getImage using type DW\_CAMERA\_OUTPUT\_CUDA\_RGBA\_UINT8, we can get image with cuda type, do not need to use dwImageStreamer\_producerSend(cuda\_stream) and dwImageStreamer\_consumerReceive(cuda\_stream) to stream the image to the cuda domain. Is it right?  
Very thanks!

> [@FabianWeise](#):
>
> Hi yxiang,
> 
> In our documentation you do find more information on how to proceed if you look for Image Processing-\>Image.
> 
> To answer your problem your calls are not thread safe, so what you can do to “solve this problem” is simply using streamers as here:
> 
> ```auto
> // Thread 1:
> dwImageStreamer_initialize(...);
> while(true)
> {
> // CODE: Get an image to stream
> dwImageStreamer_producerSend(...);
> dwImageStreamer_producerReturn(TIMEOUT);
> }
> dwImageStreamer_release(...);
> // Thread 2:
> // CODE: If the streamer has been initialized on thread 1
> while(true)
> {
> dwImageStreamer_consumerReceive(TIMEOUT);
> // CODE: Use the streamed image
> dwImageStreamer_consumerReturn(...);
> }
> 
> ```
> 
> Besides you do find some samples on how to use our streamers in the DW package as well.
> 
> All clear?
> 
> Best regards,  
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 17, 2019, 8:07am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/6 "2019-06-17T08:07:33Z")

</div>

Regarding the ICP frame drops, what is the FPS you are recording with and did you correctly calculate the reading and writing speeds of the frames according to the storage you are using?

You can test using a lower FPS to do a first verification and to calculations afterwards too…

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 17, 2019, 8:17am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/7 "2019-06-17T08:17:23Z")

</div>

The camera FPS is 30. Every process on the image cost 100ms, the processing speed is slower than capturing speed.  
I test a small case that, in the Process() function I just sleep 30ms, the speed is faster than capturing speed, there is no warning.

> [@FabianWeise](#):
>
> Regarding the ICP frame drops, what is the FPS you are recording with and did you correctly calculate the reading and writing speeds of the frames according to the storage you are using?
> 
> You can test using a lower FPS to do a first verification and to calculations afterwards too…
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 17, 2019, 8:25am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/8 "2019-06-17T08:25:37Z")

</div>

The frames are coming with 30Hz aka 33ms, so processing an image of 100ms costs will make you drop frames.

Most importantly is the thread getting the images from the camera.

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 17, 2019, 8:39am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/9 "2019-06-17T08:39:59Z")

</div>

So how to avoid the warning?  
And anonther problem, I use single-thread like as above

```auto
while(true)
{
    dwSensorCamera_readFrame(&frame_handle, index, 66000, sensor_);
    dwSensorCamera_getImage(&image_handle, DW_CAMERA_OUTPUT_CUDA_RGBA_UINT8, frame_handle);
    dwImage_getCUDA(&image, image_handle);
    Process(image);//100ms
}

```

I found that the timeout is too long, about 500ms, every time the image I got is not the newest, is later than 500ms. How did it happen, how can I solve this problem?

Thanks!

> [@FabianWeise](#):
>
> The frames are coming with 30Hz aka 33ms, so processing an image of 100ms costs will make you drop frames.
> 
> Most importantly is the thread getting the images from the camera.
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 17, 2019, 9:00am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/10 "2019-06-17T09:00:00Z")

</div>

How exactly are you measuring the timeout and did you use the CameraGMSL sample to verify your findings already?

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 17, 2019, 9:14am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/11 "2019-06-17T09:14:30Z")

</div>

On linux terminal, I print the system timestamp always, and everytime dwSensorCamera\_readFrame() I also get the system timestamp and set the timestamp to the got image and show it on image.  
Make the camera capture the printed timestamp on terminal, so on the image we can see the captured printed timestamp and the timestamp in image.  
Add also when show the image, I can see the timestamp obviously.  
If I just capture the image then show it, do nothing processing, the timeout is much slower.

> [@FabianWeise](#):
>
> How exactly are you measuring the timeout and did you use the CameraGMSL sample to verify your findings already?
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 17, 2019, 10:11am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/12 "2019-06-17T10:11:20Z")

</div>

Hi Fabian,  
I also test the sample sample\_camera\_gmsl, in source code  
CHECK\_DW\_ERROR(dwRenderer\_renderTexture(imageGL-\>tex, imageGL-\>target, m\_renderer));  
usleep(80000);  
I sleep 80ms everytime stream the image to GL domin, the same issues appear.  
The “icp drop…” warning always print, and obviously that the timeout is larger.

> [@FabianWeise](#):
>
> How exactly are you measuring the timeout and did you use the CameraGMSL sample to verify your findings already?
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 17, 2019, 11:16am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/13 "2019-06-17T11:16:01Z")

</div>

Can you perhaps specify more information like what camera model you are using and which exact platform, so I can raise an internal bug for that?

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 17, 2019, 11:24am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/14 "2019-06-17T11:24:54Z")

</div>

Camera type is ar0231, the platform is px2 AutoChauffeur P2379, the SDK version is 5.0.10.3.  
Any solutions for the issues?  
Thanks!

> [@FabianWeise](#):
>
> Can you perhaps specify more information like what camera model you are using and which exact platform, so I can raise an internal bug for that?
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 17, 2019, 12:38pm UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/15 "2019-06-17T12:38:04Z")

</div>

I would please you to strictly follow the use of our image streamer definitions and try again. We have a sample for exactly your purpose which is called `image_streamer_multi`. Make use of `TIMEOUT` as parameter and actually use the streamers as everything else is not thread-safe and needs to be run sequentially instead.

The solution for your problem is actually fetching images more frequently since your are dropping a lot of them out of the IPP pipeline.  
It also makes sense to see 500ms old frames since by FIFO approach they are still in the queue to be fetched next.

So by optimizing your process() method by using more efficient algorithms, you are able to fetch much more frequently which does not let images drop at the end of the queue.

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 18, 2019, 2:26am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/16 "2019-06-18T02:26:28Z")

</div>

Hi Fabian,  
As you said, using the interface dwSensorCamera\_readFrame(), the images are put into buffer, a queue, then dwSensorCamera\_getImage() get image from the queue? Is it right?  
So is there a interface that we can get image in real-time, not the buffer?  
Thanks!

> [@FabianWeise](#):
>
> I would please you to strictly follow the use of our image streamer definitions and try again. We have a sample for exactly your purpose which is called `image_streamer_multi`. Make use of `TIMEOUT` as parameter and actually use the streamers as everything else is not thread-safe and needs to be run sequentially instead.
> 
> The solution for your problem is actually fetching images more frequently since your are dropping a lot of them out of the IPP pipeline.  
> It also makes sense to see 500ms old frames since by FIFO approach they are still in the queue to be fetched next.
> 
> So by optimizing your process() method by using more efficient algorithms, you are able to fetch much more frequently which does not let images drop at the end of the queue.
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 18, 2019, 8:44am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/17 "2019-06-18T08:44:07Z")

</div>

Hi,

Why don’t you use the interface we provide you? I strongly believe you can enhance your Process() to fit all requirements.

The ICP drop come from the IPP Pipeline: If the capture buffer is full, the ICP will drop the next acquired frame. That is, in case you get ICP drops, this means you are not returning images fast enough:  
The camera captures at 33ms and it takes you 100 ms to return images, of course you will fill the buffer completely.

So whatever you read it is from the front of the buffer since it follows FIFO.

For me, it seems you are doing something very inefficient during Process() because you are more than 300% slower than the frequency of the camera. Also from coding principles POV please use more efficient algorithms since this solves your main issues.

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 18, 2019, 9:09am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/18 "2019-06-18T09:09:31Z")

</div>

Hi Fabian,  
I understand all you said. But in fact our program is huge, we do many things in Process() so it costs about 100ms, we can not increase efficiency in Process() at present.

> [@FabianWeise](#):
>
> Hi,
> 
> Why don’t you use the interface we provide you? I strongly believe you can enhance your Process() to fit all requirements.
> 
> The ICP drop come from the IPP Pipeline: If the capture buffer is full, the ICP will drop the next acquired frame. That is, in case you get ICP drops, this means you are not returning images fast enough:  
> The camera captures at 33ms and it takes you 100 ms to return images, of course you will fill the buffer completely.
> 
> So whatever you read it is from the front of the buffer since it follows FIFO.
> 
> For me, it seems you are doing something very inefficient during Process() because you are more than 300% slower than the frequency of the camera. Also from coding principles POV please use more efficient algorithms since this solves your main issues.
> 
> Fabian

---

<div class="post-metadata">

**Author:** ![FabianWeise](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fabianweise/32/14043_2.png) [@FabianWeise](https://forums.developer.nvidia.com/u/FabianWeise)\
**Post date:** [June 18, 2019, 9:20am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/19 "2019-06-18T09:20:59Z")

</div>

Okay, let’s have the 100ms as fix assumption for Process() then. Then what I can think of is either

1. reading from the other side of the buffer - size to be known and always full,
2. draining the buffer so that it compensates t\_process - t\_camera\_frequency or
3. decreasing the buffer size to 1, so it only contains recent images.

I will update you shortly.

Fabian

---

<div class="post-metadata">

**Author:** ![yxiang](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yxiang](https://forums.developer.nvidia.com/u/yxiang)\
**Post date:** [June 18, 2019, 9:31am UTC](https://forums.developer.nvidia.com/t/getcudaimage-error/76218/20 "2019-06-18T09:31:27Z")

</div>

Hi Fabian,  
It is the thing I want to try but have not solved it.  
Waiting for your reply.  
And a small question, is there any interfaces I can using copy dwCameraFrameHandle\_t?  
Very thanks!

> [@FabianWeise](#):
>
> Okay, let’s have the 100ms as fix assumption for Process() then. Then what I can think of is either
> 
> 1. reading from the other side of the buffer - size to be known and always full,
> 2. draining the buffer so that it matched t\_process - t\_camera\_frequency or
> 3. decreasing the buffer size to 1, so it only contains recent images.
> 
> I will update you shortly.
> 
> Fabian

[Next page](https://forums.developer.nvidia.com/t/getcudaimage-error/76218.md?page=2)
