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

Use assimp as mesh importer and exporter #1090

Merged
merged 16 commits into from
Aug 9, 2021
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build-linux:
runs-on: ubuntu-latest
container:
image: alicevision/alicevision-deps:ci-2021-04-22-centos7-cuda10.2
image: alicevision/alicevision-deps:ci-2021-08-05-centos7-cuda10.2
env:
DEPS_INSTALL_DIR: /opt/AliceVision_install
BUILD_TYPE: Release
Expand Down Expand Up @@ -172,6 +172,7 @@ jobs:
openimageio[libraw,ffmpeg,freetype,opencv,gif,webp,opencolorio]
ceres[suitesparse,cxsparse]
tbb
assimp
# without "cuda" for now
vcpkgTriplet: x64-windows-release
# Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed' directory.
Expand Down
31 changes: 28 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ option(ALICEVISION_BUILD_DEPENDENCIES "Build all AliceVision dependencies" OFF)

option(AV_BUILD_CUDA "Enable building an embedded Cuda" OFF)
option(AV_BUILD_ZLIB "Enable building an embedded ZLIB" ON)
option(AV_BUILD_ASSIMP "Enable building an embedded ASSIMP" ON)
option(AV_BUILD_TIFF "Enable building an embedded Tiff" ON)
option(AV_BUILD_JPEG "Enable building an embedded Jpeg" ON)
option(AV_BUILD_PNG "Enable building an embedded Png" ON)
Expand Down Expand Up @@ -55,6 +56,7 @@ message(STATUS "ALICEVISION_BUILD_TESTS: ${ALICEVISION_BUILD_TESTS}")
message(STATUS "")
message(STATUS "AV_BUILD_CUDA: ${AV_BUILD_CUDA}")
message(STATUS "AV_BUILD_ZLIB: ${AV_BUILD_ZLIB}")
message(STATUS "AV_BUILD_ASSIMP: ${AV_BUILD_ASSIMP}")
message(STATUS "AV_BUILD_TIFF: ${AV_BUILD_TIFF}")
message(STATUS "AV_BUILD_JPEG: ${AV_BUILD_JPEG}")
message(STATUS "AV_BUILD_PNG: ${AV_BUILD_PNG}")
Expand Down Expand Up @@ -120,6 +122,26 @@ set(ZLIB_CMAKE_FLAGS -DZLIB_ROOT=${CMAKE_INSTALL_PREFIX})
endif()


if(AV_BUILD_ASSIMP)
set(ASSIMP_TARGET assimp)
set(ASSIMP_BUILD_OPTIONS -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF)
set(ASSIMP_AV_VERSION 5.0.1)
set(ASSIMP_FILENAME v${ASSIMP_AV_VERSION}.tar.gz)
ExternalProject_Add(${ASSIMP_TARGET}
URL https://github.com/assimp/assimp/archive/refs/tags/${ASSIMP_FILENAME}
DOWNLOAD_DIR ${BUILD_DIR}/download/assimp
PREFIX ${BUILD_DIR}
BUILD_IN_SOURCE 0
BUILD_ALWAYS 0
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/assimp
BINARY_DIR ${BUILD_DIR}/assimp_build
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${CMAKE_CORE_BUILD_FLAGS} ${ASSIMP_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> <SOURCE_DIR>
)
set(ASSIMP_CMAKE_FLAGS -DAssimp_DIR:PATH=${CMAKE_INSTALL_PREFIX}/lib/cmake/assimp-${ASSIMP_AV_VERSION})
endif()


# Add Geogram
if(WIN32)
set(VORPALINE_PLATFORM Win-vs-dynamic-generic)
Expand Down Expand Up @@ -199,8 +221,10 @@ set(EIGEN_DISABLE_ALIGN_FLAGS
"-DCMAKE_CXX_FLAGS:STRING=-DEIGEN_MAX_ALIGN_BYTES=0 -DEIGEN_MAX_STATIC_ALIGN_BYTES=0"
"-DCMAKE_C_FLAGS:STRING=-DEIGEN_MAX_ALIGN_BYTES=0 -DEIGEN_MAX_STATIC_ALIGN_BYTES=0")
ExternalProject_Add(${EIGEN_TARGET}
URL https://github.com/eigenteam/eigen-git-mirror/archive/3.3.7.tar.gz
URL_HASH MD5=77a2c934eaf35943c43ee600a83b72df
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.bz2
URL_HASH MD5=2d5a8dac126c4937fd94d5d10fcd7dd1
# URL https://gitlab.com/libeigen/eigen/-/archive/3.4-rc1/eigen-3.4-rc1.tar.bz2
# URL_HASH MD5=9a656206a91152c77fd9d16b24345688
DOWNLOAD_DIR ${BUILD_DIR}/download/eigen
PREFIX ${BUILD_DIR}
BUILD_IN_SOURCE 0
Expand Down Expand Up @@ -742,6 +766,7 @@ endif()

set(AV_DEPS
${ZLIB_TARGET}
${ASSIMP_TARGET}
${GEOGRAM_TARGET}
${CUDA_TARGET}
${TBB_TARGET}
Expand Down Expand Up @@ -772,7 +797,7 @@ ExternalProject_Add(aliceVision
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
BINARY_DIR ${BUILD_DIR}/aliceVision_build
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=ON -DTARGET_ARCHITECTURE=core -DALICEVISION_ROOT=${ALICEVISION_ROOT} -DALICEVISION_USE_ALEMBIC=ON -DMINIGLOG=ON -DALICEVISION_USE_CCTAG=${AV_BUILD_CCTAG} -DALICEVISION_USE_APRILTAG=${AV_BUILD_APRILTAG} -DALICEVISION_USE_OPENCV=${AV_BUILD_OPENCV} -DALICEVISION_USE_OPENGV=${AV_BUILD_OPENGV} -DALICEVISION_USE_POPSIFT=${AV_BUILD_POPSIFT} -DALICEVISION_USE_CUDA=${AV_USE_CUDA} -DALICEVISION_BUILD_DOC=OFF -DALICEVISION_BUILD_EXAMPLES=OFF ${ZLIB_CMAKE_FLAGS} ${EIGEN_CMAKE_FLAGS} ${OPENIMAGEIO_CMAKE_FLAGS} ${OPENEXR_CMAKE_FLAGS} ${BOOST_CMAKE_FLAGS} ${ALEMBIC_CMAKE_FLAGS} ${GEOGRAM_CMAKE_FLAGS} ${LAPACK_CMAKE_FLAGS} ${CERES_CMAKE_FLAGS} ${CUDA_CMAKE_FLAGS} ${POPSIFT_CMAKE_FLAGS} ${OPENGV_CMAKE_FLAGS} ${OPENCV_CMAKE_FLAGS} ${CCTAG_CMAKE_FLAGS} ${APRILTAG_CMAKE_FLAGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> <SOURCE_DIR>
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=ON -DTARGET_ARCHITECTURE=core -DALICEVISION_ROOT=${ALICEVISION_ROOT} -DALICEVISION_USE_ALEMBIC=ON -DMINIGLOG=ON -DALICEVISION_USE_CCTAG=${AV_BUILD_CCTAG} -DALICEVISION_USE_APRILTAG=${AV_BUILD_APRILTAG} -DALICEVISION_USE_OPENCV=${AV_BUILD_OPENCV} -DALICEVISION_USE_OPENGV=${AV_BUILD_OPENGV} -DALICEVISION_USE_POPSIFT=${AV_BUILD_POPSIFT} -DALICEVISION_USE_CUDA=${AV_USE_CUDA} -DALICEVISION_BUILD_DOC=OFF -DALICEVISION_BUILD_EXAMPLES=OFF ${ZLIB_CMAKE_FLAGS} ${ASSIMP_CMAKE_FLAGS} ${EIGEN_CMAKE_FLAGS} ${OPENIMAGEIO_CMAKE_FLAGS} ${OPENEXR_CMAKE_FLAGS} ${BOOST_CMAKE_FLAGS} ${ALEMBIC_CMAKE_FLAGS} ${GEOGRAM_CMAKE_FLAGS} ${LAPACK_CMAKE_FLAGS} ${CERES_CMAKE_FLAGS} ${CUDA_CMAKE_FLAGS} ${POPSIFT_CMAKE_FLAGS} ${OPENGV_CMAKE_FLAGS} ${OPENCV_CMAKE_FLAGS} ${CCTAG_CMAKE_FLAGS} ${APRILTAG_CMAKE_FLAGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> <SOURCE_DIR>
DEPENDS ${AV_DEPS}
)
endif()
Expand Down
47 changes: 26 additions & 21 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,39 @@ As AliceVision use some C++11 features you must have a c++11 ready compiler:
Dependencies
------------

AliceVision depends on:
AliceVision depends on external libraries:

* Boost >= 1.70.0
* Eigen >= 3.3.4
* Ceres >= 1.10.0
* Flann >= 1.8.4 (internal)
* CoinUtils >= 2.9.3 (internal)
* Coin-or linear programming (Clp) (internal)
* Open Solver Interface (Osi) >= 0.106.10 (internal)
* Lemon >= 1.3 (internal)
* OpenEXR >= 2.4.0
* OpenImageIO >= 2.1.0
* Geogram >= 1.5.4 (https://gforge.inria.fr/frs/?group_id=5833)
* MeshSDFilter (internal)
* OpenMesh (internal)
* zlib
* [Assimp >= 5.0.0](https://github.com/assimp/assimp)
* [Boost >= 1.70.0](https://www.boost.org)
* [Ceres >= 1.10.0](https://github.com/ceres-solver/ceres-solver)
* [Eigen >= 3.3.4](https://gitlab.com/libeigen/eigen)
* [Geogram >= 1.7.5](https://gforge.inria.fr/frs/?group_id=5833)
* [OpenEXR >= 2.4.0](https://github.com/AcademySoftwareFoundation/openexr)
* [OpenImageIO >= 2.1.0](https://github.com/OpenImageIO/oiio)
* [zlib](https://www.zlib.net)

Other optional libraries can enable specific features (check "CMake Options" for enabling them):

* OpenMP (enable multi-threading)
* Mosek 5 (linear programming)
* OpenCV >= 3.4.11 (feature extraction, calibration module, video IO), >= 4.5 for colorchecker (mcc)
* Alembic (data I/O)
* CCTag (feature extraction/matching and localization on CPU or GPU)
* PopSift (feature extraction on GPU)
* UncertaintyTE (Uncertainty computation)
* Magma (required for UncertaintyTE)
* Cuda >= 7.0 (feature extraction and depth map computation)
* Magma (required for UncertaintyTE)
* Mosek >= 5 (linear programming)
* OpenCV >= 3.4.11 (feature extraction, calibration module, video IO), >= 4.5 for colorchecker (mcc)
* OpenGV (rig calibration and localization)
* OpenMP (enable multi-threading)
* PopSift (feature extraction on GPU)
* UncertaintyTE (Uncertainty computation)

AliceVision also depends on some embedded libraries:

* CoinUtils >= 2.9.3 (internal)
* Coin-or linear programming (Clp) (internal)
* Flann >= 1.8.4 (internal)
* Lemon >= 1.3 (internal)
* MeshSDFilter (internal)
* OpenMesh (internal)
* Open Solver Interface (Osi) >= 0.106.10 (internal)

Building the project using vcpkg (recommended on Windows)
--------------------------------
Expand Down Expand Up @@ -100,6 +104,7 @@ vcpkg install ^
ceres[suitesparse,cxsparse] ^
cuda ^
tbb ^
assimp ^
--triplet x64-windows
```

Expand Down
1 change: 1 addition & 0 deletions docker/fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ cmake -P "opencv-prefix/src/opencv-stamp/download-opencv.cmake"
cmake -P "opencv_contrib-prefix/src/opencv_contrib-stamp/download-opencv_contrib.cmake"

cmake -P "external/src/alembic-stamp/download-alembic.cmake"
cmake -P "external/src/assimp-stamp/download-assimp.cmake"
cmake -P "external/src/boost-stamp/download-boost.cmake"
# cmake -P "external/src/ceres-stamp/download-ceres.cmake"
cmake -P "external/src/eigen-stamp/download-eigen.cmake"
Expand Down
9 changes: 9 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,15 @@ if(ALICEVISION_BUILD_SFM)
endif()
endif()


# ==============================================================================
# Assimp
# ==============================================================================
if(ALICEVISION_BUILD_MVS)
find_package(assimp REQUIRED)
message(STATUS "Assimp: ${ASSIMP_LIBRARIES}, ${ASSIMP_INCLUDE_DIRS}, ${ASSIMP_LIBRARY_DIRS}")
endif()

# ==============================================================================
# OpenCV
# ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/depthMap/RefineRc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ bool RefineRc::refinerc(bool checkIfExists)
ALICEVISION_LOG_DEBUG("Refine CUDA (rc: " << (_rc + 1) << " / " << _sp->mp->ncams << ")");

// generate default depthSimMap if rc has no tcam
if(_refineTCams.size() == 0 || _depths.empty())
if(_refineTCams.empty() || _depths.empty())
{
_depthSimMapOpt = new DepthSimMap(_rc, _sp->mp, 1, 1);
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/depthMap/SemiGlobalMatchingRc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ bool SemiGlobalMatchingRc::sgmrc(bool checkIfExists)
if(_sp->mp->verbose)
ALICEVISION_LOG_DEBUG("SGM (rc: " << (_rc + 1) << " / " << _sp->mp->ncams << ")");

if(_sgmTCams.size() == 0)
if(_sgmTCams.empty())
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/depthMap/cuda/PlaneSweepingCuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ float PlaneSweepingCuda::sweepPixelsToVolume(int nDepthsToSearch, StaticVector<u

long t1 = clock();

if((tcams->size() == 0) || (pixels->size() == 0)) {
if((tcams->empty()) || (pixels->empty())) {
return -1.0f;
}

Expand Down
4 changes: 2 additions & 2 deletions src/aliceVision/fuseCut/DelaunayGraphCut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,9 +1259,9 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector<int>& cams, const Po
continue;
}
const std::vector<int>& visCams = verticesAttrPrepare[vIndex].cams.getData();
if(visCams.size() == 0)
if(visCams.empty())
{
ALICEVISION_LOG_WARNING("BAD: visCams.size() == 0");
ALICEVISION_LOG_WARNING("BAD: visCams.empty()");
}
double maxAngle = 0.0;
for(int i: visCams)
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/fuseCut/OctreeTracks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ void OctreeTracks::trackStruct::addTrack(OctreeTracks::trackStruct* t)

int OctreeTracks::trackStruct::indexOf(int val)
{
if(cams.size() == 0)
if(cams.empty())
{
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/localization/VoctreeLocalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ void VoctreeLocalizer::getAllAssociations(const feature::MapRegionsPerDesc &quer
std::vector<voctree::DocMatch>& out_matchedImages,
const std::string& imagePath) const
{
assert(out_descTypes.size() == 0);
assert(out_descTypes.empty());

// A. Find the (visually) similar images in the database
// pass the descriptors through the vocabulary tree to get the visual words
Expand Down
2 changes: 2 additions & 0 deletions src/aliceVision/mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ alicevision_add_library(aliceVision_mesh
aliceVision_mvsUtils
Geogram::geogram
Boost::filesystem
assimp::assimp
PRIVATE_LINKS
aliceVision_system
Boost::boost
)

Loading