Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
8 changes: 7 additions & 1 deletion .azure-pipelines/build-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
ctestExclusions: "(mvs/colmap_mvs_gpu_mat_test)"
${{ if eq(parameters.asanEnabled, true) }}:
ctestExclusions: "(feature/colmap_feature_sift_test)|(util/colmap_util_opengl_utils_test)|(mvs/colmap_mvs_gpu_mat_test)"
${{ if eq(parameters.cmakeBuildType, 'ClangTidy') }}:
# Do not abort compilation in ClangTidy mode, so we see issues
# for all targets logged out to the console.
numAllowedNinjaErrors: 1000
${{ if ne(parameters.cmakeBuildType, 'ClangTidy') }}:
numAllowedNinjaErrors: 1
steps:
- script: |
sudo apt-get update && sudo apt-get install -y \
Expand Down Expand Up @@ -108,7 +114,7 @@ jobs:
-DTESTS_ENABLED=ON \
-DCMAKE_CUDA_ARCHITECTURES=50 \
-DASAN_ENABLED=${{ parameters.asanEnabled }}
ninja
ninja -k $(numAllowedNinjaErrors)
displayName: Configure and build

- ${{ if ne(parameters.cmakeBuildType, 'ClangTidy') }}:
Expand Down
3 changes: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Checks: >
performance-*,
concurrency-*,
cppcoreguidelines-virtual-class-destructor,
google-explicit-constructor,
google-build-using-namespace,
WarningsAsErrors: '*'
FormatStyle: 'file'
User: 'user'
4 changes: 3 additions & 1 deletion src/colmap/base/camera_rig_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestEmpty) {
CameraRig camera_rig;
Expand Down Expand Up @@ -329,3 +329,5 @@ BOOST_AUTO_TEST_CASE(TestComputeAbsolutePose) {
BOOST_CHECK_EQUAL(abs_qvec, ComposeIdentityQuaternion());
BOOST_CHECK_EQUAL(abs_tvec, Eigen::Vector3d(0, -1, -2));
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/camera_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "colmap/camera/models.h"
#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestEmpty) {
Camera camera;
Expand Down Expand Up @@ -381,3 +381,5 @@ BOOST_AUTO_TEST_CASE(TestRescale) {
BOOST_CHECK_EQUAL(camera.PrincipalPointX(), 2);
BOOST_CHECK_EQUAL(camera.PrincipalPointY(), 2);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/correspondence_graph_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

int FindNumTransitiveCorrespondences(const CorrespondenceGraph& graph,
const image_t image_id,
Expand Down Expand Up @@ -365,3 +365,5 @@ BOOST_AUTO_TEST_CASE(TestDuplicate) {
BOOST_CHECK_EQUAL(
correspondence_graph.NumCorrespondencesBetweenImages().at(pair_id), 3);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/cost_functions_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "colmap/camera/models.h"
#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestBundleAdjustmentCostFunction) {
std::unique_ptr<ceres::CostFunction> cost_function(
Expand Down Expand Up @@ -152,3 +152,5 @@ BOOST_AUTO_TEST_CASE(TestRelativePoseCostFunction) {
BOOST_CHECK(cost_function->Evaluate(parameters, residuals, nullptr));
BOOST_CHECK_EQUAL(residuals[0], 0.5);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/database_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestEmpty) {
DatabaseCache cache;
Expand Down Expand Up @@ -84,3 +84,5 @@ BOOST_AUTO_TEST_CASE(TestAddImage) {
BOOST_CHECK_EQUAL(
cache.CorrespondenceGraph().NumObservationsForImage(image.ImageId()), 0);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/database_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include <Eigen/Geometry>

using namespace colmap;
namespace colmap {

const static std::string kMemoryDatabasePath = ":memory:";

Expand Down Expand Up @@ -501,3 +501,5 @@ BOOST_AUTO_TEST_CASE(TestMerge) {
BOOST_CHECK_EQUAL(merged_database.NumDescriptors(), 0);
BOOST_CHECK_EQUAL(merged_database.NumMatches(), 0);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/essential_matrix_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include <Eigen/Geometry>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestDecomposeEssentialMatrix) {
const Eigen::Matrix3d R = EulerAnglesToRotationMatrix(0, 1, 1);
Expand Down Expand Up @@ -206,3 +206,5 @@ BOOST_AUTO_TEST_CASE(TestRefineEssentialMatrix) {

BOOST_CHECK_LE((E - E_refined).norm(), (E - E_pertubated).norm());
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/gps_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestEllToXYZGRS80) {
std::vector<Eigen::Vector3d> ell;
Expand Down Expand Up @@ -291,3 +291,5 @@ BOOST_AUTO_TEST_CASE(TestENUToXYZ) {
BOOST_CHECK(xyz[i].isApprox(ref_xyz[i], 1e-8));
}
}

} // namespace colmap
2 changes: 1 addition & 1 deletion src/colmap/base/graph_cut.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class MinSTGraphCut {
adjacency_list<boost::vecS, boost::vecS, boost::directedS, size_t, Edge>
graph_t;

MinSTGraphCut(const size_t num_nodes);
explicit MinSTGraphCut(const size_t num_nodes);

// Count the number of nodes and edges in the graph.
size_t NumNodes() const;
Expand Down
4 changes: 3 additions & 1 deletion src/colmap/base/graph_cut_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestComputeMinGraphCutStoerWagner) {
const std::vector<std::pair<int, int>> edges = {{3, 4},
Expand Down Expand Up @@ -276,3 +276,5 @@ BOOST_AUTO_TEST_CASE(TestMinSTGraphCut3) {
BOOST_CHECK(graph.IsConnectedToSink(1));
BOOST_CHECK(graph.IsConnectedToSink(2));
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/homography_matrix_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include <Eigen/Geometry>

using namespace colmap;
namespace colmap {

// Note that the test case values are obtained from OpenCV.
BOOST_AUTO_TEST_CASE(TestDecomposeHomographyMatrix) {
Expand Down Expand Up @@ -174,3 +174,5 @@ BOOST_AUTO_TEST_CASE(TestHomographyMatrixFromPosePlanarScene) {
H_ref << 2, 0, 0, 0, 1, 0, 0, 0, 1;
BOOST_CHECK_EQUAL(H, H_ref);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/image_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestDefault) {
Image image;
Expand Down Expand Up @@ -367,3 +367,5 @@ BOOST_AUTO_TEST_CASE(TestViewingDirection) {
Image image;
BOOST_CHECK(image.ViewingDirection().isApprox(Eigen::Vector3d(0, 0, 1)));
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/point2d_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestDefault) {
Point2D point2D;
Expand Down Expand Up @@ -70,3 +70,5 @@ BOOST_AUTO_TEST_CASE(TestPoint3DId) {
BOOST_CHECK_EQUAL(point2D.Point3DId(), kInvalidPoint3DId);
BOOST_CHECK_EQUAL(point2D.HasPoint3D(), false);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/point3d_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestDefault) {
Point3D point3D;
Expand Down Expand Up @@ -112,3 +112,5 @@ BOOST_AUTO_TEST_CASE(TestTrack) {
track.AddElement(0, 3);
BOOST_CHECK_EQUAL(point3D.Track().Length(), 2);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/polynomial_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

#define CHECK_EQUAL_RESULT(find_func1, coeffs1, find_func2, coeffs2) \
{ \
Expand Down Expand Up @@ -200,3 +200,5 @@ BOOST_AUTO_TEST_CASE(TestFindPolynomialRootsCompanionMatrixZeroSolution) {
ref_imag << 0, 0.651148, -0.651148, 0;
BOOST_CHECK(imag.isApprox(ref_imag, 1e-6));
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/pose_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include <Eigen/Core>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestCrossProductMatrix) {
BOOST_CHECK_EQUAL(CrossProductMatrix(Eigen::Vector3d(0, 0, 0)),
Expand Down Expand Up @@ -460,3 +460,5 @@ BOOST_AUTO_TEST_CASE(TestCheckCheirality) {
BOOST_CHECK(!CheckCheirality(R, t, points1, points2, &points3D));
BOOST_CHECK_EQUAL(points3D.size(), 0);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/projection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include <Eigen/Core>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestComposeProjectionMatrix) {
const Eigen::Matrix3d R = EulerAnglesToRotationMatrix(0, 1, 2);
Expand Down Expand Up @@ -220,3 +220,5 @@ BOOST_AUTO_TEST_CASE(TestHasPointPositiveDepth) {
HasPointPositiveDepth(proj_matrix, Eigen::Vector3d(0, 0, -1));
BOOST_CHECK(!check4);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/reconstruction_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#include <Eigen/Geometry>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestEmpty) {
ReconstructionManager reconstruction_manager;
Expand Down Expand Up @@ -81,3 +81,5 @@ BOOST_AUTO_TEST_CASE(TestClear) {
reconstruction_manager.Clear();
BOOST_CHECK_EQUAL(reconstruction_manager.Size(), 0);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/reconstruction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "colmap/camera/models.h"
#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

void GenerateReconstruction(const image_t num_images,
Reconstruction* reconstruction,
Expand Down Expand Up @@ -611,3 +611,5 @@ BOOST_AUTO_TEST_CASE(TestComputeMeanReprojectionError) {
reconstruction.Point3D(point3D_id1).SetError(2.0);
BOOST_CHECK_EQUAL(reconstruction.ComputeMeanReprojectionError(), 2.0);
}

} // namespace colmap
2 changes: 1 addition & 1 deletion src/colmap/base/scene_clustering.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SceneClustering {
std::vector<Cluster> child_clusters;
};

SceneClustering(const Options& options);
explicit SceneClustering(const Options& options);

void Partition(const std::vector<std::pair<image_t, image_t>>& image_pairs,
const std::vector<int>& num_inliers);
Expand Down
4 changes: 3 additions & 1 deletion src/colmap/base/scene_clustering_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include <set>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestEmpty) {
const std::vector<std::pair<image_t, image_t>> image_pairs;
Expand Down Expand Up @@ -160,3 +160,5 @@ BOOST_AUTO_TEST_CASE(TestThreeFlatClustersTwoOverlap) {
BOOST_CHECK(image_ids2.count(4));
BOOST_CHECK(image_ids2.count(5));
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/similarity_transform_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include <Eigen/Core>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestDefaultInitialization) {
const SimilarityTransform3 tform;
Expand Down Expand Up @@ -116,3 +116,5 @@ BOOST_AUTO_TEST_CASE(TestFromFile) {
BOOST_CHECK_LE(
(tform.Rotation() - Eigen::Vector4d(-0.5, 0.5, 0.5, 0.5)).norm(), 1e-6);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/track_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestTrackElement) {
TrackElement track_el;
Expand Down Expand Up @@ -135,3 +135,5 @@ BOOST_AUTO_TEST_CASE(TestCompress) {
track.Compress();
BOOST_CHECK_EQUAL(track.Elements().capacity(), 2);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/triangulation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include <Eigen/Core>

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestTriangulatePoint) {
std::vector<Eigen::Vector3d> points3D(6);
Expand Down Expand Up @@ -95,3 +95,5 @@ BOOST_AUTO_TEST_CASE(TestCalculateTriangulationAngle) {
0.019997333973,
1e-8);
}

} // namespace colmap
4 changes: 3 additions & 1 deletion src/colmap/base/visibility_pyramid_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/util/testing.h"

using namespace colmap;
namespace colmap {

BOOST_AUTO_TEST_CASE(TestDefault) {
VisibilityPyramid pyramid;
Expand Down Expand Up @@ -89,3 +89,5 @@ BOOST_AUTO_TEST_CASE(TestScore) {
2 * scores.sum() + 2 * scores.tail(scores.size() - 1).sum());
}
}

} // namespace colmap
Loading