MEPP2 Project
example_libmsdm2_surfacemesh.cpp
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <string>
4 #include <fstream>
5 
6 #include "msdm2_surfacemesh.h"
7 
8 int main(int argc, char **argv)
9 {
10  // check arguments
11  if(argc != 3)
12  {
13  std::cout << "Compute the MSDM2 value between the degraded mesh and "
14  "the original mesh.\n"
15  << std::endl;
16  std::cout << "Usage: "
17  << argv[0] << " path/to/original_mesh.off path/to/degraged_mesh.off"
18  << std::endl;
19  std::cout << "Note: only OFF files are supported."
20  << std::endl;
21 
22  return 1;
23  }
24 
25  // input and output files
26  std::string filename_original(argv[1]);
27  std::string filename_degraded(argv[2]);
28 
29  // read meshes from files
30  msdm2::MeshT mesh_original;
31  msdm2::MeshT mesh_degraded;
32 
33  std::ifstream in1(filename_original);
34  in1 >> mesh_original;
35  std::cout << "Original mesh file name: " << filename_original << std::endl;
36  std::cout << "Original mesh vertices number: " << mesh_original.number_of_vertices() << std::endl;
37 
38  std::ifstream in2(filename_degraded);
39  in2 >> mesh_degraded;
40  std::cout << "Degraded mesh file name: " << filename_degraded << std::endl;
41  std::cout << "Degraded mesh vertices number: " << mesh_degraded.number_of_vertices() << std::endl;
42 
43  // call msdm2 filter
44  int nb_levels = 3;
45  double msdm2_value;
46  msdm2::Msdm2MapT msdm2_map;
47  msdm2::msdm2_surfacemesh(mesh_degraded,
48  mesh_original,
49  nb_levels,
50  msdm2_value, /* output */
51  msdm2_map); /* output */
52 
53  std::cout << "Calculated MSDM2 : " << msdm2_value << std::endl;
54 
55  return 0;
56 }
57 
58 
main
int main(int argc, char **argv)
Definition: example_libmsdm2_surfacemesh.cpp:8
msdm2_surfacemesh.h
msdm2::Msdm2MapT
boost::vector_property_map< double, VertexIndexMapT > Msdm2MapT
Definition: msdm2_surfacemesh.h:37
msdm2::msdm2_surfacemesh
void msdm2_surfacemesh(const MeshT &mesh_degraded, const MeshT &mesh_original, const int nb_levels, double &msdm2_value, Msdm2MapT &msdm2_pmap)
Computes the multiscale MSDM2 metric.
Definition: msdm2_surfacemesh.cpp:25
msdm2::MeshT
CGAL::Surface_mesh< CGALPoint > MeshT
Definition: msdm2_surfacemesh.h:32