opencv python版 在图片上画矩形
import cv2 import matplotlib.pyplot as plt import numpy im = cv2.imread('image_2.jpg') square = numpy.array([ [(1827, 695), (1827, 1873), (695, 1873), (695, 714)] ]) cv2.fillPoly(im, square, (169,169,169,0.2)) plt.imshow(im) plt.axis('off') plt.show()