【发布时间】:2020-03-08 04:50:01
【问题描述】:
我有一个下面的 python 代码来检测框架中的人。一旦检测到,它就会得到人的边界框person_box。从person_box我可以得到边界框的startX, startY和width height。但在下面的代码中,在 for 循环中,我收到错误为 numpy.int32 object is not iterable
person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
person_box = person_box.astype(int)
print(person_box)
(startX, startY, endX, endY) = person_box.astype("int")
width = endX - startX
height = endY - startY
for (startX, startY, width, height) in person_box:
person_box = np.array([startX, startY, startX + width, startY + height])
输出
[159 156 451 431]
我无法理解这个错误,因为我对 numpy 数组没有太多经验。请帮忙。谢谢。
【问题讨论】:
-
显示回溯
标签: python numpy-ndarray