欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python matplotlib

程序员文章站 2022-03-09 19:47:26
...

1. 读入图像并画矩形

import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image

img = Image.open(img_path).convert("RGB")
plt.imshow(dataset[0][0])

currentAxis=plt.gca()
# (x, y), width, height
rect=patches.Rectangle((20, 60),50, 50,linewidth=1,edgecolor='r',facecolor='none')
currentAxis.add_patch(rect)

plt.show()

python matplotlib