我有一个下面的python代码可以检测框架中的人。一旦检测到,它将得到人person_box
的边界框。从person_box
中可以得到边界框的startX,startY
和width height
。但是在下面的代码中,在for循环中,我得到的错误为numpy.int32 object is not iterable
person_box = person_detections[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,width,height) in person_box:
person_box = np.array([startX,startX + width,startY + height])
输出
[159 156 451 431]
由于我对numpy数组经验不足,所以我不太了解该错误。请帮忙。谢谢。