How can I display an Nvidia vpi Image in GPU memory?
I’m doing some operations in nvidia vpi image. Then for display I need to download it back to cpu memory.
Is there a way I can display it in vpi Image format itself without bringing it back to cpu?
Here’s my sample code
import numpy as np
from PIL import Image
import cv2
import vpi
# Load input into a vpi.Image
input = vpi.asimage(np.asarray(Image.open('test.png')))
# Using the chosen backend,
with vpi.Backend.CUDA:
# First convert input to NV12_ER.
# We're overriding the default backend with CUDA.
temp = input.convert(vpi.Format.NV12_ER, backend=vpi.Backend.CUDA)
# Rescale the image using the chosen backend
temp = temp.rescale((input.width//2, input.height//3))
# Convert result back to input's format
output = temp.convert(input.format, backend=vpi.Backend.CUDA)
# Display image
cv2.imshow("output", output.cpu())
cv2.waitKey(0)