I am currently using
Capture method to read frames from an mp4 file, perform some operations on those frames using
Numba Cuda, and ultimately pass those frames to
Render method to display the output video.
However, I am unable to pass data in the formats of
GPUArray formats to the
Render method of
Render method is expecting data in the format
cudaImage. How do I convert the the aforementioned data formats to
cudaImage format for compatibility with
Render method of
I believe they all have the cuda_array_interface property. But I am trying to figure out a way to use it for interoperability between libraries.
Hi @surajgampa95, cudaImage also implements
__cuda_array_interface__ so you can pass cudaImage’s to those libraries like shown here:
However I believe you are correct that the reverse direction isn’t explicitly implemented - I will add this to my todo list to investigate. Could you use a cudaImage as the output of PyCUDA/Numba/ect, so that those results are already stored in the cudaImage?
@surajgampa95 there is now an example of mapping externally-allocated GPU memory into a cudaImage (without memory copies) here:
There was also documentation added on the support for
__cuda_array_interface__ in cudaImage here: https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-image.md#cuda-array-interface
Hi @dusty_nv, thank you for the response. However, I have tried the following code -
frame_left = __cap_front_stream__.Capture(format='rgb8')
if frame_left is None:
distortion_corrected_left = vpi.asimage(frame_left)\
with distortion_corrected_left.rlock_cuda() as cudaBuffer:
device_pointer = cudaBuffer.__cuda_array_interface__['data']
distortion_corrected_left_cudaImg = cudaImage(ptr = device_pointer, width=1280, height=720, format='rgb8')
if not __cap_front_stream__.IsStreaming() or not __output_stream__.IsStreaming():
except Exception as exception:
And the error I get is -
'ptr' is an invalid keyword argument for this function
Do I need to update my jetson_utils library to your latest commit? Because I am of the assumption that you just added an example to your latest commit. Let me know otherwise.
Yes, do a
git pull --recurse-submodules from your jetson-inference directory and rebuild/reinstall:
git pull --recurse-submodules
sudo make install
Let me know if that works for you.
@dusty_nv thank you for the reply. It works now.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.