python中利用matplotlib.patches在一个坐标轴上添加画的图形

第一步:程序引用包
import  cv2
import selectivesearch
import matplotlib.pyplot as  plt
import matplotlib.patches as  mpatches

for reg in regions:
    x, y, w, h = reg['rect']
    rect = mpatches.Rectangle(
        (x, y), w, h, fill=False, edgecolor='red', linewidth=1)
    ax.add_patch(rect)
plt.show()

猜你喜欢

转载自blog.csdn.net/qq_25964837/article/details/79134418