@@ -209,12 +209,15 @@ int main(int argc, char *argv[])
209209 vector<Vec2f> image_points;
210210 render::Mesh mesh;
211211 std::tie (mesh, rendering_params) = fitting::fit_shape_and_pose (morphable_model, blendshapes, rcr_to_eos_landmark_collection (current_landmarks), landmark_mapper, unmodified_frame.cols , unmodified_frame.rows , edge_topology, ibug_contour, model_contour, 3 , 5 , 15 .0f , boost::none, shape_coefficients, blendshape_coefficients, image_points);
212- Mat affine_cam = fitting::get_3x4_affine_camera_matrix (rendering_params, frame.cols , frame.rows );
213212
214213 // Draw the 3D pose of the face:
215214 draw_axes_topright (glm::eulerAngles (rendering_params.get_rotation ())[0 ], glm::eulerAngles (rendering_params.get_rotation ())[1 ], glm::eulerAngles (rendering_params.get_rotation ())[2 ], frame);
215+
216+ // Wireframe rendering of mesh of this frame (non-averaged):
217+ draw_wireframe (frame, mesh, rendering_params.get_modelview (), rendering_params.get_projection (), fitting::get_opencv_viewport (frame.cols , frame.rows ));
216218
217- // Get the fitted mesh, extract the texture:
219+ // Extract the texture using the fitted mesh from this frame:
220+ Mat affine_cam = fitting::get_3x4_affine_camera_matrix (rendering_params, frame.cols , frame.rows );
218221 Mat isomap = render::extract_texture (mesh, affine_cam, unmodified_frame, true , render::TextureInterpolation::NearestNeighbour, 512 );
219222
220223 // Merge the isomaps - add the current one to the already merged ones:
@@ -224,9 +227,6 @@ int main(int argc, char *argv[])
224227 auto merged_shape = morphable_model.get_shape_model ().draw_sample (shape_coefficients) + morphablemodel::to_matrix (blendshapes) * Mat (blendshape_coefficients);
225228 render::Mesh merged_mesh = morphablemodel::sample_to_mesh (merged_shape, morphable_model.get_color_model ().get_mean (), morphable_model.get_shape_model ().get_triangle_list (), morphable_model.get_color_model ().get_triangle_list (), morphable_model.get_texture_coordinates ());
226229
227- // Wireframe rendering of mesh of this frame (non-averaged):
228- draw_wireframe (frame, mesh, rendering_params.get_modelview (), rendering_params.get_projection (), fitting::get_opencv_viewport (frame.cols , frame.rows ));
229-
230230 // Render the model in a separate window using the estimated pose, shape and merged texture:
231231 Mat rendering;
232232 auto modelview_no_translation = rendering_params.get_modelview ();
0 commit comments