From aac29a89497626fb18126f6c3879f36e1b7eaa57 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 25 Aug 2017 14:35:21 +0200 Subject: [PATCH] Remove outdated tests --- .../test/Classification/CMakeLists.txt | 2 - .../test/Classification/test_classifier.cpp | 176 ------------------ .../test_point_set_classifier.cpp | 81 -------- 3 files changed, 259 deletions(-) delete mode 100644 Classification/test/Classification/test_classifier.cpp delete mode 100644 Classification/test/Classification/test_point_set_classifier.cpp diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index 7228277f158..7a00efc6073 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -52,6 +52,4 @@ include( CGAL_CreateSingleSourceCGALProgram ) #add_definitions("-DCGAL_DO_NOT_USE_BOYKOV_KOLMOGOROV_MAXFLOW_SOFTWARE") -create_single_source_cgal_program( "test_classifier.cpp" ) -create_single_source_cgal_program( "test_point_set_classifier.cpp" ) diff --git a/Classification/test/Classification/test_classifier.cpp b/Classification/test/Classification/test_classifier.cpp deleted file mode 100644 index b503eea8aa5..00000000000 --- a/Classification/test/Classification/test_classifier.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef CGAL::Simple_cartesian Kernel; -typedef Kernel::Point_3 Point; -typedef Kernel::Vector_3 Vector; -typedef CGAL::cpp11::array Color; -typedef Kernel::Iso_cuboid_3 Iso_cuboid_3; - -typedef boost::tuple Point_with_info; -typedef std::vector Point_range; - -typedef CGAL::Nth_of_tuple_property_map<0, Point_with_info> Pmap; -typedef CGAL::Nth_of_tuple_property_map<1, Point_with_info> Nmap; -typedef CGAL::Nth_of_tuple_property_map<2, Point_with_info> Cmap; -typedef CGAL::Nth_of_tuple_property_map<3, Point_with_info> Emap; - -typedef CGAL::Classifier Classifier; - -typedef CGAL::Classification::Planimetric_grid Planimetric_grid; -typedef CGAL::Classification::Point_set_neighborhood Neighborhood; -typedef CGAL::Classification::Local_eigen_analysis Local_eigen_analysis; - -typedef CGAL::Classification::Type_handle Type_handle; -typedef CGAL::Classification::Attribute_handle Attribute_handle; - -typedef CGAL::Classification::Attribute::Anisotropy - Anisotropy; -typedef CGAL::Classification::Attribute::Distance_to_plane - Distance_to_plane; -typedef CGAL::Classification::Attribute::Eigentropy - Eigentropy; -typedef CGAL::Classification::Attribute::Elevation - Elevation; -typedef CGAL::Classification::Attribute::Linearity - Linearity; -typedef CGAL::Classification::Attribute::Omnivariance - Omnivariance; -typedef CGAL::Classification::Attribute::Planarity - Planarity; -typedef CGAL::Classification::Attribute::Sphericity - Sphericity; -typedef CGAL::Classification::Attribute::Sum_eigenvalues - Sum_eigen; -typedef CGAL::Classification::Attribute::Surface_variation - Surface_variation; -typedef CGAL::Classification::Attribute::Vertical_dispersion - Dispersion; -typedef CGAL::Classification::Attribute::Verticality - Verticality; -typedef CGAL::Classification::RGB_Color RGB_Color; -typedef CGAL::Classification::Attribute::Hsv - Hsv; -typedef CGAL::Classification::Attribute::Hsv - Hsv; -typedef CGAL::Classification::Attribute::Echo_scatter - Echo_scatter; - -typedef CGAL::Classification::Attribute::Effect Attribute_effect; - -int main (int, char**) -{ - Point_range range; - range.reserve(10000); - for (std::size_t i = 0; i < 10000; ++ i) - range.push_back (boost::make_tuple - (Point (CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double()), - Vector (CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double()), - CGAL::make_array ((unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255))), - std::size_t(CGAL::get_default_random().get_int(0, 10)))); - - double grid_resolution = 0.34; - double radius_neighbors = 1.7; - double radius_dtm = 15.0; - - Classifier classifier (range, Pmap()); - Iso_cuboid_3 bbox = CGAL::bounding_box (boost::make_transform_iterator - (range.begin(), - CGAL::Property_map_to_unary_function()), - boost::make_transform_iterator - (range.end(), - CGAL::Property_map_to_unary_function())); - - Planimetric_grid grid (range, Pmap(), bbox, grid_resolution); - Neighborhood neighborhood (range, Pmap()); - Local_eigen_analysis eigen (range, Pmap(), neighborhood.k_neighbor_query(6)); - - std::vector att; - - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (Pmap(), grid, - grid_resolution, - radius_neighbors)); - att.push_back (classifier.add_attribute (Pmap(), eigen)); - att.push_back (classifier.add_attribute (Emap(), grid, grid_resolution, radius_neighbors)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (Pmap(), grid, - grid_resolution, - radius_dtm)); - att.push_back (classifier.add_attribute (Cmap(), 0, 180, 90)); - att.push_back (classifier.add_attribute (Cmap(), 1, 50, 25)); - att.push_back (classifier.add_attribute (Cmap(), 2, 50, 25)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (eigen)); - att.push_back (classifier.add_attribute (Nmap())); - att.push_back (classifier.add_attribute (eigen)); - assert (classifier.remove_attribute (att.back())); - att.pop_back(); - assert (att.size() == classifier.number_of_attributes()); - - std::vector types; - types.push_back (classifier.add_classification_type ("type1")); - types.push_back (classifier.add_classification_type ("type2")); - types.push_back (classifier.add_classification_type ("type3")); - types.push_back (classifier.add_classification_type ("type4")); - types.push_back (classifier.add_classification_type ("type5")); - types.push_back (classifier.add_classification_type ("type6")); - assert (classifier.remove_classification_type (types.back())); - types.pop_back(); - assert (types.size() == classifier.number_of_classification_types()); - - for (std::size_t i = 0; i < types.size(); ++ i) - for (std::size_t j = 0; j < att.size(); ++ j) - { - att[j]->set_weight (CGAL::get_default_random().get_double()); - types[i]->set_attribute_effect - (att[j], (Attribute_effect)(CGAL::get_default_random().get_int(0,3))); - } - - classifier.run(); - classifier.run_with_local_smoothing(neighborhood.k_neighbor_query(6)); - classifier.run_with_graphcut(neighborhood.k_neighbor_query(12), 0.5); - - std::vector output; - output.reserve (10000); - for (std::size_t i = 0; i < range.size(); ++ i) - { - output.push_back (classifier.classification_type_of(i)); - assert (0 <= classifier.confidence_of(i)); - } - - - classifier.clear_classification_types(); - classifier.clear_attributes(); - - return EXIT_SUCCESS; -} diff --git a/Classification/test/Classification/test_point_set_classifier.cpp b/Classification/test/Classification/test_point_set_classifier.cpp deleted file mode 100644 index 33ab790cce3..00000000000 --- a/Classification/test/Classification/test_point_set_classifier.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include -#include - -typedef CGAL::Simple_cartesian Kernel; -typedef Kernel::Point_3 Point; -typedef Kernel::Vector_3 Vector; -typedef CGAL::cpp11::array Color; -typedef Kernel::Iso_cuboid_3 Iso_cuboid_3; - -typedef boost::tuple Point_with_info; -typedef std::vector Point_range; - -typedef CGAL::Nth_of_tuple_property_map<0, Point_with_info> Pmap; -typedef CGAL::Nth_of_tuple_property_map<1, Point_with_info> Nmap; -typedef CGAL::Nth_of_tuple_property_map<2, Point_with_info> Cmap; -typedef CGAL::Nth_of_tuple_property_map<3, Point_with_info> Emap; - -typedef CGAL::Point_set_classifier PSC; - -typedef CGAL::Classification::Type_handle Type_handle; -typedef CGAL::Classification::Attribute_handle Attribute_handle; - -typedef CGAL::Classification::Attribute::Effect Attribute_effect; - -int main (int, char**) -{ - Point_range range; - range.reserve(10000); - for (std::size_t i = 0; i < 10000; ++ i) - range.push_back (boost::make_tuple - (Point (CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double()), - Vector (CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double(), - CGAL::get_default_random().get_double()), - CGAL::make_array ((unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255))), - std::size_t(CGAL::get_default_random().get_int(0, 10)))); - - PSC classifier (range, Pmap()); - classifier.generate_attributes (5, Nmap(), Cmap(), Emap()); - assert (classifier.number_of_scales() == 5); - - std::vector types; - types.push_back (classifier.add_classification_type ("type1")); - types.push_back (classifier.add_classification_type ("type2")); - types.push_back (classifier.add_classification_type ("type3")); - types.push_back (classifier.add_classification_type ("type4")); - types.push_back (classifier.add_classification_type ("type5")); - - for (std::size_t i = 0; i < 100; ++ i) - classifier.set_inlier (types[CGAL::get_default_random().get_int(0, types.size())], i); - - classifier.train(500); - - - std::ofstream fconfig ("config.xml"); - classifier.save_configuration (fconfig); - fconfig.close(); - - std::ofstream fclassif ("classif.ply"); - classifier.write_classification_to_ply(fclassif); - fclassif.close(); - - classifier.clear(); - - std::ifstream fconfig2 ("config.xml"); - assert (classifier.load_configuration (fconfig2, Nmap(), Cmap(), Emap())); - - - return EXIT_SUCCESS; -}