Trying to visualise the image from the NvMediaImageGetBits buffer

**Hardware Platform: DRIVE AGX Xavier™ Developer Kit
**Software Version: DRIVE Software 10
**Host Machine Version: native Ubuntu 18.04
**SDK Manager Version:1.1.0.6343

Hi, We are trying to visualise the image frame in this buffer pBuff

NvMediaImageGetBits(imagePtr, nullptr, (void **)pBuff, pBuffPitches);

But we are unsure of the image format, encoding, but we can have the bytes just that could not see the frames as some human readable image format.

I am available to provide more info needed,

Looking forward.
Balaji

Hi @bkumar1,

Please refer to CUtils::ConvertRawToRgba() defined in ~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/samples/nvmedia/nvsipl/test/camera/CUtils.cpp and nvmedia/nvsipl/test/camera/CComposite.cpp which calls the function on your host system.

Moreover, below are some related documentation:

https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/NvMedia/nvmedia_concept_surface.html
https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/DRIVE_OS_Linux_SDK_Development_Guide/baggage/group__image__get__put__bits.html

1 Like

Thank you @VickNV.

I have the RGBA and tried streaming it to another computer using socket but how do I visualise it in the other end?! In some format that my code can convert into some .jpeg or .png ?!

What do you mean visualising on another computer? Is it Xavier? If yes, you can refer to some samples using NvMediaIDP APIs.

@VickNV No outside of the Xavier. We are sending those RGBA frames through ethernet (Socket communication). Just need to visualise those frame data as images for which we need to understand how we are sending - in which format.

So your question is how to convert into .jpeg or .png, how to send, or how to visualise in the other end?

For JPEG encode, there is a sample (~/home/vyu/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/samples/nvmedia/img_jpgenc/image_jpegenc.c).

For the other two questions, are they nvidia-specific questions? Or just for ubuntu?

@VickNV
preface:

  1. We can send it to other PC - Receiver PC (ubuntu non-xavier ordinary workstation through ethernet)
  2. From what we saw in its attributes: its surf type is YUV, subplanar: 420, component order is YUV, file ext is .YUV

the question is :

How to visualise it in the receiver PC ?

Could you refer to the sample (https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/NvMedia/nvmedia_nvmipp_file.html#) to understand which yuv format files you send to the other PC? Then you can see if any viewer is applicable to the yuv format.

@VickNV - I tried the jpeg encoder for our YUV file but it throws an error as:

nvmedia: ERROR: readYUVFile failed

May I know the error message is from which API? Thanks!

It looks your are trying nvmimg_jpgenc application. Any other error messages prior to “nvmedia: ERROR: readYUVFile failed”? Could you figure out the error is due to which API call in ReadImage() or ReadImageNew() (defined in ~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/samples/nvmedia/utils/surf_utils.c)?