def draw_roi(x1, y1, x2, y2, **draw_params):
codes = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY]
ax = plt.gca()
# Form a path
verts = [(x1, y1),
(x1, y2),
(x2, y2),
(x2, y1),
(0, 0)]
path = Path(verts, codes)
# Draw the BG region on the image
patch = patches.PathPatch(path, **draw_params)
ax.add_patch(patch)
评论列表
文章目录