patrikhuber / eos

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

Black holes (nostrils) #297

Closed virtualenv closed 4 years ago

virtualenv commented 4 years ago

Dear Patrik,

First of all, amazing project! Thanks so much for sharing! I am having this issue with 95% of the faces files that I have. Please let me know what I could be doing wrong. I know this was already asked here : Black line in isomap extraction #4

std::tie(mesh, rendering_params) = eos::fitting::fit_shape_and_pose(*morphable_model_with_expressions, landmarks, landmark_mapper, frame.cols, frame.rows, edge_topology, ibug_contour, model_contour, 5, eos::cpp17::nullopt, 30.0f);
// Extract the texture from the frame using given mesh and camera parameters:
const Eigen::Matrix<float, 3, 4> affine_from_ortho = eos::fitting::get_3x4_affine_camera_matrix(rendering_params, frame.cols, frame.rows);
isomap = eos::render::extract_texture(mesh, affine_from_ortho, eos::core::from_mat(frame), true);
isomap = eos::render::detail::interpolate_black_line(isomap); <-- doesn't work for the nostrils.

error_1 error_2 output isomap

Thank you!!!

patrikhuber commented 4 years ago

Hi,

Thanks!

This looks like it's working as expected. These triangles ("patches of skin") are occluded, they're not in view. There is no data (texture) there in your image of that region. What would you expect to be there?

If you want texture data for occluded regions, you'll have to decide what strategy you want of how to fill it (blend/interpolate, mirror, use per-vertex colour from the model, etc.).

virtualenv commented 4 years ago

Just thought : isomap = eos::render::detail::interpolate_black_line(isomap); would fill those gaps. " What would you expect to be there? " Ok, sorry for the dumb question, thank you for your time.

patrikhuber commented 4 years ago

No worries!

The eos::render::detail::interpolate_black_line(...) function actually only "fixed" a very specific problem with a vertical line occurring in the centre of the texture map. However as indicated in #4, this was fixed in 6875e08b6678046e9c04fc5860383f39d22edd4f. Actually, since the problem was properly fixed, I could've removed the eos::render::detail::interpolate_black_line(...) function a while ago. It can definitely be removed now and I will do so - I opened #298 to track that. Thank you!

virtualenv commented 4 years ago

Thank you for the explanation. May I ask if there is any function in your library, that could fill the occluded patches of skin ? Thank you once again.

patrikhuber commented 4 years ago

There isn't currently any ready-made function that fills occluded patches.

virtualenv commented 4 years ago

Thank you.