yfeng95 / face3d

Python tools for 3D face: 3DMM, Mesh processing(transform, camera, light, render), 3D face representations.
2.63k stars 609 forks source link

KeyError: 'vertices' #27

Open sunkyya opened 5 years ago

sunkyya commented 5 years ago

$ python ./4_light.py Traceback (most recent call last): File "./4_light.py", line 24, in vertices = C['vertices'] KeyError: 'vertices'

I used another repositry '3DMM'(https://github.com/waps101/3DMM_edges) to generate a .mat file,but when i loaded it by face3d, the error appeared,what shoud i do?

gsssrao commented 5 years ago

It is just as the error says, your mat object i.e C doesn't have any key called 'vertices'. For instance the default example1.mat has several keys by the names of vertices, colors, full_triangles, triangles. vertices for instance is an array of shape (53215, 3).

You just need to change your mat file to the required format. You can use something like Matlab, Octave or python (with scipy module) to do that.