mirror of https://github.com/CGAL/cgal
parent
5911cbc568
commit
f2da91be40
|
|
@ -1,4 +1,4 @@
|
||||||
if ( NOT (OpenGR_LIBRARIES AND OpenGR_INCLUDE_DIR) )
|
if ( OpenGR_INCLUDE_DIR )
|
||||||
|
|
||||||
# look for headers
|
# look for headers
|
||||||
if (NOT OpenGR_INCLUDE_DIR)
|
if (NOT OpenGR_INCLUDE_DIR)
|
||||||
|
|
@ -13,21 +13,8 @@ if ( NOT (OpenGR_LIBRARIES AND OpenGR_INCLUDE_DIR) )
|
||||||
endif()
|
endif()
|
||||||
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()
|
endif()
|
||||||
|
|
||||||
if ( OpenGR_LIBRARIES AND OpenGR_INCLUDE_DIR )
|
if ( OpenGR_INCLUDE_DIR )
|
||||||
set(OpenGR_FOUND ON)
|
set(OpenGR_FOUND ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ if ( CGAL_FOUND )
|
||||||
if (OpenGR_FOUND)
|
if (OpenGR_FOUND)
|
||||||
include_directories(SYSTEM ${OpenGR_INCLUDE_DIR})
|
include_directories(SYSTEM ${OpenGR_INCLUDE_DIR})
|
||||||
create_single_source_cgal_program( "registration_with_OpenGR.cpp" )
|
create_single_source_cgal_program( "registration_with_OpenGR.cpp" )
|
||||||
target_link_libraries("registration_with_OpenGR" PRIVATE ${OpenGR_LIBRARIES})
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: registration_with_OpenGR requires OpenGR, and will not be compiled.")
|
message(STATUS "NOTICE: registration_with_OpenGR requires OpenGR, and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ int main(int argc, const char** argv)
|
||||||
input.close();
|
input.close();
|
||||||
|
|
||||||
// OpenGR options
|
// OpenGR options
|
||||||
GlobalRegistration::Match4PCSOptions options;
|
CGAL::OpenGR::Options options;
|
||||||
|
|
||||||
bool overlap_OK = options.configureOverlap(0.7);
|
bool overlap_OK = options.configureOverlap(0.7);
|
||||||
if(!overlap_OK)
|
if(!overlap_OK)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
|
||||||
#include <super4pcs/algorithms/super4pcs.h>
|
#include <gr/algorithms/FunctorSuper4pcs.h>
|
||||||
#include <super4pcs/utils/geometry.h>
|
#include <gr/algorithms/PointPairFilter.h>
|
||||||
|
#include <gr/utils/geometry.h>
|
||||||
|
|
||||||
#include <Eigen/Dense>
|
#include <Eigen/Dense>
|
||||||
|
|
||||||
|
|
@ -37,6 +38,11 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace OpenGR {
|
namespace OpenGR {
|
||||||
|
|
||||||
|
typedef gr::Match4pcsBase<gr::FunctorSuper4PCS,
|
||||||
|
gr::DummyTransformVisitor,
|
||||||
|
gr::AdaptivePointFilter,
|
||||||
|
gr::AdaptivePointFilter::Options>::OptionsType Options;
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class Kernel,
|
template <class Kernel,
|
||||||
|
|
@ -50,20 +56,27 @@ double
|
||||||
align(const PointRange1& range1, PointRange2& range2,
|
align(const PointRange1& range1, PointRange2& range2,
|
||||||
PointMap1 point_map1, PointMap2 point_map2,
|
PointMap1 point_map1, PointMap2 point_map2,
|
||||||
VectorMap1 vector_map1, VectorMap2 vector_map2,
|
VectorMap1 vector_map1, VectorMap2 vector_map2,
|
||||||
GlobalRegistration::Match4PCSOptions& options)
|
Options& options)
|
||||||
{
|
{
|
||||||
typedef typename Kernel::Point_3 Point_3;
|
typedef typename Kernel::Point_3 Point_3;
|
||||||
typedef typename Kernel::Vector_3 Vector_3;
|
typedef typename Kernel::Vector_3 Vector_3;
|
||||||
namespace GR=GlobalRegistration;
|
namespace GR=gr;
|
||||||
|
|
||||||
std::vector<GR::Point3D> set1, set2;
|
std::vector<GR::Point3D> set1, set2;
|
||||||
std::vector<GR::Point3D::VectorType> normals1, normals2;
|
std::vector<GR::Point3D::VectorType> normals1, normals2;
|
||||||
|
|
||||||
typedef GR::Sampling::UniformDistSampler SamplerType;
|
// TODO: see if should allow user to change those types
|
||||||
SamplerType sampler;
|
typedef Eigen::Matrix<gr::Point3D::Scalar, 4, 4> MatrixType;
|
||||||
|
typedef gr::UniformDistSampler SamplerType;
|
||||||
|
typedef gr::DummyTransformVisitor TrVisitorType;
|
||||||
|
typedef gr::Match4pcsBase<gr::FunctorSuper4PCS,
|
||||||
|
TrVisitorType,
|
||||||
|
gr::AdaptivePointFilter,
|
||||||
|
gr::AdaptivePointFilter::Options> MatcherType;
|
||||||
|
|
||||||
// prepare matcher ressources
|
MatrixType mat (MatrixType::Identity());
|
||||||
GR::Match4PCSBase::MatrixType mat (GR::Match4PCSBase::MatrixType::Identity());
|
SamplerType sampler;
|
||||||
|
TrVisitorType visitor;
|
||||||
|
|
||||||
// copy points and normal
|
// copy points and normal
|
||||||
const std::size_t nbpt1 = range1.size();
|
const std::size_t nbpt1 = range1.size();
|
||||||
|
|
@ -93,14 +106,11 @@ align(const PointRange1& range1, PointRange2& range2,
|
||||||
// logger
|
// logger
|
||||||
GR::Utils::Logger logger(GR::Utils::NoLog);
|
GR::Utils::Logger logger(GR::Utils::NoLog);
|
||||||
|
|
||||||
// TODO add alternative?
|
// matcher
|
||||||
GR::MatchSuper4PCS matcher(options, logger);
|
MatcherType matcher(options, logger);
|
||||||
// TODO: add as a named parameter?
|
|
||||||
GR::Match4PCSBase::DummyTransformVisitor visitor;
|
|
||||||
|
|
||||||
// Match and return the score (estimated overlap or the LCP).
|
|
||||||
double score =
|
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,0) == 0);
|
||||||
CGAL_assertion(mat.coeff(3,1) == 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)
|
const NamedParameters1& np1, const NamedParameters2& np2)
|
||||||
{
|
{
|
||||||
namespace PSP = CGAL::Point_set_processing_3;
|
namespace PSP = CGAL::Point_set_processing_3;
|
||||||
namespace GR = GlobalRegistration;
|
namespace GR = gr;
|
||||||
using boost::choose_param;
|
using boost::choose_param;
|
||||||
using boost::get_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());
|
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());
|
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),
|
Options options = choose_param(get_param(np1, internal_np::opengr_options), Options());
|
||||||
GR::Match4PCSOptions());
|
|
||||||
|
|
||||||
return internal::align<Kernel>(point_set_1, point_set_2,
|
return internal::align<Kernel>(point_set_1, point_set_2,
|
||||||
point_map1, point_map2,
|
point_map1, point_map2,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue