tb_common.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:textboxes 作者: shinjayne 项目源码 文件源码
def draw_rect(I, r, c, thickness=1):
    if abs(sum(r)) < 100: # conditional to prevent min/max error
        cv2.rectangle(I, (int(r[0] * image_size), int(r[1] * image_size)),
                      (int((r[0] + max(r[2], 0)) * image_size), int((r[1] + max(r[3], 0)) * image_size)),
                      c, thickness)

# def draw_ann(I, r, text, color=(255, 0, 255), confidence=-1):
#   draw_rect(I, r, color, 1)
#   cv2.rectangle(I, (int(r[0] * image_size), int(r[1] * image_size - 15)),
#                 (int(r[0] * image_size + 100), int(r[1] * image_size)),
#                 color, -1)

#   text_ = text

#   if confidence >= 0:
#       text_ += ": %0.2f" % confidence

#   cv2.putText(I, text_, (int(r[0] * image_size), int((r[1]) * image_size)),
#               cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号