Commit 38d49f1b authored by Patrik Huber's avatar Patrik Huber

fit-model now stores a textured obj and no landmark image anymore.

Also updated the documentation of Mesh.
parent 1647daf1
...@@ -206,7 +206,7 @@ int main(int argc, char *argv[]) ...@@ -206,7 +206,7 @@ int main(int argc, char *argv[])
// Obtain the full mesh and draw it using the estimated camera: // Obtain the full mesh and draw it using the estimated camera:
render::Mesh mesh = morphable_model.draw_sample(fitted_coeffs, vector<float>()); render::Mesh mesh = morphable_model.draw_sample(fitted_coeffs, vector<float>());
outputfile += fs::path(".obj"); outputfile += fs::path(".obj");
render::write_obj(mesh, outputfile.string()); // save the mesh as obj render::write_textured_obj(mesh, outputfile.string()); // save the mesh as obj
// Draw the projected points again, this time using the fitted model shape: // Draw the projected points again, this time using the fitted model shape:
for (auto&& idx : vertex_indices) { for (auto&& idx : vertex_indices) {
...@@ -215,7 +215,9 @@ int main(int argc, char *argv[]) ...@@ -215,7 +215,9 @@ int main(int argc, char *argv[])
cv::circle(outimg, cv::Point2f(screen_point), 3, { 0.0f, 0.0f, 255.0f }); cv::circle(outimg, cv::Point2f(screen_point), 3, { 0.0f, 0.0f, 255.0f });
} }
// Save the output image: // Save an output image with the landmarks from the different stages:
//outputfile.replace_extension(".png");
//cv::imwrite(outputfile.string(), outimg);
outputfile.replace_extension(".png"); outputfile.replace_extension(".png");
cv::imwrite(outputfile.string(), outimg); cv::imwrite(outputfile.string(), outimg);
......
...@@ -40,8 +40,10 @@ namespace eos { ...@@ -40,8 +40,10 @@ namespace eos {
namespace render { namespace render {
/** /**
* This class represents a 3D mesh consisting of vertices and vertex color * @brief This class represents a 3D mesh consisting of vertices, vertex colour
* information. Additionally it stores the indices that specify which vertices * information and texture coordinates.
*
* Additionally it stores the indices that specify which vertices
* to use to generate the triangle mesh out of the vertices. * to use to generate the triangle mesh out of the vertices.
*/ */
struct Mesh struct Mesh
...@@ -55,7 +57,9 @@ struct Mesh ...@@ -55,7 +57,9 @@ struct Mesh
}; };
/** /**
* Writes an obj file of the given Mesh that can be read by e.g. Meshlab. * @brief Writes the given Mesh to an obj file that for example can be read by Meshlab.
*
* If the mesh contains vertex colour information, it will be written to the obj as well.
* *
* @param[in] mesh The mesh to save as obj. * @param[in] mesh The mesh to save as obj.
* @param[in] filename Output filename. * @param[in] filename Output filename.
...@@ -86,8 +90,12 @@ inline void write_obj(Mesh mesh, std::string filename) ...@@ -86,8 +90,12 @@ inline void write_obj(Mesh mesh, std::string filename)
} }
/** /**
* Writes an obj file of the given Mesh that can be read by e.g. Meshlab. * @brief Writes an obj file of the given Mesh, including texture coordinates,
* Saves texture coordinates and texture information as well. * and an mtl file containing a reference to the isomap.
*
* The obj will contain texture coordinates for the mesh, and the
* mtl file will link to a file named <filename>.isomap.png.
* Note that the texture (isomap) has to be stored separately.
* *
* @param[in] mesh The mesh to save as obj. * @param[in] mesh The mesh to save as obj.
* @param[in] filename Output filename. * @param[in] filename Output filename.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment