interaction_updated_global.py 文件源码

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

项目:Interactive-object-tracking 作者: abhishekarya286 项目源码 文件源码
def click_and_crop(event, x, y, flags, param):

    # grab references to the global variables
    global refPt, cropping

    # if the left mouse button was clicked, record the starting
    # (x, y) coordinates and indicate that cropping is being
    # performed
    if event == cv2.EVENT_LBUTTONDOWN:
        refPt = [(x, y)]
        cropping = True

    # check to see if the left mouse button was released
    elif event == cv2.EVENT_LBUTTONUP:
        # record the ending (x, y) coordinates and indicate that
        # the cropping operation is finished
        refPt.append((x, y))
        cropping = False

        # draw a rectangle around the region of interest
        cv2.rectangle(img_copy, refPt[0], refPt[1], (0, 255, 0), 2)
        cv2.imshow("image", img_copy)
        cv2.waitKey(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号