patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.9k stars 597 forks source link

A supplementary question for the modification of PCA color coefficients #93

Closed codediner closed 7 years ago

codediner commented 7 years ago

Hi Patrik, thank you for your answer last time, I am sorry to disturb you again.

In fact, I hava loaded a model that contains color information, but I didn't succeed to modify the PCA color coefficients in the mopharble_model.hpp draw in render::Mesh draw_sample.

I run the fit-model.cpp, after the line 220 of std::tie(mesh, rendering_params) = fitting::fit_shape_and_pose(morphable_model, blendshapes, landmarks, landmark_mapper, image.cols, image.rows, edge_topology, ibug_contour, model_contour, 50, boost::none, 30.0f);

I have gotten a morphable model with 129 color eigenvalues but I didn't succced to read the PCA color coeffiecients and modify them, can you give me some indifications step by step for the modificatin of the color coefficients please?

In fact, I am still exploring your wonderful programs to get a better understand for your algo. And if we just want to load PCA color coefficients instead of using the texture information, we have to change something in these lines or not as my comprehension? Mat affine_from_ortho = fitting::get_3x4_affine_camera_matrix(rendering_params, image.cols, image.rows); Mat isomap = render::extract_texture(mesh, affine_from_ortho, image); (fit_model.cpp line 227 228)

Hopes for your guide.

Thank you in advance.

Sincerely

patrikhuber commented 7 years ago

Hi,

As I mentioned last time, you can use draw_sample to modify the colour coefficients. It takes a vector<float> so you can modify that however you want.

As the documentation says, fitting::fit_shape_and_pose fits the shape model, not the colour model. eos currently doesn't fit the colour model, however I think at the end of the fit-model-ceres example there's an example of how colour fitting might look like - but to make this succeed you need a light model and other stuff as well, see the various papers on 3DMM fitting, and it doesn't run in real-time.

codediner commented 7 years ago

Thank you very much for your help and anwer me quickly, I will try it.