第一步:程序引用包 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()