def plot_over_img(self, img, x, y, x_pr, y_pr, bb_gt):
"""Plot the landmarks over the image with the bbox."""
plt.close("all")
fig = plt.figure(frameon=False) # , figsize=(15, 10.8), dpi=200
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
ax.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB), aspect="auto")
ax.scatter(x, y, s=10, color='r')
ax.scatter(x_pr, y_pr, s=10, color='g')
rect = 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(rect)
fig.add_axes(ax)
return fig
评论列表
文章目录