annotation.py 文件源码

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

项目:car-detection 作者: mmetcalfe 项目源码 文件源码
def annotate_mouse_callback(event, x, y, flags, annotator):
    winName = annotator.winName

    # If adding a bounding box:
    if annotator.editing:
        # Set top left corner of rectangle:
        if event == cv2.EVENT_LBUTTONDOWN:
            annotator.rect_tl = (x, y)

        # Set bottom right corner of rectangle:
        elif event == cv2.EVENT_RBUTTONDOWN:
            annotator.rect_br = (x, y)

    # If deleting a bounding box:
    elif annotator.deleting:
        if event == cv2.EVENT_LBUTTONDOWN:
            print 'Delete at {}'.format((x, y))
            annotator.delete_rectangles_at_point((x, y))
            annotator.deleting = False

    annotator.update_display()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号