Go to the documentation of this file.
23 main(
int argc,
const char **argv)
28 <<
"Load 2 meshes from input files, compute their CMDM, then compare the output file (the degraded mesh covered by the local distortion map) with the reference file."
30 std::cout <<
"Usage: " << argv[0]
31 <<
" input_original_mesh_path input_degraded_mesh_path Output_LD_degraded_mesh DegradedMesh_LD_OutputReferenceValues"
33 std::cout <<
"Example: " << argv[0]
34 <<
" Fish_ref.obj Fish_simplified.obj Fish_simplified_cmdm.out.obj Fish_cmdm_reference.obj"
39 std::string input_original_file_path = argv[1];
40 std::string input_deformed_file_path = argv[2];
41 std::string output_file_path = argv[3];
42 std::string reference_file_path = argv[4];
56 auto pm_degrad =
get(boost::vertex_point, m_degraded);
57 auto pm_original =
get(boost::vertex_point, m_original);
60 FaceNormalMap fnm_degrad;
63 std::cout <<
"use existing face-normal map for degraded mesh" << std::endl;
68 std::cout <<
"create face-normal map for degraded mesh" << std::endl;
75 FaceNormalMap fnm_original;
78 std::cout <<
"use existing face-normal map for original mesh" << std::endl;
83 std::cout <<
"create face-normal map for original mesh" << std::endl;
94 std::cout <<
"use existing color maps for original and degraded meshes"
100 <<
"CMDM needs 2 meshes with diffuse colors.\nUse MSDM2 Plugin for "
101 "meshes having geometry characteristics only."
108 vertex_cmdm_map cmdm_pmap_deg, cmdm_pmap_orig;
113 boost::any_cast< vertex_cmdm_map >(pmaps_bag_degraded.at(
"v:cmdm"));
118 FEVV::make_vertex_property_map< FEVV::MeshSurface, double >(m_degraded);
119 pmaps_bag_degraded[
"v:cmdm"] = cmdm_pmap_deg;
123 double cmdm_1_2, cmdm;
138 std::cout <<
"Calculated CMDM = " << cmdm << std::endl;
141 using VertexColorMap =
144 VertexColorMap v_cm =
147 double max_cmdm_1_2, min_cmdm_1_2;
150 m_degraded, cmdm_pmap_deg, min_cmdm_1_2, max_cmdm_1_2);
162 std::cout <<
"Comparing output file '" << output_file_path
163 <<
"' with reference file '" << reference_file_path <<
"'..."
172 std::cout <<
"Files are different!" << std::endl;
181 std::cout <<
"Files are different!" << std::endl;
186 std::cout <<
"Files are identical." << std::endl;
void put_property_map(PropertyT p, const MeshT &, PMapsContainer &pmaps, const typename PMap_traits< PropertyT, MeshT >::pmap_type &pmap)
void compute_min_max_vertices(const HalfedgeGraph &g, const PropertyMap &prop_map, MapType &min_metric, MapType &max_metric)
Compute min and max value of a numerical property map for the vertices of a mesh.
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
int main(int argc, const char **argv)
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
bool are_meshes_equal(std::string filename_a, std::string filename_b, bool verbose)
CGAL::Surface_mesh< CGALPoint > MeshSurface
std::map< std::string, boost::any > PMapsContainer
void color_vertices_from_map(const HalfedgeGraph &g, const PropertyMap &prop_map, ColorMap &color_pmap, const MapType min_metric, const MapType max_metric, const ColorMeshLUT &colors=make_LUT())
Fill the color map for the vertices of a mesh using a numerical property map.
ColorMeshLUT make_LUT(bool color_in_0_255=true, unsigned int colors_nbr=256, float h1=240, float h2=0)
Create a RGB LUT based on an HSV range. Default range creates a blue-cyan-green-yellow-red gradient.
bool identical_text_based_files(std::string filename_a, std::string filename_b, const std::vector< std::string > &skip=std::vector< std::string >())
std::vector< float > ColorMeshLUT
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
void calculate_face_normals(const HalfedgeGraph &g, const PointMap &pm, FaceNormalMap fnm, const GeometryTraits >)
Calculate "some" normal of all the faces of the considered mesh and populate the argument provided Fa...
typename Vertex_pmap_traits< MeshT, ValueT >::pmap_type Vertex_pmap
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::const_type get(const boost::vertex_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
Returns the vertex index property map of the mesh.
bool has_extension(const std::string &file_name)
double process_CMDM_multires(const HalfedgeGraph &m_poly_degrad, const PointMap &pm_degrad, const FaceNormalMap &fnm_degrad, FEVV::PMapsContainer &pmaps_degrad, const HalfedgeGraph &m_poly_original, const PointMap &pm_original, const FaceNormalMap &fnm_original, FEVV::PMapsContainer &pmaps_original, const int nb_level, VertexCMDMMap &cmdm_pmap, const double maxdim, double &CMDM_value)
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)