This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: How to parse out the R,G, and B channel values from the preprocessed node output tensor?

Part Number: TDA4VM


Dear experts,

I want to perform an affine transformation on the images before feeding them to the model. The affine transformation algorithm is based on the RGB images. I initially tried to convert NV12 or YUYV images to RGB with displaym2m node, but it failed because the driver doesn't seem to support it. Because the preprocessing node can convert the YUV format to RGB format, then the second way to think of is to parse the R,G,B image data from the tensor output by the preprocessing node, how to operate to parse, do you have any suggestions?

Regards,

Xin

  • Hi,

    I believe you are converting YUV to RGB planar format here right? If yes, to parse the RGB output from the tensor obtained from the pre-proc node, you could refer the API writePreProcOutput() in the demo vision_apps/apps/dl_demos/app_tidl/main.c

    This should suffice your usecase.

    Regards,

    Nikhil

  • Hi Nikhil,

    I saved the tensor using the writePreProcOutput() function.Using the yuv viewer, I saw that it was a yuv image with only the y-plane.How do I parse it?

    Regards,

    Xin

  • Hi Xin,

    Are you saving it as .yuv? 

    Could you please confirm if your output file is in the format of .rgb?

    Regards,

    Nikhil

  • Hi Nikhil,

    When I saved the name of the tensor, I changed ".rgb" to ".yuv", but everything else didn't change, but I didn't quite understand the order in which r, g, b are arranged in the tensor, how to parse it? Can you give me an example?

    Regards,

    Xin

  • Hi Nikhil,

    I haven't received your message for a long time. I look forward to your reply.

    How do we convert the processed R, G, B channel data into a tensor?

    Regards,

    Xin

  • Hi Xin,

    Sorry for the delay here.

    You are using tivxImgPreProc node for preprocessing here right?

    Here, the output would be of RGB planar format. So, when you do tivxMapTensorPatch() in the writePreProcOutput(), you would get hold of the starting pointer of the data in the tensor.

    Since it is a planar format, the first plane would be R, second plane would be G and third plane should be B (the other way if the output is BGR)

    This way you could parse each plane.

    Regards,

    Nikhil

  • Hi Nikhil,

    How can the processed R,G, and B data be combined into a tensor? Use the newly generated tensor to pass to the tidl node.

    Regards,

    Xin

  • Hi Xin,

    The preprocessing node taken in the YUV input image and converts it into the RGB planar format output tensor. If you are looking for the node implementation, you could refer to vision_apps/kernels/img_proc/c66/vx_image_preprocessing_target.c, where you could refer the tivxKernelImgPreProcProcess() to see how the conversion happens on the C66 DSP.

    Regards,

    Nikhil