使用坐标为

时间:2017-04-12 12:37:38

标签: python matplotlib python-imaging-library

如果您查看MS Paint,当您查看左下角时,您会看到它给出了左上角页面为“ 1 ,1px”的坐标。我不关心像素,但我确实关心 1 。我有以下示例代码:

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

im = np.array(Image.open('image.JPG'), dtype=np.uint8)

# Create figure and axes
fig,ax = plt.subplots(1)

# Display the image
ax.imshow(im)

# Create a Rectangle patch
rect = patches.Rectangle((988,988),988,30,linewidth=1,edgecolor='r',facecolor='none')

# Add the patch to the Axes
ax.add_patch(rect)

plt.show()

但是,我希望绘制的矩形基于Paint提供的cöordinates。如何将其合并到此代码中以便识别它?

0 个答案:

没有答案