【问题标题】:cv2.groupRectangles returning an array with len=1cv2.groupRectangles 返回一个 len=1 的数组
【发布时间】:2017-05-24 03:13:59
【问题描述】:

我正在尝试使用 cv2.groupRectangles 加入神经网络提出的边界框。

问题是,对于以下边界框,它返回 [[4]] 作为连接区域之一。 我希望它输出 4 个值。 x0, y0, x1, y1

>>> import cv2
>>> aa = [[1050, 0, 1260, 144], [1085, 0, 1295, 144], [1015, 23, 1225, 168], [1050, 23, 1260, 168], [280, 782, 490, 960]]
>>> cv2.groupRectangles(aa, 1, 0.7)
(array([[1050,   12, 1260,  156]], dtype=int32), array([[4]], dtype=int32))
>>> 

【问题讨论】:

    标签: python opencv rectangles bounding-box


    【解决方案1】:

    函数 cv2.groupRectangles(rectList,groupThreshold,eps) 需要 3 个参数,我假设您了解这 3 个参数。关注documentation 有助于更好地理解这些参数。

    这样的函数将返回 2 个值:rectList 和 weights。 rectList 表示矩形列表,可用于表示您提供给函数的一组矩形。 在您的情况下,只有一个矩形,这意味着该函数能够生成一个矩形来表示 4 个给定矩形的组。 权重值将与单个矩形表示的矩形数量相关。在您的情况下,只有一个权重,因为该函数只能基于 4 个相邻矩形形成单个矩形。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-11
      • 2022-01-17
      • 2021-12-21
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2019-12-07
      • 1970-01-01
      相关资源
      最近更新 更多