Skip to content

Commit

Permalink
Move related code under new image library folder (colmap#1995)
Browse files Browse the repository at this point in the history
* Move related code under new image library folder

* f
  • Loading branch information
ahojnnes authored Jul 2, 2023
1 parent af55137 commit 91068ea
Show file tree
Hide file tree
Showing 41 changed files with 101 additions and 64 deletions.
1 change: 1 addition & 0 deletions src/colmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ add_subdirectory(controllers)
add_subdirectory(estimators)
add_subdirectory(exe)
add_subdirectory(feature)
add_subdirectory(image)
add_subdirectory(mvs)
add_subdirectory(optim)
add_subdirectory(retrieval)
Expand Down
7 changes: 0 additions & 7 deletions src/colmap/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ COLMAP_ADD_SOURCES(
graph_cut.h graph_cut.cc
homography_matrix.h homography_matrix.cc
image.h image.cc
image_reader.h image_reader.cc
line.h line.cc
point2d.h point2d.cc
point3d.h point3d.cc
polynomial.h polynomial.cc
Expand All @@ -57,9 +55,7 @@ COLMAP_ADD_SOURCES(
similarity_transform.h similarity_transform.cc
track.h track.cc
triangulation.h triangulation.cc
undistortion.h undistortion.cc
visibility_pyramid.h visibility_pyramid.cc
warp.h warp.cc
)

COLMAP_ADD_TEST(camera_database_test camera_database_test.cc)
Expand All @@ -75,7 +71,6 @@ COLMAP_ADD_TEST(gps_test gps_test.cc)
COLMAP_ADD_TEST(graph_cut_test graph_cut_test.cc)
COLMAP_ADD_TEST(homography_matrix_utils_test homography_matrix_test.cc)
COLMAP_ADD_TEST(image_test image_test.cc)
COLMAP_ADD_TEST(line_test line_test.cc)
COLMAP_ADD_TEST(point2d_test point2d_test.cc)
COLMAP_ADD_TEST(point3d_test point3d_test.cc)
COLMAP_ADD_TEST(polynomial_test polynomial_test.cc)
Expand All @@ -87,6 +82,4 @@ COLMAP_ADD_TEST(scene_clustering_test scene_clustering_test.cc)
COLMAP_ADD_TEST(similarity_transform_test similarity_transform_test.cc)
COLMAP_ADD_TEST(track_test track_test.cc)
COLMAP_ADD_TEST(triangulation_test triangulation_test.cc)
COLMAP_ADD_TEST(undistortion_test undistortion_test.cc)
COLMAP_ADD_TEST(visibility_pyramid_test visibility_pyramid_test.cc)
COLMAP_ADD_TEST(warp_test warp_test.cc)
6 changes: 3 additions & 3 deletions src/colmap/base/cost_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class RelativePoseCostFunction {

inline void SetQuaternionManifold(ceres::Problem* problem, double* qvec) {
#if CERES_VERSION_MAJOR >= 3 || \
(CERES_VERSION_MAJOR == 2 && CERES_VERSION_MINOR >= 1)
(CERES_VERSION_MAJOR == 2 && CERES_VERSION_MINOR >= 1)
problem->SetManifold(qvec, new ceres::QuaternionManifold);
#else
problem->SetParameterization(qvec, new ceres::QuaternionParameterization);
Expand All @@ -308,7 +308,7 @@ inline void SetSubsetManifold(int size,
ceres::Problem* problem,
double* params) {
#if CERES_VERSION_MAJOR >= 3 || \
(CERES_VERSION_MAJOR == 2 && CERES_VERSION_MINOR >= 1)
(CERES_VERSION_MAJOR == 2 && CERES_VERSION_MINOR >= 1)
problem->SetManifold(params,
new ceres::SubsetManifold(size, constant_params));
#else
Expand All @@ -320,7 +320,7 @@ inline void SetSubsetManifold(int size,
template <int size>
inline void SetSphereManifold(ceres::Problem* problem, double* params) {
#if CERES_VERSION_MAJOR >= 3 || \
(CERES_VERSION_MAJOR == 2 && CERES_VERSION_MINOR >= 1)
(CERES_VERSION_MAJOR == 2 && CERES_VERSION_MINOR >= 1)
problem->SetManifold(params, new ceres::SphereManifold<size>);
#else
problem->SetParameterization(
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/base/reconstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "colmap/base/pose.h"
#include "colmap/base/projection.h"
#include "colmap/base/triangulation.h"
#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"
#include "colmap/util/misc.h"
#include "colmap/util/ply.h"

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/controllers/automatic_reconstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

#include "colmap/controllers/automatic_reconstruction.h"

#include "colmap/base/undistortion.h"
#include "colmap/controllers/incremental_mapper.h"
#include "colmap/feature/extraction.h"
#include "colmap/feature/matching.h"
#include "colmap/image/undistortion.h"
#include "colmap/mvs/fusion.h"
#include "colmap/mvs/meshing.h"
#include "colmap/mvs/patch_match.h"
Expand Down
4 changes: 2 additions & 2 deletions src/colmap/estimators/coordinate_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
#include "colmap/estimators/coordinate_frame.h"

#include "colmap/base/gps.h"
#include "colmap/base/line.h"
#include "colmap/base/pose.h"
#include "colmap/base/undistortion.h"
#include "colmap/estimators/utils.h"
#include "colmap/image/line.h"
#include "colmap/image/undistortion.h"
#include "colmap/optim/ransac.h"
#include "colmap/util/logging.h"
#include "colmap/util/misc.h"
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
#include "colmap/exe/feature.h"

#include "colmap/base/camera_models.h"
#include "colmap/base/image_reader.h"
#include "colmap/exe/gui.h"
#include "colmap/feature/extraction.h"
#include "colmap/feature/matching.h"
#include "colmap/image/reader.h"
#include "colmap/util/misc.h"
#include "colmap/util/opengl_utils.h"
#include "colmap/util/option_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef COLMAP_SRC_EXE_FEATURE_H_
#define COLMAP_SRC_EXE_FEATURE_H_

#include "colmap/base/image_reader.h"
#include "colmap/image/reader.h"

namespace colmap {

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include "colmap/exe/image.h"

#include "colmap/base/reconstruction.h"
#include "colmap/base/undistortion.h"
#include "colmap/controllers/incremental_mapper.h"
#include "colmap/image/undistortion.h"
#include "colmap/sfm/incremental_mapper.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ int RunModelAnalyzer(int argc, char** argv) {
<< std::endl;
}
}

return EXIT_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/feature/extraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#define COLMAP_SRC_FEATURE_EXTRACTION_H_

#include "colmap/base/database.h"
#include "colmap/base/image_reader.h"
#include "colmap/feature/sift.h"
#include "colmap/image/reader.h"
#include "colmap/util/opengl_utils.h"
#include "colmap/util/threading.h"

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/feature/sift.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "colmap/estimators/two_view_geometry.h"
#include "colmap/feature/types.h"
#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"

class SiftGPU;
class SiftMatchGPU;
Expand Down
45 changes: 45 additions & 0 deletions src/colmap/image/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2023, ETH Zurich and UNC Chapel Hill.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of ETH Zurich and UNC Chapel Hill nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

set(FOLDER_NAME "base")

COLMAP_ADD_SOURCES(
bitmap.h bitmap.cc
reader.h reader.cc
line.h line.cc
undistortion.h undistortion.cc
warp.h warp.cc
)

COLMAP_ADD_TEST(bitmap_test bitmap_test.cc)
COLMAP_ADD_TEST(line_test line_test.cc)
COLMAP_ADD_TEST(undistortion_test undistortion_test.cc)
COLMAP_ADD_TEST(warp_test warp_test.cc)
2 changes: 1 addition & 1 deletion src/colmap/util/bitmap.cc → src/colmap/image/bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"

#include "colmap/base/camera_database.h"
#include "colmap/util/logging.h"
Expand Down
6 changes: 3 additions & 3 deletions src/colmap/util/bitmap.h → src/colmap/image/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#ifndef COLMAP_SRC_UTIL_BITMAP_H_
#define COLMAP_SRC_UTIL_BITMAP_H_
#ifndef COLMAP_SRC_IMAGE_BITMAP_H_
#define COLMAP_SRC_IMAGE_BITMAP_H_

#include <algorithm>
#include <cmath>
Expand Down Expand Up @@ -290,4 +290,4 @@ bool Bitmap::IsGrey() const { return channels_ == 1; }

} // namespace colmap

#endif // COLMAP_SRC_UTIL_BITMAP_H_
#endif // COLMAP_SRC_IMAGE_BITMAP_H_
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#define TEST_NAME "util/bitmap"
#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"

#include "colmap/util/testing.h"

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/base/line.cc → src/colmap/image/line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/base/line.h"
#include "colmap/image/line.h"

#include "colmap/util/logging.h"

Expand Down
8 changes: 4 additions & 4 deletions src/colmap/base/line.h → src/colmap/image/line.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#ifndef COLMAP_SRC_BASE_LINE_H_
#define COLMAP_SRC_BASE_LINE_H_
#ifndef COLMAP_SRC_IMAGE_LINE_H_
#define COLMAP_SRC_IMAGE_LINE_H_

#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"

#include <Eigen/Core>

Expand All @@ -59,4 +59,4 @@ std::vector<LineSegmentOrientation> ClassifyLineSegmentOrientations(

} // namespace colmap

#endif // COLMAP_SRC_BASE_LINE_H_
#endif // COLMAP_SRC_IMAGE_LINE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#define TEST_NAME "base/line"
#include "colmap/base/line.h"
#include "colmap/image/line.h"

#include "colmap/util/testing.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/base/image_reader.h"
#include "colmap/image/reader.h"

#include "colmap/base/camera_models.h"
#include "colmap/util/misc.h"
Expand Down
8 changes: 4 additions & 4 deletions src/colmap/base/image_reader.h → src/colmap/image/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#ifndef COLMAP_SRC_BASE_IMAGE_READER_H_
#define COLMAP_SRC_BASE_IMAGE_READER_H_
#ifndef COLMAP_SRC_IMAGE_READER_H_
#define COLMAP_SRC_IMAGE_READER_H_

#include "colmap/base/database.h"
#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"
#include "colmap/util/threading.h"

#include <unordered_set>
Expand Down Expand Up @@ -130,4 +130,4 @@ class ImageReader {

} // namespace colmap

#endif // COLMAP_SRC_BASE_IMAGE_READER_H_
#endif // COLMAP_SRC_IMAGE_READER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/base/undistortion.h"
#include "colmap/image/undistortion.h"

#include "colmap/base/camera_models.h"
#include "colmap/base/pose.h"
#include "colmap/base/warp.h"
#include "colmap/image/warp.h"
#include "colmap/util/misc.h"

#include <fstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#ifndef COLMAP_SRC_BASE_UNDISTORTION_H_
#define COLMAP_SRC_BASE_UNDISTORTION_H_
#ifndef COLMAP_SRC_IMAGE_UNDISTORTION_H_
#define COLMAP_SRC_IMAGE_UNDISTORTION_H_

#include "colmap/base/reconstruction.h"
#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"
#include "colmap/util/misc.h"
#include "colmap/util/threading.h"

Expand Down Expand Up @@ -242,4 +242,4 @@ void RectifyAndUndistortStereoImages(const UndistortCameraOptions& options,

} // namespace colmap

#endif // COLMAP_SRC_BASE_UNDISTORTION_H_
#endif // COLMAP_SRC_IMAGE_UNDISTORTION_H_
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#define TEST_NAME "base/undistortion"
#include "colmap/base/undistortion.h"
#include "colmap/image/undistortion.h"

#include "colmap/base/pose.h"
#include "colmap/util/testing.h"
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/base/warp.cc → src/colmap/image/warp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/base/warp.h"
#include "colmap/image/warp.h"

#include "colmap/util/logging.h"

Expand Down
8 changes: 4 additions & 4 deletions src/colmap/base/warp.h → src/colmap/image/warp.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#ifndef COLMAP_SRC_BASE_WARP_H_
#define COLMAP_SRC_BASE_WARP_H_
#ifndef COLMAP_SRC_IMAGE_WARP_H_
#define COLMAP_SRC_IMAGE_WARP_H_

#include "colmap/base/camera.h"
#include "colmap/util/bitmap.h"
#include "colmap/image/bitmap.h"

namespace colmap {

Expand Down Expand Up @@ -88,4 +88,4 @@ void DownsampleImage(const float* data,

} // namespace colmap

#endif // COLMAP_SRC_BASE_WARP_H_
#endif // COLMAP_SRC_IMAGE_WARP_H_
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#define TEST_NAME "base/warp"
#include "colmap/base/warp.h"
#include "colmap/image/warp.h"

#include "colmap/util/random.h"
#include "colmap/util/testing.h"
Expand Down
Loading

0 comments on commit 91068ea

Please sign in to comment.