import numpy as np
from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
img_path1 = 'E:/LG/datasets/aflw/data/flickr/2/image51134.jpg'
img_path2 = 'E:/LG/datasets/aflw/data/flickr/0/image04500.jpg'
image1 = Image.open(img_path1).convert('RGB')
draw = ImageDraw.Draw(image1)
#关键点的坐标
a_data = [[1202., 611.],
[1268., 587.],
[1346., 611.],
[1454., 599.],
[1532., 569.],
[1604., 581.],
[1250., 677.],
[1298., 665.],
[1340., 671.],
[1472., 659.],
[1520., 647.],
[1568., 653.],
[1346., 803.],
[1412., 791.],
[1496., 791.],
[1328., 893.],
[1430., 905.],
[1532., 869.],
[1448., 1060.]]
print(a_data)
for i in range(len(a_data)):
draw.ellipse((a_data[i][0], a_data[i][1], a_data[i][0] + 10, a_data[i][1] + 10), 'red', 'skyblue')
image1.show()
结果
参考资料
https://blog.csdn.net/guduruyu/article/details/71213717