• DepthAI
  • img_input = img_input.transpose(2, 0, 1)

Hi @erik,

when prepare the input image, I need to transpose HWC to CHW for a custom NN model.

I realize that there is dai.node.ImageManip can do all kind of image preprocessing (resize, crop, rotate, etc.) But did not find the transpose function.

Question: is there a transpose function in the pipeline I can use/config? or I need to program it myself? how? is there a reference example? Please advise. Thanks a lot for your help.

  • erik replied to this.

    Hi ynjiun !
    2 options:

    1. Use ColorCamera's camRgb.setInterleaved(False). Interleaved == HWC, Planar == CHW.
    2. Use ImageManip's config manip.initialConfig.setFrameType(dai.RawImgFrame.Type.RGB888p). p at the end indicates planar, i would be interleaved:
      RGB888p,        // Planar 8 bit RGB data
              BGR888p,        // Planar 8 bit BGR data
              RGB888i,        // Interleaved 8 bit RGB data
              BGR888i,        // Interleaved 8 bit BGR data
      Thanks, Erik