Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align by DGPS positions in images in SfmTransform - test with DJI drone images for example #1523

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ option(AV_BUILD_CLP "Enable building an embedded Clp" ON)
option(AV_BUILD_FLANN "Enable building an embedded Flann" ON)
option(AV_BUILD_PCL "Enable building an embedded PointCloud library" OFF)
option(AV_BUILD_USD "Enable building an embedded USD library" OFF)
option(AV_BUILD_GEOGRAPHIC "Enable building an embedded Geographic library" ON)
option(AV_BUILD_ALICEVISION "Enable building of AliceVision" ON)
option(AV_EIGEN_MEMORY_ALIGNMENT "Enable Eigen memory alignment" ON)

Expand Down Expand Up @@ -89,6 +90,7 @@ message(STATUS "AV_BUILD_CLP: ${AV_BUILD_CLP}")
message(STATUS "AV_BUILD_FLANN: ${AV_BUILD_FLANN}")
message(STATUS "AV_BUILD_PCL: ${AV_BUILD_PCL}")
message(STATUS "AV_BUILD_USD: ${AV_BUILD_USD}")
message(STATUS "AV_BUILD_GEOGRAPHIC: ${AV_BUILD_GEOGRAPHIC}")
message(STATUS "AV_BUILD_DEPENDENCIES_PARALLEL: ${AV_BUILD_DEPENDENCIES_PARALLEL}")
message(STATUS "")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
Expand Down Expand Up @@ -1099,6 +1101,30 @@ if(AV_BUILD_USD)
set(USD_CMAKE_FLAGS -Dpxr_DIR:PATH=${CMAKE_INSTALL_PREFIX})
endif()

IF(AV_BUILD_GEOGRAPHIC)
set(GEOGRAPHIC_TARGET GeographicLib)
ExternalProject_Add(${GEOGRAPHIC_TARGET}
GIT_REPOSITORY https://github.com/geographiclib/geographiclib.git
GIT_TAG v2.3
PREFIX ${BUILD_DIR}
BUILD_IN_SOURCE 0
BUILD_ALWAYS 0
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/geographic
BINARY_DIR ${BUILD_DIR}/geographic_build
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${CMAKE_CORE_BUILD_FLAGS}
-DBUILD_DOCUMENTATION=OFF
-DBUILD_MANPAGES=OFF
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> <SOURCE_DIR>
BUILD_COMMAND $(MAKE) -j${AV_BUILD_DEPENDENCIES_PARALLEL}
INSTALL_COMMAND $(MAKE) -j${AV_BUILD_DEPENDENCIES_PARALLEL} install
)
set(GEOGRAPHIC_CMAKE_FLAGS -DGeographic_DIR:PATH=${CMAKE_INSTALL_PREFIX})
endif()

set(AV_DEPS
${ZLIB_TARGET}
${ASSIMP_TARGET}
Expand Down Expand Up @@ -1128,6 +1154,7 @@ set(AV_DEPS
${OSI_TARGET}
${CLP_TARGET}
${USD_TARGET}
${GEOGRAPHIC_TARGET}
${FLANN_TARGET}
${LZ4_TARGET}
)
Expand Down
21 changes: 20 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ trilean_option(ALICEVISION_USE_ALEMBIC "Enable Alembic I/O" AUTO)
trilean_option(ALICEVISION_USE_UNCERTAINTYTE "Enable Uncertainty computation" AUTO)
trilean_option(ALICEVISION_USE_ONNX "Enable ONNX Runtime" AUTO)
trilean_option(ALICEVISION_USE_CUDA "Enable CUDA" ON)
trilean_option(ALICEVISION_USE_GEOGRAPHIC "Enable GeographicLib" ON)
trilean_option(ALICEVISION_USE_OPENCV "Enable use of OpenCV algorithms" OFF)
trilean_option(ALICEVISION_USE_OPENCV_CONTRIB "Enable use of OpenCV algorithms from extra modules" AUTO)
option(ALICEVISION_USE_OCVSIFT "Add or not OpenCV SIFT in available features" OFF)
Expand Down Expand Up @@ -267,7 +268,7 @@ set(ALICEVISION_BOOST_COMPONENTS atomic container date_time filesystem graph jso
if(ALICEVISION_BUILD_TESTS)
set(ALICEVISION_BOOST_COMPONENT_UNITTEST unit_test_framework)
endif()
find_package(Boost 1.60.0 QUIET COMPONENTS ${ALICEVISION_BOOST_COMPONENTS} ${ALICEVISION_BOOST_COMPONENT_UNITTEST})
find_package(Boost 1.80.0 QUIET COMPONENTS ${ALICEVISION_BOOST_COMPONENTS} ${ALICEVISION_BOOST_COMPONENT_UNITTEST})

if(Boost_FOUND)
message(STATUS "Boost ${Boost_LIB_VERSION} found.")
Expand Down Expand Up @@ -573,6 +574,23 @@ if(NOT ALICEVISION_USE_USD STREQUAL "OFF")
endif()
endif()

# ==============================================================================
# GeographicLib
# ==============================================================================
# - optional, used to convert to UTM coordinate system in SfmTransform
# ==============================================================================
set(ALICEVISION_HAVE_GEOGRAPHIC 0)

if(NOT ALICEVISION_USE_GEOGRAPHIC STREQUAL "OFF")
find_library(GeographicLib_LIBRARY NAMES Geographic GeographicLib DOC "GeographicLib library")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_library(GeographicLib_LIBRARY NAMES Geographic GeographicLib DOC "GeographicLib library")
find_package(GeographicLib CONFIG)

then the target GeographicLib::GeographicLib_SHARED can be used to express the dependency in the remaining cmake parts

if(GeographicLib_LIBRARY)
set(ALICEVISION_HAVE_GEOGRAPHIC 1)
message(STATUS "GeographicLib found.")
elseif(ALICEVISION_USE_GEOGRAPHIC STREQUAL "ON")
message(SEND_ERROR "Failed to find GeographicLib.")
endif()
endif()

# ==============================================================================
# OpenGV
# ==============================================================================
Expand Down Expand Up @@ -941,6 +959,7 @@ message("** Use PopSift feature extractor: " ${ALICEVISION_HAVE_POPSIFT})
message("** Use CCTAG markers: " ${ALICEVISION_HAVE_CCTAG})
message("** Use AprilTag markers: " ${ALICEVISION_HAVE_APRILTAG})
message("** Use OpenGV for rig localization: " ${ALICEVISION_HAVE_OPENGV})
message("** Use GeographicLib for Coordinate System Transformations: " ${ALICEVISION_HAVE_GEOGRAPHIC})
message("\n")

message(STATUS "EIGEN: " ${EIGEN_VERSION} "")
Expand Down
2 changes: 2 additions & 0 deletions src/cmake/AliceVisionConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ if(ALICEVISION_HAVE_OPENCV)
find_dependency(OpenCV)
endif()

SET(ALICEVISION_HAVE_GEOGRAPHIC @ALICEVISION_HAVE_GEOGRAPHIC@)

set(ALICEVISION_HAVE_OPENMP @ALICEVISION_HAVE_OPENMP@)

if(ALICEVISION_HAVE_OPENMP)
Expand Down
2 changes: 2 additions & 0 deletions src/cmake/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
#define ALICEVISION_HAVE_OPENGV() @ALICEVISION_HAVE_OPENGV@

#define ALICEVISION_HAVE_CUDA() @ALICEVISION_HAVE_CUDA@

#define ALICEVISION_HAVE_GEOGRAPHIC() @ALICEVISION_HAVE_GEOGRAPHIC@
2 changes: 1 addition & 1 deletion src/software/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Software PROPERTY FOLDER is 'Software/Utils'
set(FOLDER_SOFTWARE_UTILS "Software/Utils")


if(ALICEVISION_HAVE_CUDA)
alicevision_add_software(aliceVision_hardwareResources
SOURCE main_hardwareResources.cpp
Expand Down Expand Up @@ -194,6 +193,7 @@ alicevision_add_software(aliceVision_sfmTransform
aliceVision_sfmData
aliceVision_sfmDataIO
Boost::program_options
${GeographicLib_LIBRARY}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeographicLib_LIBRARY can be set to GeographicLib::GeographicLib_SHAREDif found or to empty string.

)

# SfM Regression
Expand Down
Loading