def debug_plot_over_img(self, img, x, y, bb_d, bb_gt):
"""Plot the landmarks over the image with the bbox."""
plt.close("all")
fig = plt.figure() # , figsize=(15, 10.8), dpi=200
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
ax.imshow(img, aspect="auto", cmap='Greys_r')
ax.scatter(x, y, s=10, color='r')
rect1 = patches.Rectangle(
(bb_d[0], bb_d[1]), bb_d[2]-bb_d[0], bb_d[3]-bb_d[1],
linewidth=1, edgecolor='r', facecolor='none')
ax.add_patch(rect1)
rect2 = patches.Rectangle(
(bb_gt[0], bb_gt[1]), bb_gt[2]-bb_gt[0], bb_gt[3]-bb_gt[1],
linewidth=1, edgecolor='b', facecolor='none')
ax.add_patch(rect2)
fig.add_axes(ax)
return fig
评论列表
文章目录