画直线
x1 = [200, 500]
y1 = [300, 100]
plt.figure()
plt.subplot(121),plt.imshow(roi1)
plt.plot(x1, y1, color="dodgerblue", linewidth=3)
plt.plot(x2, y2, color="orange", linewidth=3)
plt.plot(x3, y3, color="red", linewidth=3)
画矩形框
rect = patches.Rectangle((450, 770), 150, 150, linewidth=3, edgecolor='r', facecolor='none')
plt.gca().add_patch(rect)
Reference
- https://www.geeksforgeeks.org/plot-a-point-or-a-line-on-an-image-with-matplotlib/
- https://stackoverflow.com/questions/37435369/matplotlib-how-to-draw-a-rectangle-on-image