Code Monkey home page Code Monkey logo

face3d's Introduction

face3d: Python tools for processing 3D face

Introduction

This project implements some basic functions related to 3D faces.

You can use this to process mesh data, generate 3D faces from morphable model, reconstruct 3D face with a single image and key points as inputs, render faces with difference lightings(for more, please see examples).

In the beginning, I wrote this project for learning 3D face reconstruction and for personal research use, so all the codes are written in python(numpy). However, some functions(eg. rasterization) can not use vectorization to optimize, writing them in python is too slow to use, then I choose to write these core parts in c++(without any other big libraries, such as opencv, eigen) and compile them with Cython for python use. So the final version is very lightweight and fast.

In addition, the numpy version is also retained, considering that beginners can focus on algorithms themselves in python and researches can modify and verify their ideas quickly. I also try my best to add references/formulas in each function, so that you can learn basic knowledge and understand the codes.

For more information and researches related to 3D faces, please see 3D face papers.

Enjoy it ^_^

Structure

# Since triangle mesh is the most popular representation of 3D face, 
# the main part is mesh processing.
mesh/             # written in python and c++
|  cython/               # c++ files, use cython to compile 
|  io.py                 # read & write obj
|  vis.py                # plot mesh
|  transform.py          # transform mesh & estimate matrix
|  light.py              # add light & estimate light(to do)
|  render.py             # obj to image using rasterization render

mesh_numpy/      # the same with mesh/, with each part written in numpy
                 # slow but easy to learn and modify

# 3DMM is one of the most popular methods to generate & reconstruct 3D face.
morphable_model/
|  morphable_model.py    # morphable model class: generate & fit
|  fit.py                # estimate shape&expression parameters. 3dmm fitting.
|  load.py               # load 3dmm data

Examples:

cd ./examples

  • 3dmm. python 2_3dmm.py

    left: random example generated by 3dmm

    right: fitting face with 3dmm using 68 key points

  • transform. python 3_transform.py
    left:

    fix camera position & use orthographic projection. (often used in reconstruction)

    then transform face object: scale, change pitch angle, change yaw angle, change roll angle

    right:

    fix obj position & use perspective projection(fovy=30). (simulating real views)

    then move camera position and rotate camera: from far to near, down & up, left & right, rotate camera

  • light. python 4_light.py

    single point light: from left to right, from up to down, from near to far

  • image map python 6_image_map.py

    render different attributes in image pixels.

    : depth, pncc, uv coordinates

  • uv map python 7_uv_map.py

    render different attributes in uv coordinates.

    : colors(texture map), position(2d facial image & corresponding position map)

Getting Started

Prerequisite

  • Python 2 or Python 3

  • Python packages:

    • numpy
    • skimage (for reading&writing image)
    • scipy (for loading mat)
    • matplotlib (for show)
    • Cython (for compiling c++ file)

Usage

  1. Clone the repository

    git clone https://github.com/YadiraF/face3d
    cd face3d
  2. Compile c++ files to .so for python use (ignore if you use numpy version)

    cd face3d/mesh/cython
    python setup.py build_ext -i 
  3. Prepare BFM Data (ignore if you don't use 3dmm)

    see Data/BFM/readme.md

  4. Run examples

    (examples use cython version, you can change mesh into mesh_numpy to use numpy version)

    cd examples
    python 1_pipeline.py 

    For beginners who want to continue researches on 3D faces, I strongly recommend you first run examples according to the order, then view the codes in mesh_numpy and read the comments written in the beginning in each file. Hope this helps!

    Moreover, I am new in computer graphics, so it would be great appreciated if you could point out some of my wrong expressions. Thanks!

Changelog

  • 2018/10/08 change structure. add comments. add introduction. add paper collections.
  • 2018/07/15 first release

face3d's People

Contributors

yfeng95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face3d's Issues

3DDFA and HPEN links are not working

The weblinks provided for 3DDFA and HPEN are not opening. Is there any other sources from which we can find the corresponding matlab files for running the examples?

Thanks.

Where the BFM.mat in the generate_posmap_300WLP.py

Hello, My bro,
I really appreciate your work in this field. I'm trying to use the code of generate_posmap_300WLP.py to produce some UV posmap. I could not find the BFM.mat , i think the the BFM.mat is the 01_MorphableModel.mat . but the there are some errrs is "model = C['model'] KeyError:'model'". So I want to ask you if the BFM.mat is the 01_MorphableModel.mat

BFM data

Hello, Face Profiling and 3DDFA's matlab code download page cannot be opened when preparing BFM data.

Generate images with lighting variations from original image?

From a face image, how can I use this repo to render more images with different lighting? I mean I read the tutorial but all I can do is turn the image into a 3d model with no background, I don't know how to generate the 3d model to images with the same original background but with lighting variations.

import mesh_core_cython error

Hi,
I meet an error like this:
from .cython import mesh_core_cython
ImportError: cannot import name 'mesh_core_cython'

how can I solve it?Thanks

no pncc_code.mat

hello, bro:
Project is interesting! But when I followed Data/BFM/readme.md step by step in Matlab,there was an error :
Error in generate (line 100)
copyfile('3ddfa/pncc_code.mat', 'Out/pncc_code.mat')

But, Out/BFM.mat, Out/BFM_info.mat, Out/BFM_UV.mat, Out/pncc_code.mat were generated. Is that ok to go on?

error in compiling with Cython

I encountered the error related to the line349 in mesh_core.cpp

mesh_core.cpp:349:31: error: no matching function for call to 'std::basic_ofstream<char>::basic_ofstream(std::string&)'

After I changed the line to:

ofstream obj_file(filename.c_str());

The problem can be solved.

Issue about ValueError: Images of type float must be between -1 and 1

I downloaded 300W-3D dataset which contains .jpg and corresponding .mat files. When I launch script in 8_generate_posmap_300WLP.py on this dataset, on some items I get following error (on the line of saving an image, representing uv position map):
ValueError: Images of type float must be between -1 and 1

Why does it happen? I also tried to make values of such failing image by rerranging its values. It helps to save but saved uv position map image does not seem like uv position map: it's mostly black.

How to fix it?

bad_ind problem

line at 67 in generate.m:
bad_ind = [10032, 10155, 10280];
and line at 89:
tm_inner = tm_inner(:, setdiff(all_ind, bad_ind));
which all_ind is:
1matlabarray([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107]])`
so, the setdiff not work here.
my Model_tri_mouth.mat file is 681kb.
Does anyone has got this problem?

plot_mesh is rather slow

Thanks for your sharing your code!
The mesh render of mpl_toolkits.mplot3d seems rather slow?
The render result of Data/example1.mat by this line mesh.vis.plot_mesh(camera_vertices, triangles) is

Is there any solutions to real-time render 3D face mesh like Matlab?

linux cython compile error

I get this message when I run python setup.py build_ext -i, can someone help me out? I can't seem to find a fix for this.

running build_ext
skipping 'mesh_core_cython.cpp' Cython extension (up-to-date)
building 'mesh_core_cython' extension
gcc -pthread -B /home/tychokoster/anaconda3/envs/3dmm_cnn/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include -I/home/tychokoster/anaconda3/envs/3dmm_cnn/include/python2.7 -c mesh_core_cython.cpp -o build/temp.linux-x86_64-2.7/mesh_core_cython.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
from /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from mesh_core_cython.cpp:607:
/home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
gcc -pthread -B /home/tychokoster/anaconda3/envs/3dmm_cnn/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include -I/home/tychokoster/anaconda3/envs/3dmm_cnn/include/python2.7 -c mesh_core.cpp -o build/temp.linux-x86_64-2.7/mesh_core.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
mesh_core.cpp: In function ‘void _write_obj_with_colors_texture(std::string, std::string, float*, int*, float*, float*, int, int, int)’:
mesh_core.cpp:349:31: error: no matching function for call to ‘std::basic_ofstream::basic_ofstream(std::string&)’
ofstream obj_file(filename);
^
mesh_core.cpp:349:31: note: candidates are:
In file included from mesh_core.h:9:0,
from mesh_core.cpp:11:
/usr/include/c++/4.9/fstream:643:7: note: std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode]
basic_ofstream(const char* __s,
^
/usr/include/c++/4.9/fstream:643:7: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string}’ to ‘const char*’
/usr/include/c++/4.9/fstream:628:7: note: std::basic_ofstream<_CharT, _Traits>::basic_ofstream() [with _CharT = char; _Traits = std::char_traits]
basic_ofstream(): __ostream_type(), _M_filebuf()
^
/usr/include/c++/4.9/fstream:628:7: note: candidate expects 0 arguments, 1 provided
/usr/include/c++/4.9/fstream:602:11: note: std::basic_ofstream::basic_ofstream(const std::basic_ofstream&)
class basic_ofstream : public basic_ostream<_CharT,_Traits>
^
/usr/include/c++/4.9/fstream:602:11: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string}’ to ‘const std::basic_ofstream&’
error: command 'gcc' failed with exit status 1

What is the 29 dims expression parameters?

According to the paper 3DFFA, the expression parameters comes from FaceWarehouse. But in the FaceWarehouse paper, there are 46 dims expression parameters. I can't find the detail information about the 29 dims expression parameters. So What's the meaning of the every expression parameter? Thanks very much.

uv positon map

你好,关于生成uv位置图ground truth.有个问题。我下载了这个代码配好环境,先生成出一个基础的BFM 模型。然后,运行generate uv positon map脚本,输入2D图片产生了相应的uv position map .但是我有一个疑惑,产生uv 位置图的代码里只有一个基础BFM model。不同的图片应该有不同的 BFM模型才对啊,请您解释下我的疑惑,谢谢。

ImportError: No module named cython

Traceback (most recent call last):
File "1_pipeline.py", line 12, in
import face3d
File "/home/zhangyongle/face3d/examples/face3d/init.py", line 1, in
from . import mesh
File "/home/zhangyongle/face3d/examples/face3d/mesh/init.py", line 1, in
from .cython import mesh_core_cython
ImportError: No module named cython

Using it on custom 2D images

Hey, Thanks for the project.
I actually wanted to generate depth maps of custom 2D images which I have. How can I do that with this project (and if it can be done or not)?

uv_texture_map

I want to use render_texture() function as in 5_render.py script. My question is how to create uv_texture_map.jpg given .obj file with uv coordinates and .jpg file associated to .obj file ?
Is the map_Kd in .mtl file what i need to apply as texture during render_texture?

face3d-master\face3d\mesh\io.py error

Hi,
Thank you for sharing your code. I meet an error like this:
File "F:\face3d-master\face3d\mesh\io.py", line 5, in
ModuleNotFoundError: No module named 'numpy'

But I have install numpy and the version is 1.15.2. What can I do to solve it?

how to render fitted model for IBUG image?

Hello all,

I found an image examples/Data/IBUG_image_008_1_0.jpg and its fitted params examples/Data/IBUG_image_008_1_0.mat. I tried following to render the fitted model

# --- 1. load model
bfm = MorphabelModel('../examples/Data/BFM/Out/BFM.mat')
print('init bfm model success')

# --- 2. load fitted face
pic_name = 'IBUG_image_008_1_0'
mat_filename = '../examples/Data/{0}.mat'.format(pic_name)
mat_data = sio.loadmat(mat_filename)
image_filename = '../examples/Data/{0}.jpg'.format(pic_name)
with open(image_filename, 'rb') as file:
    img = Image.open(file)
    print('image size: {0}'.format(img.size))
sp = mat_data['Shape_Para']
ep = mat_data['Exp_Para']
vertices = bfm.generate_vertices(sp, ep)

tp = bfm.get_tex_para('random')
colors = bfm.generate_colors(tp)
colors = np.minimum(np.maximum(colors, 0), 1)

# --- 3. transform vertices to proper position
pp = mat_data['Pose_Para']
s = pp[0, 6]
# angles = [np.rad2deg(pp[0, 0]), np.rad2deg(pp[0, 1]), np.rad2deg(pp[0, 2])]
angles = pp[0, 0:3]
t = pp[0, 3:6]

# set prop of rendering
h = w = 450
c = 3

# s = 8e-04
# angles = [10, 30, 20]
# t = [0, 0, 0]
transformed_vertices = bfm.transform_3ddfa(vertices, s, angles, t)
projected_vertices = transformed_vertices.copy()  # using stantard camera & orth projection
# projected_vertices[:,1] = h - projected_vertices[:,1] - 1
# --- 4. render(3d obj --> 2d image)
image_vertices = mesh.transform.to_image(projected_vertices, h, w)
image = mesh.render.render_colors(image_vertices, bfm.triangles, colors, h, w)
io.imsave('./generated.jpg', image)

however, only a part of the rendered face can be seen in the image. If I increase the image size from 450 to 1024, then I see the full rendered face. Is there something wrong with how I handled the translation params?
generated_450
generated_1024

Not enough randomness in the shape of faces

Hi,

Great repo, very helpful! One issue I had when generating random faces is that the shapes of random faces are very similar to each other. It'd be great if we can get more diverse faces.

The faces become more diverse after I made the following changes. Basically, I use shape_para * self.model['shapeEV'] rather than shape_para alone in calculating the axis. This is adapted from the Matlab code in the BFM model. (This change somehow breaks the fitting process, though.)

    def get_shape_para(self, type = 'random'):
        if type == 'zero':
            sp = np.zeros((self.n_shape_para, 1))
        elif type == 'random':
            sp = np.random.randn(self.n_shape_para, 1)   # normally distributed random numbers
        return sp

    def generate_vertices(self, shape_para, exp_para):
        
        vertices = self.model['shapeMU'] + \
                    self.model['shapePC'].dot(shape_para * self.model['shapeEV']) + \
                    self.model['expPC'].dot(exp_para)
        vertices = np.reshape(vertices, [int(3), int(len(vertices)/3)], 'F').T
        return vertices

about the input of fit.fit_point

hello professor, i don't know it exactly what is the two input:
x: (n, 2) image points
X_ind: (n,) corresponding Model vertex indices
is x just a picture?
and is X_ind generated by morphable.generate_vertices?

KeyError: 'vertices'

$ 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?

ValueError: Images of type float must be between -1 and 1

When trying to run example 7_generate_uv_map.py I get an error:

$python 7_generate_uv_map.py
Traceback (most recent call last):
File "7_generate_uv_map.py", line 50, in
io.imsave('{}/uv_texture_map.jpg'.format(save_folder), np.squeeze(uv_texture_map))
File "/home/johnh/.local/lib/python3.6/site-packages/skimage/io/_io.py", line 143, in imsave
return call_plugin('imsave', fname, arr, plugin=plugin, **plugin_args)
File "/home/johnh/.local/lib/python3.6/site-packages/skimage/io/manage_plugins.py", line 214, in call_plugin
return func(*args, **kwargs)
File "/home/johnh/.local/lib/python3.6/site-packages/skimage/io/_plugins/pil_plugin.py", line 259, in imsave
img = ndarray_to_pil(arr, format_str=format_str)
File "/home/johnh/.local/lib/python3.6/site-packages/skimage/io/_plugins/pil_plugin.py", line 163, in ndarray_to_pil
arr = img_as_ubyte(arr)
File "/home/johnh/.local/lib/python3.6/site-packages/skimage/util/dtype.py", line 492, in img_as_ubyte
return convert(image, np.uint8, force_copy)
File "/home/johnh/.local/lib/python3.6/site-packages/skimage/util/dtype.py", line 261, in convert
raise ValueError("Images of type float must be between -1 and 1.")
ValueError: Images of type float must be between -1 and 1.

Might be related to this topic: http://scikit-image.org/docs/stable/user_guide/data_types.html

and this thread appears to be dealing with same issue: scikit-image/scikit-image#2756

image

P_Affine is not an orthogonal rotation matrix

P attained from https://github.com/YadiraF/face3d/blob/master/face3d/mesh/transform.py#L239 is not an orthogonal rotation matrix.

Here, https://github.com/YadiraF/face3d/blob/master/face3d/morphable_model/fit.py#L254 , we only get an approximation of s, R, t (P != [sR|t]). R is not an orthogonal rotation matrix, either.

The transformation of R to angles, https://github.com/YadiraF/face3d/blob/master/face3d/morphable_model/morphabel_model.py#L140 , is not lossless, because 3 Euler angles cannot reconstruct the matrix R if R is not an orthogonal rotation matrix.

show.m error

Hi YadiraF:

whne i run the matlab code show.m in examples/Data/BFM, got the below error:

Error in show (line 38)
patch('Vertices', uv_vertices', 'FaceVertexCData', tex', 'Faces', tri', 'FaceColor', 'interp', 'EdgeColor', 'none', 'EdgeLighting', 'none',
'LineWidth', 1);

Mac compile cython error with mesh_core_cython

 "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]

#warning "Using deprecated NumPy API, disable it by "
^
mesh_core_cython.cpp:583:10: fatal error: 'ios' file not found
#include "ios"
^~~~~
2 warnings and 1 error generated.
error: command 'gcc' failed with exit status 1

`2_3dmm.py Lossy conversion problem

Lossy conversion from float32 to uint8. Range [-2.5365238189697266, 31.68016815185547]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-15.381681442260742, 16.904739379882812]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-322.37890625, 1381.71484375]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-353.31640625, 820.2724609375]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-19.9322509765625, 506.154296875]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-3.3485708236694336, 9.674751281738281]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-87.1246337890625, 1.7592124938964844]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-6.374320983886719, 2.4354400634765625]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-38.636474609375, 6.33953857421875]. Convert image to uint8 prior to saving to suppress this warning. Lossy conversion from float32 to uint8. Range [-36.821044921875, 6.34783935546875]. Convert image to uint8 prior to saving to suppress this warning.
Has any one got this warning ?

Why the 3DMM fitting landmarks result is 2d ?

As the following image showed, which is 300vw/035/vid.avi frames, the green landmarks is groundtruth, and the white landmarks coming from generated vertices, which should be 3d when the left face boundary is invisible, but it just capture the boundary. Why? Anything have I missed?

3dmm

Exploitation of face3d with PRNet 3D Reconstructed Face

Hi YadirF, I'd like to use your code for the 3D reconstruction of provided 2D single image.
But your code starts from an already provided 3D model which holds vertices and expression information in 3D coordinate format.

Do you think would it be possible for me to use your PRnet for pre-fitting of single image into 3D then feed it into your face3d to find the PCA coefficients?

It looks like your PRnet presents slightly less vertices(40K) compared to face3d(50K) and I hope there semantical point representation has some consistency.

I presumably guess if I can load the 300LP face model into the face3d, it might work cuz you denoted that you are using this model for your PRnet. How do you think?

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

Error executing 8_generate_posmap_300WLP.py

When I executed python 8_generate_posmap_300WLP.py, I had a fatal error. I checked a lot of information and couldn't solve it. I hope I can get your help.
Error is as follows:/home/dbm/.pyxbld/temp.linux-x86_64-2.7/pyrex/face3d/mesh/cython/mesh_core_cython.c:437:15: fatal error: ios: No such file or directory
#include "ios"
#include "string"
#include "new"

Thanks

.mat creation

Hi everyone. I have *.MTL file related to it's *.OBJ file. How to prepare .mat file as Data/example1.mat.

Uv coordinates of image

How do I get the uv coordinates of a 3d model? I want to create a texture map from any image not just the one from the bfm model. But 7_generate_uv_map.py only generates it for the BFM example. I found this:
uv_coords = face3d.morphable_model.load.load_uv_coords('Data/BFM/Out/BFM_UV.mat')
attribute = uv_coords
uv_coords_image = mesh_numpy.render.render_colors(image_vertices, triangles, attribute, h, w, c=2)

But this results in an array of 3 dimensions, while the texture map generation from 7_generate_uv_map.py needs a 2 dimension array. Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.