Skip to content

Commit

Permalink
Initial commit of TEASER++
Browse files Browse the repository at this point in the history
  • Loading branch information
chambbj committed Oct 15, 2020
1 parent fac3e82 commit 6b328d6
Show file tree
Hide file tree
Showing 8 changed files with 887 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ option(BUILD_PLUGIN_FBX
add_feature_info("FBX plugin" BUILD_PLUGIN_FBX
"add features that depend on FBX")

option(BUILD_PLUGIN_TEASER
"Choose if TEASER++ support should be built" FALSE)
add_feature_info("TEASER++ plugin" BUILD_PLUGIN_TEASER
"TEASER++ computes transformations between point sets")

option(BUILD_PLUGIN_TILEDB
"Choose if TileDB support should be built" FALSE)
add_feature_info("TileDB plugin" BUILD_PLUGIN_TILEDB
Expand Down
2 changes: 1 addition & 1 deletion cmake/unix_compiler_options.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function(pdal_target_compile_settings target)
set_property(TARGET ${target} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${target} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED TRUE)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
#
Expand Down
106 changes: 106 additions & 0 deletions doc/stages/filters.teaser.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
.. _filters.teaser:

filters.teaser
==============

The **TEASER filter** uses the Truncated least squares Estimation And
SEmidefinite Relaxation (TEASER) algorithm to calculate a **rigid**
transformation that best aligns two datasets. The first input to the ICP filter
is considered the "fixed" points, and all subsequent points are "moving"
points. The output from the filter are the "moving" points after the calculated
transformation has been applied, one point view per input. The transformation
matrix is inserted into the stage's metadata.


Examples
--------

.. code-block:: json
[
"fixed.las",
"moving.las",
{
"type": "filters.teaser"
},
"output.las"
]
To get the ``transform`` matrix, you'll need to use the ``--metadata`` option
from the pipeline command:

::

$ pdal pipeline teaser-pipeline.json --metadata teaser-metadata.json

The metadata output might start something like:

.. code-block:: json
{
"stages":
{
"filters.teaser":
{
"centroid": " 583394 5.2831e+06 498.152",
"composed": " 1 2.60209e-18 -1.97906e-09 -0.374999 8.9407e-08 1 5.58794e-09 -0.614662 6.98492e -10 -5.58794e-09 1 0.033234 0 0 0 1",
"converged": true,
"fitness": 0.01953125097,
"transform": " 1 2.60209e-18 -1.97906e-09 -0.375 8.9407e-08 1 5.58794e-09 -0.5625 6.98492e -10 -5.58794e-09 1 0.00411987 0 0 0 1"
}
To apply this transformation to other points, the ``centroid`` and
``transform`` metadata items can by used with ``filters.transformation`` in
another pipeline. First, move the centroid of the points to (0,0,0), then apply
the transform, then move the points back to the original location. For the
above metadata, the pipeline would be similar to:
.. code-block:: json
[
{
"type": "readers.las",
"filename": "in.las"
},
{
"type": "filters.transformation",
"matrix": "1 0 0 -583394 0 1 0 -5.2831e+06 0 0 1 -498.152 0 0 0 1"
},
{
"type": "filters.transformation",
"matrix": "1 2.60209e-18 -1.97906e-09 -0.375 8.9407e-08 1 5.58794e-09 -0.5625 6.98492e -10 -5.58794e-09 1 0.00411987 0 0 0 1"
},
{
"type": "filters.transformation",
"matrix": "1 0 0 583394 0 1 0 5.2831e+06 0 0 1 498.152 0 0 0 1"
},
{
"type": "writers.las",
"filename": "out.las"
}
]
.. note::
The ``composed`` metadata matrix is a composition of the three transformation steps outlined above, and can be used in a single call to ``filters.transformation`` as opposed to the three separate calls.
.. seealso::
:ref:`filters.transformation` to apply a transform to other points.
Options
--------
nr
Radius to use for normal estimation. [Default: **0.02**]
fr
Radius to use when computing features. [Default: **0.04**]
fpfh
Use FPFH to find correspondences? [Default: **true**]
.. include:: filter_opts.rst
4 changes: 4 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ if (BUILD_PLUGIN_FBX)
add_subdirectory(fbx)
endif()

if(BUILD_PLUGIN_TEASER)
add_subdirectory(teaser)
endif(BUILD_PLUGIN_TEASER)

if(BUILD_PLUGIN_TILEDB)
add_subdirectory(tiledb)
endif()
Expand Down
68 changes: 68 additions & 0 deletions plugins/teaser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#cmake_minimum_required(VERSION 3.1...3.15)
#project(pdalteaser)

find_package(OpenMP QUIET REQUIRED)
set_package_properties(OpenMP PROPERTIES
TYPE OPTIONAL
URL "https://www.openmp.org"
PURPOSE "TEASER++ support")
mark_as_advanced(CLEAR OpenMP_INCLUDE_DIRS)
mark_as_advanced(CLEAR OpenMP_LIBRARIES)
if(NOT OpenMP_CXX_FOUND)
message(FATAL_ERROR "This project requires the OpenMP library.")
endif()

find_package(teaserpp REQUIRED)
set_package_properties(teaserpp PROPERTIES
TYPE OPTIONAL
URL "https://teaser.readthedocs.io/en/latest/"
PURPOSE "TEASER++ support")
mark_as_advanced(CLEAR teaserpp_INCLUDE_DIRS)
mark_as_advanced(CLEAR teaserpp_LIBRARIES)
if (NOT teaserpp_FOUND)
message(FATAL_ERROR "This project requires the TEASER++ library.")
endif()

#find_package(PDAL REQUIRED CONFIG)
#if (NOT PDAL_FOUND)
# message(FATAL_ERROR "This project requires the PDAL library, and will not be compiled.")
#endif()

find_package(PCL 1.9 REQUIRED COMPONENTS common features kdtree)
set_package_properties(PCL PROPERTIES
TYPE OPTIONAL
URL "https://pointclouds.org/"
PURPOSE "TEASER++ support")
mark_as_advanced(CLEAR PCL_INCLUDE_DIRS)
mark_as_advanced(CLEAR PCL_LIBRARIES)
if (NOT PCL_FOUND)
message(FATAL_ERROR "This project requires the Point Cloud Library.")
endif()

#include_directories(${PDAL_INCLUDE_DIRS})
#add_library(pdal_plugin_filter_teaser SHARED TeaserFilter.cpp)
#link_directories(${PDAL_LIBRARY_DIRS})
#target_link_libraries(pdal_plugin_filter_teaser ${PDAL_LIBRARIES} teaserpp::teaser_registration teaserpp::teaser_features OpenMP::OpenMP_CXX ${PCL_LIBRARIES})

PDAL_ADD_PLUGIN(filter_libname filter teaser
FILES
filters/TeaserFilter.cpp
LINK_WITH
teaserpp::teaser_registration
teaserpp::teaser_features
OpenMP::OpenMP_CXX
${PCL_LIBRARIES}
INCLUDES
${CMAKE_CURRENT_LIST_DIR}
)

if (WITH_TESTS)
PDAL_ADD_TEST(pdal_filters_teaser_test
FILES
test/TeaserFilterTest.cpp
LINK_WITH
${filter_libname}
INCLUDES
"${PDAL_VENDOR_DIR}/eigen"
)
endif()

0 comments on commit 6b328d6

Please sign in to comment.