Skip to content

Commit

Permalink
Remove uncertainty old code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien SERVANT authored and cbentejac committed Oct 25, 2023
1 parent 5438742 commit deb9633
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 384 deletions.
7 changes: 0 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ Other optional libraries can enable specific features (check "CMake Options" for
* Alembic (data I/O)
* CCTag (feature extraction/matching and localization on CPU or GPU)
* Cuda >= 11.0 (feature extraction and depth map computation)
* Magma (required for UncertaintyTE)
* Mosek >= 6 (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)
* PCL (Point Cloud Library) >= 1.12.1 for the registration module
* PopSift (feature extraction on GPU)
* UncertaintyTE (Uncertainty computation)
* Lemon >= 1.3

AliceVision also depends on some embedded libraries:
Expand Down Expand Up @@ -226,11 +224,6 @@ CMake Options
Enable GPU SIFT implementation.
`-DPopSift_DIR:PATH=/path/to/popsift/install/lib/cmake/PopSift` (where PopSiftConfig.cmake can be found)

* `ALICEVISION_USE_UNCERTAINTYTE` (default: `AUTO`)
Enable Uncertainty computation.
`-DUNCERTAINTYTE_DIR:PATH=/path/to/uncertaintyTE/install/` (where `inlude` and `lib` can be found)
`-DMAGMA_ROOT:PATH=/path/to/magma/install/` (where `inlude` and `lib` can be found)

* `ALICEVISION_USE_OPENCV` (default: `OFF`)
Build with openCV
`-DOpenCV_DIR:PATH=/path/to/opencv/install/share/OpenCV/` (where OpenCVConfig.cmake can be found)
Expand Down
28 changes: 0 additions & 28 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ trilean_option(ALICEVISION_USE_APRILTAG "Enable AprilTag markers" AUTO)
trilean_option(ALICEVISION_USE_POPSIFT "Enable GPU SIFT implementation" AUTO)
trilean_option(ALICEVISION_USE_OPENGV "Enable use of OpenGV algorithms" AUTO)
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_OPENCV "Enable use of OpenCV algorithms" OFF)
Expand Down Expand Up @@ -588,30 +587,6 @@ if(ALICEVISION_BUILD_SFM)

endif()

# ==============================================================================
# UncertaintyTE
# ==============================================================================
# - optional, only external and enabled only if ALICEVISION_USE_UNCERTAINTYTE is ON
# ==============================================================================
set(ALICEVISION_HAVE_UNCERTAINTYTE 0)

if(ALICEVISION_BUILD_SFM)
if(NOT ALICEVISION_USE_UNCERTAINTYTE STREQUAL "OFF")
find_package(UncertaintyTE)

if(UNCERTAINTYTE_FOUND)
set(ALICEVISION_HAVE_UNCERTAINTYTE 1)
message(STATUS "UncertaintyTE found.")
elseif(ALICEVISION_USE_UNCERTAINTYTE STREQUAL "ON")
message(SEND_ERROR "Failed to find UncertaintyTE.")
endif()
endif()

if(ALICEVISION_HAVE_UNCERTAINTYTE)
include_directories(${UNCERTAINTYTE_INCLUDE_DIR})
link_directories(${UNCERTAINTYTE_LIBRARY_DIR})
endif()
endif()

# ==============================================================================
# ZLIB
Expand Down Expand Up @@ -823,8 +798,6 @@ set(ALICEVISION_INCLUDE_DIRS
${LEMON_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
${UNCERTAINTYTE_INCLUDE_DIRS}
${MAGMA_INCLUDE_DIRS}
${FLANN_INCLUDE_DIRS}
${LP_INCLUDE_DIRS}
${COINUTILS_INCLUDE_DIRS}
Expand Down Expand Up @@ -924,7 +897,6 @@ message("** Build MVS part: " ${ALICEVISION_BUILD_MVS})
message("** Build AliceVision tests: " ${ALICEVISION_BUILD_TESTS})
message("** Build AliceVision documentation: " ${ALICEVISION_HAVE_DOC})
message("** Build AliceVision+OpenCV samples programs: " ${ALICEVISION_HAVE_OPENCV})
message("** Build UncertaintyTE: " ${ALICEVISION_HAVE_UNCERTAINTYTE})
message("** Build MeshSDFilter: " ${ALICEVISION_HAVE_MESHSDFILTER})
message("** Build Alembic exporter: " ${ALICEVISION_HAVE_ALEMBIC})
message("** Enable code coverage generation: " ${ALICEVISION_BUILD_COVERAGE})
Expand Down
2 changes: 0 additions & 2 deletions src/aliceVision/sfmData/SfMData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ void SfMData::clear()
_views.clear();
_intrinsics.clear();
_structure.clear();
_posesUncertainty.clear();
_landmarksUncertainty.clear();
constraints2d.clear();
rotationpriors.clear();

Expand Down
10 changes: 0 additions & 10 deletions src/aliceVision/sfmData/SfMData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ using Landmarks = HashMap<IndexT, Landmark>;
/// Define a collection of Rig
using Rigs = std::map<IndexT, Rig>;

/// Define uncertainty per pose
using PosesUncertainty = HashMap<IndexT, Vec6>;

/// Define uncertainty per landmark
using LandmarksUncertainty = HashMap<IndexT, Vec3>;

/// Define a collection of constraints
using Constraints2D = std::vector<Constraint2D>;

Expand All @@ -58,10 +52,6 @@ using RotationPriors = std::vector<RotationPrior>;
class SfMData
{
public:
/// Uncertainty per pose
PosesUncertainty _posesUncertainty;
/// Uncertainty per landmark
LandmarksUncertainty _landmarksUncertainty;
/// 2D Constraints
Constraints2D constraints2d;
/// Rotation priors
Expand Down
43 changes: 6 additions & 37 deletions src/aliceVision/sfmDataIO/AlembicExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct AlembicExporter::DataImpl
const sfmData::View& view,
const sfmData::CameraPose* pose = nullptr,
std::shared_ptr<camera::IntrinsicBase> intrinsic = nullptr,
const Vec6* uncertainty = nullptr,
Alembic::Abc::OObject* parent = nullptr);

Alembic::Abc::OArchive _archive;
Expand All @@ -87,7 +86,6 @@ void AlembicExporter::DataImpl::addCamera(const std::string& name,
const sfmData::View& view,
const sfmData::CameraPose* pose,
std::shared_ptr<camera::IntrinsicBase> intrinsic,
const Vec6* uncertainty,
Alembic::Abc::OObject* parent)
{
if (parent == nullptr)
Expand Down Expand Up @@ -253,13 +251,6 @@ void AlembicExporter::DataImpl::addCamera(const std::string& name,
ODoubleProperty(userProps, "mvg_fisheyeCircleRadius").set(intrinsicEquiCasted->getCircleRadius());
}

if (uncertainty)
{
std::vector<double> uncertaintyParams(uncertainty->data(), uncertainty->data() + 6);
ODoubleArrayProperty mvg_uncertaintyParams(userProps, "mvg_uncertaintyEigenValues");
mvg_uncertaintyParams.set(uncertaintyParams);
}

if (pose == nullptr || intrinsicCasted == nullptr)
{
// hide camera
Expand All @@ -284,10 +275,7 @@ void AlembicExporter::addSfM(const sfmData::SfMData& sfmData, ESfMData flagsPart

if (flagsPart & ESfMData::STRUCTURE)
{
const sfmData::LandmarksUncertainty noUncertainty;

addLandmarks(sfmData.getLandmarks(),
(flagsPart & ESfMData::LANDMARKS_UNCERTAINTY) ? sfmData._landmarksUncertainty : noUncertainty,
((flagsPart & ESfMData::OBSERVATIONS || flagsPart & ESfMData::OBSERVATIONS_WITH_FEATURES)),
(flagsPart & ESfMData::OBSERVATIONS_WITH_FEATURES));
}
Expand Down Expand Up @@ -328,9 +316,9 @@ void AlembicExporter::addSfMSingleCamera(const sfmData::SfMData& sfmData, const
(flagsPart & ESfMData::INTRINSICS) ? sfmData.getIntrinsicsharedPtr(view.getIntrinsicId()) : nullptr;

if (sfmData.isPoseAndIntrinsicDefined(&view) && (flagsPart & ESfMData::EXTRINSICS))
_dataImpl->addCamera(name, view, pose, intrinsic, nullptr, &_dataImpl->_mvgCameras);
_dataImpl->addCamera(name, view, pose, intrinsic, &_dataImpl->_mvgCameras);
else
_dataImpl->addCamera(name, view, pose, intrinsic, nullptr, &_dataImpl->_mvgCamerasUndefined);
_dataImpl->addCamera(name, view, pose, intrinsic, &_dataImpl->_mvgCamerasUndefined);
}

void AlembicExporter::addSfMCameraRig(const sfmData::SfMData& sfmData, IndexT rigId, const std::vector<IndexT>& viewIds, ESfMData flagsPart)
Expand Down Expand Up @@ -411,14 +399,11 @@ void AlembicExporter::addSfMCameraRig(const sfmData::SfMData& sfmData, IndexT ri
OBoolProperty(userProps, "mvg_rigPoseLocked").set(rigPoseLocked);
}
}
_dataImpl->addCamera(name, view, subPosePtr.get(), intrinsic, nullptr, &(rigObj.at(isReconstructed)));
_dataImpl->addCamera(name, view, subPosePtr.get(), intrinsic, &(rigObj.at(isReconstructed)));
}
}

void AlembicExporter::addLandmarks(const sfmData::Landmarks& landmarks,
const sfmData::LandmarksUncertainty& landmarksUncertainty,
bool withVisibility,
bool withFeatures)
void AlembicExporter::addLandmarks(const sfmData::Landmarks& landmarks, bool withVisibility, bool withFeatures)
{
if (landmarks.empty())
return;
Expand Down Expand Up @@ -521,30 +506,14 @@ void AlembicExporter::addLandmarks(const sfmData::Landmarks& landmarks,
OFloatArrayProperty(userProps, "mvg_visibilityFeatScale").set(featScale);
}
}
if (!landmarksUncertainty.empty())
{
std::vector<V3d> uncertainties;

std::size_t indexLandmark = 0;
for (sfmData::Landmarks::const_iterator itLandmark = landmarks.begin(); itLandmark != landmarks.end(); ++itLandmark, ++indexLandmark)
{
const IndexT idLandmark = itLandmark->first;
const Vec3& u = landmarksUncertainty.at(idLandmark);
uncertainties.emplace_back(u[0], u[1], u[2]);
}
// Uncertainty eigen values (x,y,z)
OV3dArrayProperty propUncertainty(userProps, "mvg_uncertaintyEigenValues");
propUncertainty.set(uncertainties);
}
}

void AlembicExporter::addCamera(const std::string& name,
const sfmData::View& view,
const sfmData::CameraPose* pose,
std::shared_ptr<camera::IntrinsicBase> intrinsic,
const Vec6* uncertainty)
std::shared_ptr<camera::IntrinsicBase> intrinsic)
{
_dataImpl->addCamera(name, view, pose, intrinsic, uncertainty);
_dataImpl->addCamera(name, view, pose, intrinsic);
}

void AlembicExporter::initAnimatedCamera(const std::string& cameraName, std::size_t startFrame)
Expand Down
5 changes: 1 addition & 4 deletions src/aliceVision/sfmDataIO/AlembicExporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class AlembicExporter
* @param[in] points The 3D points to add
*/
void addLandmarks(const sfmData::Landmarks& points,
const sfmData::LandmarksUncertainty& landmarksUncertainty = sfmData::LandmarksUncertainty(),
bool withVisibility = true,
bool withFeatures = true);

Expand All @@ -69,14 +68,12 @@ class AlembicExporter
* @param[in] view The corresponding view
* @param[in] pose The camera pose (nullptr if undefined)
* @param[in] intrinsic The camera intrinsic (nullptr if undefined)
* @param[in] uncertainty The camera uncertainty values (nullptr if undefined)
* @param[in,out] parent The Alembic parent node
*/
void addCamera(const std::string& name,
const sfmData::View& view,
const sfmData::CameraPose* pose = nullptr,
std::shared_ptr<camera::IntrinsicBase> intrinsic = nullptr,
const Vec6* uncertainty = nullptr);
std::shared_ptr<camera::IntrinsicBase> intrinsic = nullptr);

/**
* @brief Add a keyframe to the animated camera
Expand Down
7 changes: 2 additions & 5 deletions src/aliceVision/sfmDataIO/sfmDataIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ enum ESfMData
STRUCTURE = 8,
OBSERVATIONS = 16,
OBSERVATIONS_WITH_FEATURES = 32,
LANDMARKS_UNCERTAINTY = 64,
POSES_UNCERTAINTY = 128,
CONSTRAINTS2D = 256,
CONSTRAINTS2D = 64,

UNCERTAINTY = LANDMARKS_UNCERTAINTY | POSES_UNCERTAINTY,
ALL_DENSE = VIEWS | EXTRINSICS | INTRINSICS | STRUCTURE | OBSERVATIONS | CONSTRAINTS2D,
ALL = VIEWS | EXTRINSICS | INTRINSICS | STRUCTURE | OBSERVATIONS | OBSERVATIONS_WITH_FEATURES | UNCERTAINTY | CONSTRAINTS2D
ALL = VIEWS | EXTRINSICS | INTRINSICS | STRUCTURE | OBSERVATIONS | OBSERVATIONS_WITH_FEATURES | CONSTRAINTS2D
};

/// check that each pose have a valid intrinsic and pose id in the existing View ids
Expand Down
37 changes: 0 additions & 37 deletions src/cmake/FindMAGMA.cmake

This file was deleted.

76 changes: 0 additions & 76 deletions src/cmake/FindUncertaintyTE.cmake

This file was deleted.

Loading

0 comments on commit deb9633

Please sign in to comment.