from PIL import Image
from pylab import *
file=open('C:/Users/root/Desktop/1.txt')
im=array(Image.open('C:/Users/root/Desktop/1.png'))
imshow(im)
sourceInLine=file.readlines()
pointsposi=[]
for line in sourceInLine:
temp1=line.strip('\n')
temp2=temp1.split( )
pointsposi.append(temp2)
#每行都是横坐标,纵坐标
for i in range(0,len(pointsposi)):
x=float(pointsposi[i][0])
y=float(pointsposi[i][1])
plot(x, y, 'r.')
axis('off')
show()
【备忘】python从txt中读取横纵坐标并把点标在图片上
最新推荐文章于 2023-02-11 12:54:29 发布