Receiving single channel data when using vpi.F32 format in a vpi pipeline


I am using the following code to perform distortion correction on input RGB8 image (width:1280, height:720)

param_videoOutput = []
param_videoOutput.append("--width=" + str(1280))
param_videoOutput.append(f"--height=" + str(720))

input = videoSource('file:///home/front_video.mp4')
output = videoOutput('display://0', argv=param_videoOutput)

while True:
    image = input.Capture(format='rgb8')
    if image is None:
    with vpi.Backend.CUDA:
        distortion_corrected_front = vpi.asimage(image)\
                                        .remap(warpmap_distortion_correction, interp=vpi.Interp.NEAREST)\
        distortion_corrected_cpu = distortion_corrected_front.cpu()

This code prints (720, 1280) as opposed to (720,1280,3). When I copy the vpi image into a numpy array, the shape of the numpy array is (720, 1280) as opposed to (720, 1280, 3). When I change the vpi pipeline to .convert(vpi.Format.RGB8) instead in the end, I get a numpy array with shape (720, 1280, 3). How can I get a F32 format vpi image that has 3 channels? The reason I want to use F32 format is to pass the image to a numba cuda kernel.

Kindly advice.



VPI image only supports single channel floating type:

If you want 3-channel F32 data, please use the VPI array:


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.