From f2da91be40e8310b77a7fb2d679f57da7acf54a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 29 Nov 2018 01:55:46 +0100 Subject: [PATCH] update after OpenGR update OpenGR HEAD = cbce48e030 --- Installation/cmake/modules/FindOpenGR.cmake | 17 +------ .../Point_set_processing_3/CMakeLists.txt | 1 - .../registration_with_OpenGR.cpp | 3 +- .../include/CGAL/OpenGR/align.h | 45 +++++++++++-------- 4 files changed, 31 insertions(+), 35 deletions(-) diff --git a/Installation/cmake/modules/FindOpenGR.cmake b/Installation/cmake/modules/FindOpenGR.cmake index 679b1340c9d..99cf68dc346 100644 --- a/Installation/cmake/modules/FindOpenGR.cmake +++ b/Installation/cmake/modules/FindOpenGR.cmake @@ -1,4 +1,4 @@ -if ( NOT (OpenGR_LIBRARIES AND OpenGR_INCLUDE_DIR) ) +if ( OpenGR_INCLUDE_DIR ) # look for headers if (NOT OpenGR_INCLUDE_DIR) @@ -13,21 +13,8 @@ if ( NOT (OpenGR_LIBRARIES AND OpenGR_INCLUDE_DIR) ) endif() endif() -# look for library - if (NOT OpenGR_LIBRARIES) - find_library(OpenGR_algo_LIBRARY - NAMES opengr_algo) - - if (NOT OpenGR_algo_LIBRARY) - message(STATUS "Can not find OpenGR libraries") - else() - message(STATUS "Found OpenGR algorithm library: ${OpenGR_algo_LIBRARY}") - set(OpenGR_LIBRARIES "${OpenGR_algo_LIBRARY}" CACHE PATH "OpenGR libraries") - endif() - endif() - endif() -if ( OpenGR_LIBRARIES AND OpenGR_INCLUDE_DIR ) +if ( OpenGR_INCLUDE_DIR ) set(OpenGR_FOUND ON) endif() diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index c93cdfe0b27..bbe1e6b9a21 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -84,7 +84,6 @@ if ( CGAL_FOUND ) if (OpenGR_FOUND) include_directories(SYSTEM ${OpenGR_INCLUDE_DIR}) create_single_source_cgal_program( "registration_with_OpenGR.cpp" ) - target_link_libraries("registration_with_OpenGR" PRIVATE ${OpenGR_LIBRARIES}) else() message(STATUS "NOTICE: registration_with_OpenGR requires OpenGR, and will not be compiled.") endif() diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp index e512cb36c60..570cf46d368 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp @@ -47,7 +47,8 @@ int main(int argc, const char** argv) input.close(); // OpenGR options - GlobalRegistration::Match4PCSOptions options; + CGAL::OpenGR::Options options; + bool overlap_OK = options.configureOverlap(0.7); if(!overlap_OK) { diff --git a/Point_set_processing_3/include/CGAL/OpenGR/align.h b/Point_set_processing_3/include/CGAL/OpenGR/align.h index 4e46fa4087d..f4b1a2c2f9a 100644 --- a/Point_set_processing_3/include/CGAL/OpenGR/align.h +++ b/Point_set_processing_3/include/CGAL/OpenGR/align.h @@ -25,8 +25,9 @@ #include -#include -#include +#include +#include +#include #include @@ -37,6 +38,11 @@ namespace CGAL { namespace OpenGR { +typedef gr::Match4pcsBase::OptionsType Options; + namespace internal { template set1, set2; std::vector normals1, normals2; - typedef GR::Sampling::UniformDistSampler SamplerType; - SamplerType sampler; + // TODO: see if should allow user to change those types + typedef Eigen::Matrix MatrixType; + typedef gr::UniformDistSampler SamplerType; + typedef gr::DummyTransformVisitor TrVisitorType; + typedef gr::Match4pcsBase MatcherType; - // prepare matcher ressources - GR::Match4PCSBase::MatrixType mat (GR::Match4PCSBase::MatrixType::Identity()); + MatrixType mat (MatrixType::Identity()); + SamplerType sampler; + TrVisitorType visitor; // copy points and normal const std::size_t nbpt1 = range1.size(); @@ -93,14 +106,11 @@ align(const PointRange1& range1, PointRange2& range2, // logger GR::Utils::Logger logger(GR::Utils::NoLog); - // TODO add alternative? - GR::MatchSuper4PCS matcher(options, logger); - // TODO: add as a named parameter? - GR::Match4PCSBase::DummyTransformVisitor visitor; - - // Match and return the score (estimated overlap or the LCP). + // matcher + MatcherType matcher(options, logger); double score = - matcher.ComputeTransformation(set1, &set2, mat, sampler, visitor ); + matcher.ComputeTransformation(set1, set2, mat, sampler, visitor); + gr::Utils::TransformPointCloud( set2, mat); CGAL_assertion(mat.coeff(3,0) == 0); CGAL_assertion(mat.coeff(3,1) == 0); @@ -137,7 +147,7 @@ align(const PointRange1& point_set_1, PointRange2& point_set_2, const NamedParameters1& np1, const NamedParameters2& np2) { namespace PSP = CGAL::Point_set_processing_3; - namespace GR = GlobalRegistration; + namespace GR = gr; using boost::choose_param; using boost::get_param; @@ -161,8 +171,7 @@ align(const PointRange1& point_set_1, PointRange2& point_set_2, PointMap1 point_map2 = choose_param(get_param(np2, internal_np::point_map), PointMap2()); NormalMap2 normal_map2 = choose_param(get_param(np2, internal_np::normal_map), NormalMap2()); - GR::Match4PCSOptions options = choose_param(get_param(np1, internal_np::opengr_options), - GR::Match4PCSOptions()); + Options options = choose_param(get_param(np1, internal_np::opengr_options), Options()); return internal::align(point_set_1, point_set_2, point_map1, point_map2,