Hi, I’m trying to make use of the videoSource component available at the dev branch of jetson-utils, but I can’t find a way to convert its result (cudaImage) to a numpy array … I’m able to inspect this cudaImage properties (width, height, channels, ptr, format, mapped) and it appears to be a valid frame and everything, but apparently I can’t feed it to cudaToNumpy() because its not mapped (it says mapped=false) … while other examples I’ve checked are able to convert cudaImages to numpy successfully. The only difference that I found is that the cudaImages that were converted succesfully have the mapped flag in true (as they were created for example via cudaAllocMapped.
Is there a way to turn an unmapped cudaImage to a mapped one so that I can then convert it to numpy? Would that be the way to go?
Here’s an example:
>>> cudaImage_mapped = jetson.utils.cudaAllocMapped(width=1280, height=960, format='rgb32f') >>> str(cudaImage_mapped) '<cudaImage object>\n -- ptr: 0x101370000\n -- size: 14745600\n -- width: 1280\n -- height: 960\n -- channels: 3\n -- format: rgb32f\n -- mapped: true\n -- freeOnDelete: true\n' >>> numpy_mapped = jetson.utils.cudaToNumpy(cudaImage_mapped) >>> cudaImage_not_mapped = vs.Capture() # vs is a jetson.utils.videoSource instance >>> str(cudaImage_not_mapped) '<cudaImage object>\n -- ptr: 0xf00db0000\n -- size: 3686400\n -- width: 1280\n -- height: 960\n -- channels: 3\n -- format: rgb8\n -- mapped: false\n -- freeOnDelete: false\n' >>> numpy_not_mapped = jetson.utils.cudaToNumpy(cudaImage_not_mapped) Traceback (most recent call last): File "<stdin>", line 1, in <module> Exception: jetson.utils -- cudaToNumpy() needs to use CUDA mapped memory as input (allocate with mapped=1)