#coding=utf-8
import cv2
import numpy as np
# 全局变量
drawing = False # 是否开始绘制
mode = 'none' # 当前绘制模式
start_x, start_y = -1, -1 # 绘制起点坐标
# 鼠标回调函数
def draw_shape(event, x, y, flags, param):
global drawing, start_x, start_y, mode
if (event & cv2.EVENT_LBUTTONDOWN == cv2.EVENT_LBUTTONDOWN):
drawing = True
start_x, start_y = x, y
elif (event & cv2.EVENT_LBUTTONUP &#