face3d
face3d copied to clipboard
How to prepare examples/Data/example1.mat file?
I have not found any codes to generate your test .mat file: examples/Data/example1.mat
When I get the BFM data as the README instructed, how can I prepare these mat files into example1.mat, i.e., vertices and triangles?
I tried directly using the tri and shapePC in 01_MorphableModel.mat, and use the w_exp in Model_Expression.mat to compute the vertex as vertices and triangles, but the PNCC result is strange ...
Hope anyone can provide instructions, thanks
same problem here!
I had the same issue, but I thought that I can just create the vertices, triangles, and colors from the images directly instead of creating a .mat file. So after some search, I found this github project. I used the code in this file and you will have to import this file and this one too, and you will finally get the requirements in the variables: "colors", "image_vertices" and "bfm.triangles". Hope this helps, and good luck!
@Emadeldeen-24 Thank you very much! I'll have a try~~
you are welcome! I created this gist to make easier for anyone to use.
def generate_colors(self, tex_para): colors = self.model['texMU'] + self.model['texPC']@(tex_para) colors = np.reshape(colors, [3, len(colors) // 3], 'F').T / 255. return colors
In above code I'm getting syntax error with @(tex_para). Does anyone explain what does that line do?
@Emadeldeen-24 I get the segmentation fault when I use the file you provided. why?
In the line of the code
model['tri'] = model['tri'].T.copy(order='C').astype(np.int32) - 1
gdb debug
Thread 1 "python" received signal SIGSEGV, Segmentation fault. 0x00007ffff7de375c in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7fffdc761aa0, version=0x18, sym=0x7fffdc51f500, reloc=0x7fffdc51ffe0, map=0x555556960af0) at ../sysdeps/x86_64/dl-machine.h:303 303 ../sysdeps/x86_64/dl-machine.h: No such file or directory.
@Emadeldeen-24 I get the segmentation fault when I use the file you provided. why? In the line of the code
model['tri'] = model['tri'].T.copy(order='C').astype(np.int32) - 1gdb debug
Thread 1 "python" received signal SIGSEGV, Segmentation fault. 0x00007ffff7de375c in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7fffdc761aa0, version=0x18, sym=0x7fffdc51f500, reloc=0x7fffdc51ffe0, map=0x555556960af0) at ../sysdeps/x86_64/dl-machine.h:303 303 ../sysdeps/x86_64/dl-machine.h: No such file or directory.
can't see that in my code
not sure actually, but thou can try using scipy. https://docs.scipy.org/doc/scipy/reference/tutorial/io.html
Hi, thank you for your contribute. I have found that, in your codes, triangles = bfm.triangles and triangles will never get changed. What if I want to get the 3D model of a 2D image. I found that with your code, we can have the face expression and position changed, but the face didn't match the input face. Do you have any advices?
What exactly is the difference between triangles and full_triangles in example1.mat? @Emadeldeen-24 your code produces triangles, but how do I get the full_triangles that I need in 7_generate_uv_map.py?
What exactly is the difference between triangles and full_triangles in example1.mat? @Emadeldeen-24 your code produces triangles, but how do I get the full_triangles that I need in 7_generate_uv_map.py?
I found no difference..... By the way, does anybody know how to make the eyes closed?
Hi! I was trying to run 7_generate_uv_map.py on a sample image instead of example1.mat, by using the technique given by @Emadeldeen-24. The results are being produced, but the scale of the reconstructed image is not correct.
Original image:

files produced on running 7_generate_uv_map.py:
- image.jpg

the texture map and uv_position_map seem fine though. What am I doing wrong?
@Emadeldeen-24 I get the segmentation fault when I use the file you provided. why? In the line of the code
model['tri'] = model['tri'].T.copy(order='C').astype(np.int32) - 1gdb debugThread 1 "python" received signal SIGSEGV, Segmentation fault. 0x00007ffff7de375c in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7fffdc761aa0, version=0x18, sym=0x7fffdc51f500, reloc=0x7fffdc51ffe0, map=0x555556960af0) at ../sysdeps/x86_64/dl-machine.h:303 303 ../sysdeps/x86_64/dl-machine.h: No such file or directory.
can't see that in my code
can you share your model BFM.mat. I got error when I load this model. I'll be so appreciated if you can send me a email at [email protected] thankyou
you are welcome! I created this gist to make easier for anyone to use.
HI,did you delete this [gist], I cannot find any info .
you are welcome! I created this gist to make easier for anyone to use.
HI,did you delete this [gist], I cannot find any info .
I updated the link for you
you are welcome! I created this gist to make easier for anyone to use.
I was trying out your gist and there seems to be an Attribute Error, could you help iron this out ?
x = mesh_numpy.transform.from_image(landmarks, h, w)
AttributeError: module 'face3d.mesh_numpy.transform' has no attribute 'from_image'
@cheapskatecoder you can check this https://github.com/Shade5/FaceFitting I guess, "from_image" is this https://github.com/Shade5/FaceFitting/blob/master/mesh/transform.py
you are welcome! I created this gist to make easier for anyone to use.
HI,did you delete this [gist], I cannot find any info .
I updated the link for you
@emadeldeen24 The images generated by using example1.mat and by using your gist are very different for the IBUG image provided in the code.

@emadeldeen24
I get the .obj from https://github.com/cleardusk/3DDFA_V2
and how can I get the .mat as you by the .obj from https://github.com/cleardusk/3DDFA_V2.
I want to transfer the .obj to img like this.

@emadeldeen24 I get the .obj from https://github.com/cleardusk/3DDFA_V2 and how can I get the .mat as you by the .obj from https://github.com/cleardusk/3DDFA_V2. I want to transfer the .obj to img like this.
hallo did you solve this problem? Because i also want to get a 2d image from .obj
不客气!我创建了这个要点,使任何人都更容易使用。
我正在尝试您的要点,似乎存在属性错误,您能帮助解决这个问题吗?
x = mesh_numpy.transform.from_image(landmarks, h, w) AttributeError: module 'face3d.mesh_numpy.transform' has no attribute 'from_image'
@cheapskatecoder Hello, I also encountered the same problem, did you solve it? I would be very grateful if I could get your help