如何将列表转换为cv :: UMat?

时间:2019-05-27 13:13:58

标签: python-3.x opencv

我有列表,该列表来自dlib检测器:

dets = detector(frame, 0)
dets = [list(rect_to_bb(dets[0]))]
print(dets)
[[277, 294, 150, 149]]

如何将此列表转换为Umat?

faces = cascade.detectMultiScale(gray, 1.3, 5)
print(faces)
[[259 264 182 182]]

例外,当我使用列表

    _, landmarks = facemark.fit(gray, dets)
TypeError: Expected cv::UMat for argument 'faces'

1 个答案:

答案 0 :(得分:1)

dets = cv2.UMat(np.array(dets, dtype=np.uint8))

看看link