如何将圆改为矩形?import numpy as np im
opencv吧
全部回复
仅看楼主
level 1
如何将圆改为矩形?
import numpy as np
import cv2 as cv
# 鼠标回调函数
def draw_rectangle(event):
if event == cv.EVENT_LBUTTONDBLCLK:
cv.draw_rectangle(img,(212,317),(290,436),(255,0,0),4)
# 创建一个黑色的图像,一个窗口,并绑定到窗口的功能
img = np.zeros((512,512,3), np.uint8)
cv.namedWindow('image')
cv.setMouseCallback('image',draw_rectangle)
while(1):
cv.imshow('image',img)
if cv.waitKey(20) & 0xFF == 27:
break
cv.destroyAllWindows()
2020年05月08日 04点05分 1
1