Open
Description
Hello!
I have an issue with OAK-1 running an ImageManip node.
My device: OAK-1, tried with normal and "barebone" (https://store.opencv.ai/collections/usb/products/oak-1)
DepthAi version: 2.11.1.0
OS: Windows 10
Python: 3.9.2
The error I get is the following:
Processing failed, potentially unsupported config
Here is a simple code to reproduce the error
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
xmin = 539
ymin = 258
xmax = xmin+207 # <--- W
ymax = ymin+207 # <--- H
cropxmin_norm = xmin / w_frame
cropymin_norm = ymin / h_frame
cropxmax_norm = xmax / w_frame
cropymax_norm = ymax / h_frame
width = xmax - xmin
height = ymax - ymin
area = width * height
aspect_ratio = width / height
print("W: {} - H: {}".format(width, height))
print("A: {} - AR: {}".format(area, aspect_ratio))
pipeline = dai.Pipeline()
xlinkIn = pipeline.create(dai.node.XLinkIn)
xlinkIn.setMaxDataSize(w_frame*h_frame*3)
xlinkIn.setStreamName("input")
# creating preview out node
rgbOut = pipeline.createXLinkOut()
rgbOut.setStreamName("rgb")
rgbOutRes = pipeline.createXLinkOut()
rgbOutRes.setStreamName("rgb_res")
# create a resize node
resize_manip = pipeline.create(dai.node.ImageManip)
resize_manip.initialConfig.setCropRect(cropxmin_norm, cropymin_norm, cropxmax_norm, cropymax_norm)
resize_manip.initialConfig.setResizeThumbnail(300, 300, 0, 0, 0)
resize_manip.initialConfig.setKeepAspectRatio(False)
# linking
xlinkIn.out.link(resize_manip.inputImage)
xlinkIn.out.link(rgbOut.input)
resize_manip.out.link(rgbOutRes.input)
with dai.Device(pipeline) as device:
info = device.getDeviceInfo()
inputImage = device.getInputQueue("input")
qRgb = device.getOutputQueue(name="rgb", maxSize=8, blocking=True)
qRgb_res = device.getOutputQueue(name="rgb_res", maxSize=8, blocking=True)
img_data = cv2.imread("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)
inRgb = qRgb.get()
if inRgb is not None:
c = inRgb.getCvFrame()
cv2.imshow('RGB', inRgb.getCvFrame())
inRgb_res = qRgb_res.get()
if inRgb_res is not None:
cv2.imshow('RGB_RES', inRgb_res.getCvFrame())
cv2.waitKey(12)
This code simply load the image to the device, the device should perform a crop and a resize with thumbnail.
At the beginning of the code I set the dimension of the rectangle to be cropped
xmin = 539
ymin = 258
xmax = xmin+207 # <--- W
ymax = ymin+207 # <--- H
With that exact (207, 207) value this script gives that error. If I change to, eg, (207, 208) no more error!
Here is the image I'm using to test this:
Metadata
Metadata
Assignees
Labels
No labels