Go to the documentation of this file.
11 #include <CGAL/Cartesian.h>
12 #include <CGAL/Surface_mesh.h>
13 #include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
38 using MeshT = CGAL::Surface_mesh< CGALPoint >;
42 main(
int argc,
const char **argv)
45 int screen_width = 1920;
46 int screen_height = 1080;
47 double screen_size = 55.;
48 double user_dist = 50.;
49 int scene_width = 1080;
50 double scene_fov = M_PI * 0.3333;
51 int number_of_lights = 16;
56 <<
"Load a mesh from an input file, compute it's JND, write it to an "
57 "output file, then compare the output file with a reference file."
59 std::cout <<
"Usage: " << argv[0]
60 <<
" input_mesh_file output_mesh_file reference_mesh_file"
62 std::cout <<
"Example: " << argv[0]
63 <<
" armadillo_simplified.obj armadillo.out.obj "
64 "armadillo_jnd_reference.obj"
69 std::string input_file_path = argv[1];
70 std::string output_file_path = argv[2];
71 std::string reference_file_path = argv[3];
78 ScreenParam screen(screen_width, screen_height, screen_size);
87 auto pm =
get(boost::vertex_point, m);
94 using VertexColorMap =
100 std::cout <<
"use existing vertex-color map" << std::endl;
105 std::cout <<
"create vertex-color map" << std::endl;
113 using FaceNormalMap =
119 std::cout <<
"use existing face-normal map" << std::endl;
124 std::cout <<
"create face-normal map" << std::endl;
133 using VertexNormalMap =
136 VertexNormalMap v_nm;
139 std::cout <<
"use existing vertex-normal map" << std::endl;
144 std::cout <<
"create vertex-normal map" << std::endl;
155 jnd_m = FEVV::make_vertex_property_map< FEVV::MeshSurface, double >(m);
173 double max_jnd, min_jnd;
178 m, jnd_m, v_cm, min_jnd, max_jnd, lut_courbure_clust);
183 std::cout <<
"Comparing output file '" << output_file_path
184 <<
"' with reference file '" << reference_file_path <<
"'..."
193 std::cout <<
"Files are different!" << std::endl;
202 std::cout <<
"Files are different!" << std::endl;
207 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)
The parameters of the user.
The parameters of the screen.
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
The parameters of the scene.
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.
int main(int argc, const char **argv)
bool identical_text_based_files(std::string filename_a, std::string filename_b, const std::vector< std::string > &skip=std::vector< std::string >())
CGAL::Cartesian< double > CGALKernel
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...
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
void calculate_vertex_normals(const HalfedgeGraph &g, const PointMap &pm, const FaceNormalMap &fnm, VertexNormalMap vnm, const GeometryTraits >)
Compute the respectice vertex normal for all the vertices of the considered mesh and populate the arg...
CGALKernel::Point_3 CGALPoint
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.
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
bool has_extension(const std::string &file_name)
void just_noticeable_distortion_filter(const HalfedgeGraph &halfedge_graph, PointMap &point_map, const VertexNormalMap &vertex_normal_map, const GeometryTraits &geometry_traits, const FaceNormalMap &face_normal_map, JNDMap &jnd_map, const ScreenParam &screen, const UserParam &user, const SceneParam &scene, const int nb_light_sources, bool data_output=false, bool use_random=true)
Computes the Just Noticeable Distortion metric.
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)