INNER CODE UNIT · Python
read_pts
patrikhuber/eos · python/demo.py:35
def read_pts(filename):
"""A helper function to read the 68 ibug landmarks from a .pts file."""
lines = open(filename).read().splitlines()
lines = lines[3:71]
landmarks = []
ibug_index = 1 # count from 1 to 68 for all ibug landmarks
for l in lines:
coords = l.split()
landmarks.append(eos.core.Landmark(str(ibug_index), [float(coords[0]), float(coords[1])]))
ibug_index = ibug_index + 1
return landmarks
if __name__ == "__main__":
main()