depthai-python: Processing failed, potentially unsupported config

Hello, can someone please explain me why this script does not work? It gives me

[14442C10D13799CD00] [55.888] [ImageManip(3)] [error] Processing failed, potentially unsupported config

Here is the code

import depthai as dai

pipeline = dai.Pipeline()
pipeline.setOpenVINOVersion(version=dai.OpenVINO.Version.VERSION_2021_3)

cam = pipeline.create(dai.node.ColorCamera)
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
cam.setIspScale(2,3)
cam.setInterleaved(False)
cam.setPreviewSize(1280, 720)    


preview_rotate_manip = pipeline.create(dai.node.ImageManip)
rotation_cfg = dai.RotatedRect()
rotation_cfg.center.x, rotation_cfg.center.y = 0.5, 0.5
rotation_cfg.size.width, rotation_cfg.size.height = 1,1
rotation_cfg.angle = 0
preview_rotate_manip.initialConfig.setCropRotatedRect(rotation_cfg, True)
preview_rotate_manip.setMaxOutputFrameSize(1280*720*3)
cam.preview.link(preview_rotate_manip.inputImage)


preview_zoom_manip = pipeline.create(dai.node.ImageManip)
zoom_cfg = dai.RotatedRect()
zoom_cfg.center.x, rotation_cfg.center.y = 0.5, 0.5
zoom_cfg.size.width, rotation_cfg.size.height = 1,1
preview_zoom_manip.initialConfig.setCropRotatedRect(zoom_cfg, True)
preview_zoom_manip.setMaxOutputFrameSize(1280*720*3)
preview_rotate_manip.out.link(preview_zoom_manip.inputImage)


preview_resize_manip = pipeline.create(dai.node.ImageManip)
preview_resize_manip.initialConfig.setResize(300,300)
preview_resize_manip.initialConfig.setKeepAspectRatio(False)
preview_resize_manip.setMaxOutputFrameSize(1280*720*3)
preview_zoom_manip.out.link(preview_resize_manip.inputImage)


cam_xout = pipeline.create(dai.node.XLinkOut)
cam_xout.setStreamName("RGB")
preview_resize_manip.out.link(cam_xout.input)

with dai.Device(pipeline) as device:
    q_rgb_out = device.getOutputQueue("RGB", maxSize=1, blocking=True)
    while True: 
        in_rgb = q_rgb_out.get()
        cv2.imshow("RGB", in_rgb.getCvFrame())
        cv2.waitKey(5)

I know this is a very weird example, but that would be the base for my application. I’m on

  • Windows 10
  • VSCode
  • Depthai 2.13.1.0
  • Python 3.9.2

Thank you

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

@f-alemauro The reason you received the mentioned error [14442C10D13799CD00] [166.178] [ImageManip(3)] [error] Processing failed, potentially unsupported config is regarding the unsupported config we discuss above. So, a crop and a resizingThumbnail operation are incompatible in the same ImageManip pipeline config. The solution in the mainline version is to do those 2 operations in separated pipelines, something like this:

import cv2
import depthai as dai
import numpy as np


def to_planar(arr: np.ndarray, shape: tuple) -> list:
    return [val for channel in cv2.resize(arr, shape).transpose(2, 0, 1) for y_col in channel for val in y_col]


w_frame = 1280
h_frame = 720
pipeline = dai.Pipeline()


xlinkIn = pipeline.create(dai.node.XLinkIn)
xlinkIn.setMaxDataSize(w_frame*h_frame*3)
xlinkIn.setStreamName("input")

rgbOutRes = pipeline.createXLinkOut()
rgbOutRes.setStreamName("rgb_res")


script = pipeline.create(dai.node.Script)
xlinkIn.out.link(script.inputs['img'])
script.setScript("""
# import time
img = node.io['img'].get()
for w in range (10,500):
    for h in range (10,500):
        node.warn(f"WxH: {w}x{h}")
        cfg = ImageManipConfig()
        cfg.setCropRect(0, 0, w/1280, h/720)
        # cfg.setResizeThumbnail(100, 100, 0, 0, 0)
        # cfg.setKeepAspectRatio(False) #  <- this MUST be false otherwise the sensor crash when using setResizeThumbnail
        node.io['manip_cfg'].send(cfg)
        node.io['manip_img'].send(img)    
        # time.sleep(0.5)
""")

script2 = pipeline.create(dai.node.Script)
script2.setScript("""
# import time                                                         
cfg = ImageManipConfig()
cfg.setResizeThumbnail(100, 100, 0, 0, 0)
cfg.setKeepAspectRatio(False) #  <- this MUST be false otherwise the sensor crash when using setResizeThumbnail
node.io['manip_cfg'].send(cfg)  
# time.sleep(0.5)
""")


# create a resize node
resize_manip = pipeline.create(dai.node.ImageManip)
script.outputs['manip_img'].link(resize_manip.inputImage)
script.outputs['manip_cfg'].link(resize_manip.inputConfig)
# resize_manip.setWaitForConfigInput(True)

# create a resize node
resize_manip2 = pipeline.create(dai.node.ImageManip)
resize_manip.out.link(resize_manip2.inputImage)
script2.outputs['manip_cfg'].link(resize_manip2.inputConfig)
# linking
resize_manip2.out.link(rgbOutRes.input)


with dai.Device(pipeline) as device:
    info = device.getDeviceInfo()
    inputImage = device.getInputQueue("input")
    qRgb_res = device.getOutputQueue(name="rgb_res", maxSize=8, blocking=True)

    img_data = cv2.imread("/home/oana/repos_copy2/github/depthai-python/examples/issues/test_input/img.jpg")

    img = dai.ImgFrame()
    img.setData(to_planar(img_data, (w_frame, h_frame)))
    img.setType(dai.RawImgFrame.Type.BGR888p)
    img.setWidth(w_frame)
    img.setHeight(h_frame)
    inputImage.send(img)
    for w in range(10, 500):
        for h in range(10, 500):
            inRgb_res = qRgb_res.get()
            if inRgb_res is not None:
                cv2.imshow('RGB_RES', inRgb_res.getCvFrame())
            cv2.waitKey(10)

And even with the above script, you will receive soon other errors in the mainline ImageManip version because of the know issues regarding random scaling input/output resolutions. This is one of the many reasons why we are trying to integrate the image_manip_refactor branch into develop/main. I had tried the above script in the image_manip_refactor version and it ends successfully. I kindly recommend you try this experiment there. Sorry for not having a workaround in the mainline version this time. We are concentrating our efforts to integrate the image_manip_refactor branch into develop/main as soon as possible because this version resolves a lot of bugs/restrictions from the mainline version and adds new features, but keep in mind that the image_manip_refactor version rewrites almost 80% of the current version, we cannot integrate the bug fixes and features one by one. If there is anything we can do to unlock your development in the meantime( (until the image_manip_refactor version is integrated), please let us know.

Ok, sorry for this script, I had already forgotten the unsupported config we discuss above… 😄 The script now runs smoothly.

I do think that this discussion is really helpful to everybody using Luxonis device!