【发布时间】:2020-08-27 07:07:51
【问题描述】:
我正在尝试进行对象跟踪,并且听说椭圆边界框比通常的矩形框要好。所以我试着做一个。
这是我使用的代码:
cv2.ellipse(frame, [np.int0(location).reshape((-1, 1, 2))], True, (0, 255, 0), 3)
这是该代码的结果
an integer is required (got type tuple)
制作边界框的完整代码
state = siamese_track(state, frame, mask_enable=True, refine_enable=True, device=device)
location = state['ploygon'].flatten()
mask = state['mask'] > state['p'].seg_thr
frame[:, :, 2] = (mask > 0) * 255 + (mask == 0) * frame[:, :, 2]
cv2.ellipse(frame, [np.int0(location).reshape((-1, 1, 2))], True, (0, 255, 0), 3)
如果我使用 cv2.polyline 效果很好,我需要先输入数学公式还是我遗漏了什么?
【问题讨论】:
标签: python opencv bounding-box