### Build and Run COLMAP C++ Example Source: https://context7.com/json87/spheresfm/llms.txt This bash script outlines the steps to build and run the C++ COLMAP example. It involves creating a build directory, configuring the build with CMake (specifying the COLMAP installation directory), compiling the project, and then executing the compiled program. ```bash # Build and run mkdir build && cd build COLMAP_DIR=/usr/local/share/colmap cmake .. make ./my_reconstructor --input_path ./sparse/0 --output_path ./modified ``` -------------------------------- ### GUI Launcher: Start COLMAP Graphical Interface Source: https://context7.com/json87/spheresfm/llms.txt Launches the COLMAP graphical user interface for interactive reconstruction. It can be started with or without loading an existing project. ```bash # Start GUI colmap gui ``` ```bash # Start GUI with existing project colmap gui \ --database_path ./project/database.db \ --image_path ./images \ --import_path ./project/sparse/0 ``` -------------------------------- ### Install NVIDIA Drivers on Ubuntu Source: https://github.com/json87/spheresfm/blob/main/docker/README.md Commands to identify and install the appropriate NVIDIA drivers on an Ubuntu host system if they are not already present. ```bash sudo apt install ubuntu-drivers-common sudo ubuntu-drivers autoinstall ubuntu-drivers devices sudo apt install nvidia-driver-455 ``` -------------------------------- ### Install COLMAP with CUDA and Tests on Linux using vcpkg Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Installs COLMAP on Linux with CUDA support and builds all associated tests using vcpkg. This ensures full functionality and validation. ```bash ./vcpkg install colmap[cuda,tests]:x64-linux ``` -------------------------------- ### Install COLMAP on Linux using vcpkg Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Installs COLMAP on a 64-bit Linux system using vcpkg. This command fetches and builds COLMAP and its dependencies from scratch. ```bash git clone https://github.com/microsoft/vcpkg cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg install colmap:x64-linux ``` -------------------------------- ### Install Desktop Entry for Linux/Unix Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt Installs the COLMAP.desktop file to the share/applications directory on Linux and Unix systems (excluding macOS). This allows the application to be integrated into the system's application menu. ```cmake if(UNIX AND NOT APPLE) install(FILES "doc/COLMAP.desktop" DESTINATION "share/applications") endif() ``` -------------------------------- ### Install COLMAP on Windows using vcpkg with CUDA Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Installs COLMAP and its dependencies on Windows using vcpkg, enabling CUDA support and building tests. This command assumes vcpkg is already cloned and bootstrapped. ```bash git clone https://github.com/microsoft/vcpkg cd vcpkg .\bootstrap-vcpkg.bat .\vcpkg install colmap[cuda,tests]:x64-windows ``` -------------------------------- ### COLMAP GUI Command Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Example of launching the COLMAP graphical user interface. The GUI provides a visual way to interact with COLMAP's functionalities. ```bash colmap gui ``` -------------------------------- ### Configure and Install CMake Configuration Files Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt This snippet configures and installs the main CMake configuration files (COLMAPConfig.cmake and COLMAPConfigVersion.cmake) into the share/colmap directory. These files are essential for enabling find_package() calls by other projects that depend on COLMAP. ```cmake configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/COLMAPConfig.cmake" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/COLMAPConfig.cmake" DESTINATION "share/colmap") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeConfigVersion.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/COLMAPConfigVersion.cmake" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/COLMAPConfigVersion.cmake" DESTINATION "share/colmap") ``` -------------------------------- ### Integrate COLMAP Library with CMake Source: https://github.com/json87/spheresfm/blob/main/doc/install.md This snippet demonstrates how to configure your CMake project to find, include, and link against the COLMAP library. It requires COLMAP to be installed and its CMake configuration accessible. The example shows setting C++ standard, include directories, library directories, and linking the executable against COLMAP. ```cmake cmake_minimum_required(VERSION 2.8.11) project(TestProject) find_package(COLMAP REQUIRED) # or to require a specific version: find_package(COLMAP 3.4 REQUIRED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") include_directories(${COLMAP_INCLUDE_DIRS}) link_directories(${COLMAP_LINK_DIRS}) add_executable(hello_world hello_world.cc) target_link_libraries(hello_world ${COLMAP_LIBRARIES}) ``` -------------------------------- ### Build COLMAP HTML Documentation Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Steps to build the HTML documentation for COLMAP using Python and Sphinx. This involves installing Python and Sphinx, navigating to the documentation directory, and running the 'make html' command. The generated documentation can then be opened in a web browser. ```bash cd path/to/colmap/doc sudo apt-get install python pip install sphinx make html open _build/html/index.html ``` -------------------------------- ### Verify Docker and NVIDIA Environment Source: https://github.com/json87/spheresfm/blob/main/docker/README.md Commands to check the installed versions of Docker and verify that the NVIDIA driver is correctly communicating with the host GPU. ```bash docker --version nvidia-smi ``` -------------------------------- ### Compile COLMAP on macOS using CMake and Make Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Clones the COLMAP repository, checks out the 'dev' branch, configures the build using CMake with Qt5 support, and compiles the project. Finally, it installs COLMAP to the system. ```bash git clone https://github.com/colmap/colmap.git cd colmap git checkout dev mkdir build cd build cmake .. -DQt5_DIR=/opt/homebrew/opt/qt@5/lib/cmake/Qt5 make sudo make install ``` -------------------------------- ### Install Latest COLMAP Commit from Dev Branch using vcpkg on Linux Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Installs the latest commit from the COLMAP development branch on Linux using vcpkg. The --head flag ensures that the most recent code is fetched and built. ```bash ./vcpkg install colmap:x64-linux --head ``` -------------------------------- ### Read and Write COLMAP Sparse Models Source: https://context7.com/json87/spheresfm/llms.txt Provides examples for loading COLMAP sparse reconstruction models, accessing camera intrinsics, image poses, and 3D points. It also demonstrates how to modify model data and export it back to binary or text formats. ```python import numpy as np from read_write_model import read_model, write_model, Camera, qvec2rotmat cameras, images, points3D = read_model("./project/sparse/0") for img_id, img in images.items(): R = qvec2rotmat(img.qvec) camera_center = -R.T @ img.tvec print(f"Image {img.name}: center={camera_center}") new_camera = Camera(id=max(cameras.keys()) + 1, model="SIMPLE_RADIAL", width=1920, height=1080, params=np.array([1500.0, 960.0, 540.0, 0.0])) cameras[new_camera.id] = new_camera write_model(cameras, images, points3D, "./project/sparse/modified", ext=".txt") ``` -------------------------------- ### Compile COLMAP CUDA Redistributables with vcpkg on Windows Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Installs COLMAP with CUDA redistributable support using vcpkg on Windows. This is useful for deploying applications that require CUDA but not the full CUDA toolkit. ```bash .\vcpkg install colmap[cuda-redist]:x64-windows ``` -------------------------------- ### COLMAP C++ Example with OptionManager Source: https://github.com/json87/spheresfm/blob/main/doc/install.md A basic C++ program that utilizes COLMAP utilities for command-line argument parsing and string formatting. It initializes Google Logging, defines required input and output paths using OptionManager, parses arguments, and prints a formatted string. This code is intended to be compiled and linked against the COLMAP library. ```cpp #include #include #include #include int main(int argc, char** argv) { colmap::InitializeGlog(argv); std::string input_path; std::string output_path; colmap::OptionManager options; options.AddRequiredOption("input_path", &input_path); options.AddRequiredOption("output_path", &output_path); options.Parse(argc, argv); std::cout << colmap::StringPrintf("Hello %s!", "COLMAP") << std::endl; return EXIT_SUCCESS; } ``` -------------------------------- ### Install Windows Batch Scripts Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt Conditionally installs COLMAP.bat and RUN_TESTS.bat to the root directory when the build system is Microsoft Visual C++ (MSVC). It specifies file permissions for owner, group, and world, ensuring appropriate access rights. ```cmake if(IS_MSVC) install(FILES "scripts/shell/COLMAP.bat" "scripts/shell/RUN_TESTS.bat" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION "/") endif() ``` -------------------------------- ### COLMAP C++ Library Usage Example Source: https://context7.com/json87/spheresfm/llms.txt This C++ code snippet demonstrates how to use the COLMAP library to load, process, and save a reconstruction. It utilizes the OptionManager for command-line arguments and the Reconstruction class for model I/O. ```cpp // main.cc - Example COLMAP library usage #include #include #include #include #include #include int main(int argc, char** argv) { colmap::InitializeGlog(argv); std::string input_path; std::string output_path; colmap::OptionManager options; options.AddRequiredOption("input_path", &input_path); options.AddRequiredOption("output_path", &output_path); options.Parse(argc, argv); // Load reconstruction colmap::Reconstruction reconstruction; reconstruction.Read(input_path); std::cout << "Loaded " << reconstruction.NumCameras() << " cameras" << std::endl; std::cout << "Loaded " << reconstruction.NumImages() << " images" << std::endl; std::cout << "Loaded " << reconstruction.NumPoints3D() << " 3D points" << std::endl; // Process reconstruction... reconstruction.Write(output_path); return EXIT_SUCCESS; } ``` -------------------------------- ### Configure and Add Uninstall Target Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt Configures the CMakeUninstall.cmake script and adds a custom 'uninstall' target. This target, when executed, runs the uninstallation script to remove installed files, providing a clean way to uninstall the project. ```cmake configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeUninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/CMakeUninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/CMakeUninstall.cmake) set_target_properties(uninstall PROPERTIES FOLDER ${CMAKE_TARGETS_ROOT_FOLDER}) ``` -------------------------------- ### Install Dependency Find Scripts Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt This CMake command installs all files matching the 'Find*.cmake' pattern from the cmake directory into the share/colmap destination. These scripts are used by CMake's find_package() command to locate and configure dependencies required by the project. ```cmake install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake DESTINATION share/colmap FILES_MATCHING PATTERN "Find*.cmake") ``` -------------------------------- ### Manage Qt5 Linkage for CMake Configuration on macOS Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Temporarily links the Qt5 installation to resolve potential conflicts when configuring CMake, especially if multiple Qt versions are present. This ensures CMake correctly finds the required Qt5 libraries. ```bash brew link qt5 cmake .. -DQt5_DIR=/opt/homebrew/opt/qt@5/lib/cmake/Qt5 brew unlink qt5 ``` -------------------------------- ### COLMAP Mapper Command Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Example of executing the mapper command in COLMAP. This command performs the core Structure-from-Motion reconstruction, estimating camera poses and a sparse 3D point cloud from extracted features and matches. ```bash colmap mapper --image_path IMAGES --database_path DATABASE --output_path MODEL ``` -------------------------------- ### Create Database for SphereSfM Project Source: https://context7.com/json87/spheresfm/llms.txt Initializes a new SQLite database file required to store project data including camera parameters, images, and feature matches. ```bash colmap database_creator --database_path ./project/database.db ls -la ./project/database.db ``` -------------------------------- ### Specify Project Configuration File Source: https://github.com/json87/spheresfm/blob/main/doc/tutorial.md Allows users to specify a project configuration file (.ini) containing options for either the GUI or CLI. ```bash colmap --project_path path/to/project.ini ``` -------------------------------- ### Manage COLMAP SQLite Database with Python Source: https://context7.com/json87/spheresfm/llms.txt Demonstrates how to connect to a COLMAP database, create tables, and populate it with camera, image, keypoint, descriptor, and geometric verification data. It also shows how to query the database for stored information. ```python import numpy as np from database import COLMAPDatabase, blob_to_array, array_to_blob db = COLMAPDatabase.connect("./project/database.db") db.create_tables() camera_id = db.add_camera( model=2, width=1920, height=1080, params=np.array([1500.0, 960.0, 540.0, 0.0]), prior_focal_length=True ) image_id1 = db.add_image("image001.jpg", camera_id) image_id2 = db.add_image("image002.jpg", camera_id) keypoints1 = np.random.rand(500, 2) * [1920, 1080] keypoints2 = np.random.rand(500, 2) * [1920, 1080] db.add_keypoints(image_id1, keypoints1.astype(np.float32)) db.add_keypoints(image_id2, keypoints2.astype(np.float32)) descriptors1 = np.random.randint(0, 255, (500, 128), dtype=np.uint8) descriptors2 = np.random.randint(0, 255, (500, 128), dtype=np.uint8) db.add_descriptors(image_id1, descriptors1) db.add_descriptors(image_id2, descriptors2) matches = np.array([[0, 5], [1, 10], [3, 15], [7, 20]], dtype=np.uint32) db.add_matches(image_id1, image_id2, matches) db.add_two_view_geometry( image_id1, image_id2, matches, F=np.eye(3), E=np.eye(3), H=np.eye(3), config=2 ) db.commit() db.close() ``` -------------------------------- ### Initialize NVIDIA Toolkit and COLMAP Container Source: https://github.com/json87/spheresfm/blob/main/docker/README.md Scripts to configure the NVIDIA container toolkit for specific Linux distributions and launch the COLMAP Docker environment with a mounted workspace. ```bash ./setup-ubuntu.sh ./setup-centos.sh ./quick-start.sh /path/to/your/working/folder ``` -------------------------------- ### COLMAP CLI Help Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Displays the general usage of the COLMAP CLI and lists all available commands. ```APIDOC ## COLMAP CLI Help ### Description Lists all available commands and provides general usage information for the COLMAP command-line interface. ### Method Command Line ### Endpoint N/A ### Parameters N/A ### Request Example ```bash $ colmap help ``` ### Response Lists available commands and usage instructions. ``` -------------------------------- ### Install COLMAP Dependencies on macOS with Homebrew Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Installs essential dependencies for COLMAP on macOS using the Homebrew package manager. These include git, cmake, boost, and various libraries required for COLMAP's functionality. ```bash brew install \ git \ cmake \ boost \ eigen \ freeimage \ flann \ glog \ gflags \ metis \ suite-sparse \ ceres-solver \ qt5 \ glew \ cgal \ sqlite3 ``` -------------------------------- ### Mapper: Initialize Reconstruction with Specific Images Source: https://context7.com/json87/spheresfm/llms.txt Initializes the sparse reconstruction process using specific initialization images. It requires a database, image path, and output path for the sparse reconstruction. ```bash colmap mapper \ --database_path ./project/database.db \ --image_path ./images \ --output_path ./project/sparse \ --Mapper.init_image_id1 1 \ --Mapper.init_image_id2 2 ``` -------------------------------- ### COLMAP Exhaustive Matcher Command Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Example of executing the exhaustive matcher command in COLMAP. This command finds correspondences between all pairs of images in the database, which is a crucial step for SfM. ```bash colmap exhaustive_matcher --database_path DATABASE ``` -------------------------------- ### Database Creator Source: https://context7.com/json87/spheresfm/llms.txt Initializes a new SQLite database for storing project data, including camera parameters, images, and feature matches. ```APIDOC ## CLI: database_creator ### Description Creates an empty SQLite database file with the required schema for storing camera information, images, keypoints, descriptors, and feature matches. ### Method CLI Command ### Parameters - **database_path** (string) - Required - Path to the output .db file. ### Request Example colmap database_creator --database_path ./project/database.db ``` -------------------------------- ### COLMAP Automatic Reconstructor Command Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Example of executing the automatic reconstructor command in COLMAP. This command automates a common SfM pipeline, taking image and workspace paths as input to generate a 3D reconstruction. ```bash colmap automatic_reconstructor --image_path IMAGES --workspace_path WORKSPACE ``` -------------------------------- ### Launch COLMAP GUI Source: https://github.com/json87/spheresfm/blob/main/doc/tutorial.md Launches the graphical user interface of COLMAP. Optionally, a project configuration file can be specified to pre-load settings. ```bash colmap gui ``` ```bash colmap gui --project_path path/to/project.ini ``` -------------------------------- ### COLMAP Command Help and Options Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Shows detailed usage information and available options for a specific COLMAP command. This helps in understanding the parameters required for tasks like feature extraction, including image paths, database paths, and specific extraction settings. ```bash $ colmap feature_extractor -h ``` -------------------------------- ### COLMAP Feature Extraction Command Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Example of executing the feature extraction command in COLMAP. This command processes images to detect and describe keypoints, storing the results in a database. It requires image and database paths as input. ```bash colmap feature_extractor --image_path IMAGES --database_path DATABASE ``` -------------------------------- ### Configure Patch Match Source Images Source: https://github.com/json87/spheresfm/blob/main/doc/faq.md Demonstrates how to manually define source images for stereo matching in the patch-match.cfg file. Each line specifies the target image followed by its corresponding source images. ```text image1.jpg image2.jpg, image3.jpg image2.jpg image1.jpg, image3.jpg image3.jpg image1.jpg, image2.jpg ``` -------------------------------- ### Build COLMAP PDF Documentation Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Instructions for generating the COLMAP documentation in PDF format. After navigating to the documentation directory, the 'make latexpdf' command is used to create the PDF output. The resulting PDF file can then be opened for viewing. ```bash make latexpdf open _build/pdf/COLMAP.pdf ``` -------------------------------- ### Configure CCACHE and Profiling Support (CMake) Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt Enables CCACHE for faster builds by setting CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER if ccache is found. It also enables profiling support by adding linker flags for 'profiler' and 'tcmalloc' if PROFILING_ENABLED is true. ```cmake if(CCACHE_ENABLED) find_program(CCACHE ccache) if(CCACHE) message(STATUS "Enabling ccache support") set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) else() message(STATUS "Disabling ccache support") endif() else() message(STATUS "Disabling ccache support") endif() if(PROFILING_ENABLED) message(STATUS "Enabling profiling support") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lprofiler -ltcmalloc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lprofiler -ltcmalloc") else() message(STATUS "Disabling profiling support") endif() ``` -------------------------------- ### COLMAP Command Help Source: https://github.com/json87/spheresfm/blob/main/doc/cli.md Displays detailed usage and options for a specific COLMAP command. ```APIDOC ## COLMAP Command Help ### Description Shows detailed usage instructions, available options, and parameters for a specific COLMAP command. Options can be set via the command line or a project configuration file. ### Method Command Line ### Endpoint N/A ### Parameters #### Path Parameters - **command** (string) - Required - The name of the COLMAP command for which to display help (e.g., `feature_extractor`). #### Query Parameters N/A #### Request Body N/A ### Request Example ```bash $ colmap feature_extractor -h ``` ### Response Detailed usage and options for the specified command. ``` -------------------------------- ### Enable GUI and OpenGL Support (CMake) Source: https://github.com/json87/spheresfm/blob/main/CMakeLists.txt Conditionally enables GUI support if GUI_ENABLED and Qt5_FOUND are true, defining DGUI_ENABLED. It also enables OpenGL support if OPENGL_ENABLED is true, defining DOPENGL_ENABLED. These flags control the availability of graphical interfaces and OpenGL features. ```cmake if(GUI_ENABLED AND Qt5_FOUND) add_definitions("-DGUI_ENABLED") message(STATUS "Enabling GUI support") else() message(STATUS "Disabling GUI support") endif() if(OPENGL_ENABLED) add_definitions("-DOPENGL_ENABLED") message(STATUS "Enabling OpenGL support") else() message(STATUS "Disabling OpenGL support") endif() ``` -------------------------------- ### Execute Model Alignment via COLMAP Source: https://github.com/json87/spheresfm/blob/main/doc/faq.md Demonstrates the command-line usage of the COLMAP model_aligner to perform 3D similarity transformation for geo-registration. ```bash colmap model_aligner \ --input_path /path/to/model \ --output_path /path/to/geo-registered-model \ --ref_images_path /path/to/text-file \ --ref_is_gps 1 \ --alignment_type ecef \ --robust_alignment 1 \ --robust_alignment_max_error 3.0 ``` -------------------------------- ### Patch Match Stereo: Compute Depth and Normal Maps Source: https://context7.com/json87/spheresfm/llms.txt Computes dense depth and normal maps using the patch match stereo algorithm. It requires the workspace path and format, and can be configured for geometric consistency and GPU usage. ```bash # Photometric stereo reconstruction colmap patch_match_stereo \ --workspace_path ./project/dense \ --workspace_format COLMAP \ --PatchMatchStereo.geom_consistency false ``` ```bash # Geometric consistency stereo colmap patch_match_stereo \ --workspace_path ./project/dense \ --workspace_format COLMAP \ --PatchMatchStereo.geom_consistency true \ --PatchMatchStereo.gpu_index 0 ``` -------------------------------- ### Build COLMAP with AddressSanitizer Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Instructions for compiling COLMAP with AddressSanitizer (ASan) enabled. This requires a recent compiler with ASan support, such as Clang. The command specifies the C and C++ compilers, enables ASan and tests, and sets the build type to RelWithDebInfo for better debugging information. It's recommended to combine ASan with debug symbols. ```bash CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake .. \ -DASAN_ENABLED=ON \ -DTESTS_ENABLED=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo ``` -------------------------------- ### Assemble Screencast Movie with FFmpeg Source: https://github.com/json87/spheresfm/blob/main/doc/gui.md Command to assemble individual frames into a video file using FFmpeg. This is typically used after capturing a screencast from COLMAP. ```bash ffmpeg -i frame%06d.png -r 30 -vf scale=1680:1050 movie.mp4 ``` -------------------------------- ### Bundle Adjuster: Refine Camera Poses and Points Source: https://context7.com/json87/spheresfm/llms.txt Runs global bundle adjustment to refine camera poses, 3D points, and other reconstruction parameters. Users can control which parameters are refined, such as focal length and extra parameters. ```bash # Refine reconstruction with bundle adjustment colmap bundle_adjuster \ --input_path ./project/sparse/0 \ --output_path ./project/sparse/refined \ --BundleAdjustment.refine_focal_length 1 \ --BundleAdjustment.refine_principal_point 0 \ --BundleAdjustment.refine_extra_params 1 ``` -------------------------------- ### Configure VLFeat Build System Source: https://github.com/json87/spheresfm/blob/main/lib/VLFeat/CMakeLists.txt Defines the list of source files for the VLFeat library and applies conditional compilation flags for SIMD instructions and OpenMP support. It handles platform-specific compiler flags for MSVC and GCC/Clang to enable hardware acceleration. ```cmake set(VLFEAT_SOURCE_FILES aib.c aib.h array.c array.h covdet.c covdet.h dsift.c dsift.h fisher.c fisher.h float.h generic.c generic.h getopt_long.c getopt_long.h gmm.c gmm.h heap-def.h hikmeans.c hikmeans.h hog.c hog.h homkermap.c homkermap.h host.c host.h ikmeans.c ikmeans.h ikmeans_elkan.tc ikmeans_init.tc ikmeans_lloyd.tc imopv.c imopv.h kdtree.c kdtree.h kmeans.c kmeans.h lbp.c lbp.h liop.c liop.h mathop.c mathop.h mser.c mser.h pgm.c pgm.h qsort-def.h quickshift.c quickshift.h random.c random.h rodrigues.c rodrigues.h scalespace.c scalespace.h shuffle-def.h sift.c sift.h slic.c slic.h stringop.c stringop.h svm.c svm.h svmdataset.c svmdataset.h vlad.c vlad.h) if(SIMD_ENABLED AND IS_X86) if (MSVC) add_definitions("-DVL_DISABLE_AVX") else() set(AVX_SOURCES mathop_avx.c mathop_avx.h) endif() set(SSE2_SOURCES imopv_sse2.c imopv_sse2.h mathop_sse2.c mathop_sse2.h) list(APPEND VLFEAT_SOURCE_FILES ${AVX_SOURCES} ${SSE2_SOURCES}) if (MSVC) set_source_files_properties(${AVX_SOURCES} PROPERTIES COMPILE_FLAGS "/arch:AVX") set_source_files_properties(${SSE2_SOURCES} PROPERTIES COMPILE_FLAGS "/arch:SSE2 /D__SSE2__") else() set_source_files_properties(${AVX_SOURCES} PROPERTIES COMPILE_FLAGS "-mavx") set_source_files_properties(${SSE2_SOURCES} PROPERTIES COMPILE_FLAGS "-msse2") endif() else() add_definitions("-DVL_DISABLE_AVX") add_definitions("-DVL_DISABLE_SSE2") endif() if(NOT OPENMP_ENABLED OR NOT OPENMP_FOUND) add_definitions("-DVL_DISABLE_OPENMP") endif() COLMAP_ADD_LIBRARY(vlfeat ${VLFEAT_SOURCE_FILES}) ``` -------------------------------- ### Build COLMAP from Source using vcpkg Toolchain File Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Configures and builds COLMAP from its source directory using a CMake toolchain file provided by vcpkg. This method is useful for integrating COLMAP into existing build systems or for custom build configurations. ```bash cd path/to/colmap mkdir build cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake cmake --build . --config release --target colmap_exe --parallel 24 ``` -------------------------------- ### Run COLMAP from Command Line or GUI Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Executes COLMAP, first by displaying its help message to show available commands and options, and then by launching the graphical user interface for interactive use. ```bash colmap -h colmap gui ``` -------------------------------- ### Build COLMAP on macOS using Python Build Script with Homebrew Qt5 Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Utilizes the Python build script to compile COLMAP on macOS, specifying the path to the Homebrew-installed Qt5. This method is an alternative to manual compilation or package managers. ```python python scripts/python/build.py \ --build_path path/to/colmap/build \ --colmap_path path/to/colmap \ --qt_path /usr/local/opt/qt ``` -------------------------------- ### Run Incremental Mapper Source: https://context7.com/json87/spheresfm/llms.txt Performs the incremental Structure from Motion process to compute the sparse 3D reconstruction from matched features. ```bash colmap mapper --database_path ./project/database.db --image_path ./images --output_path ./project/sparse --Mapper.ba_refine_focal_length 0 --Mapper.ba_refine_principal_point 0 --Mapper.ba_refine_extra_params 0 --Mapper.sphere_camera 1 colmap mapper --database_path ./project/database.db --image_path ./images --output_path ./project/sparse ``` -------------------------------- ### Register New Images into Existing Reconstruction (COLMAP) Source: https://github.com/json87/spheresfm/blob/main/doc/faq.md This process involves extracting features for new images, matching them to existing images in the database, and then registering them into the model. The bundle adjustment step is optional. The image list text file should contain one image file name per line. ```bash colmap feature_extractor \ --database_path $PROJECT_PATH/database.db \ --image_path $PROJECT_PATH/images \ --image_list_path /path/to/image-list.txt colmap vocab_tree_matcher \ --database_path $PROJECT_PATH/database.db \ --VocabTreeMatching.vocab_tree_path /path/to/vocab-tree.bin \ --VocabTreeMatching.match_list_path /path/to/image-list.txt colmap image_registrator \ --database_path $PROJECT_PATH/database.db \ --input_path /path/to/existing-model \ --output_path /path/to/model-with-new-images colmap bundle_adjuster \ --input_path /path/to/model-with-new-images \ --output_path /path/to/model-with-new-images ``` ```bash colmap mapper \ --database_path $PROJECT_PATH/database.db \ --image_path $PROJECT_PATH/images \ --input_path /path/to/existing-model \ --output_path /path/to/model-with-new-images ``` ```bash colmap mapper \ --database_path $PROJECT_PATH/database.db \ --image_path $PROJECT_PATH/images \ --output_path /path/to/model-with-new-images ``` -------------------------------- ### Build COLMAP on Windows using Python Build Script Source: https://github.com/json87/spheresfm/blob/main/doc/install.md Uses the automated Python build script to compile COLMAP and its dependencies on Windows. This script requires pre-installed CMake, Boost, Qt5, CUDA, and CGAL, with paths specified as arguments. ```python python scripts/python/build.py \ --build_path path/to/colmap/build \ --colmap_path path/to/colmap \ --boost_path "C:/local/boost_1_64_0/lib64-msvc-14.0" \ --qt_path "C:/Qt/5.9.3/msvc2015_64" \ --cuda_path "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0" \ --cgal_path "C:/dev/CGAL-4.11.2/build" ``` -------------------------------- ### Manual Source Image Specification Source: https://github.com/json87/spheresfm/blob/main/doc/faq.md Configure the `stereo/patch-match.cfg` file to manually select source images for dense reconstruction, either by count, all images, or specific image names. ```APIDOC ## Manual specification of source images during dense reconstruction You can change the number of source images in the `stereo/patch-match.cfg` file from e.g. `__auto__, 30` to `__auto__, 10`. This selects the images with the most visual overlap automatically as source images. You can also use all other images as source images, by specifying `__all__`. Alternatively, you can manually specify images with their name, for example: ```default image1.jpg image2.jpg, image3.jpg image2.jpg image1.jpg, image3.jpg image3.jpg image1.jpg, image2.jpg ``` Here, `image2.jpg` and `image3.jpg` are used as source images for `image1.jpg`, etc. ``` -------------------------------- ### Configure SiftGPU Library Build (CMake) Source: https://github.com/json87/spheresfm/blob/main/lib/SiftGPU/CMakeLists.txt This CMake script configures the build process for the SiftGPU library. It sets compiler flags, defines source files, and conditionally includes CUDA-specific sources if CUDA is enabled. Finally, it links the library with required dependencies like GLEW and OpenGL. ```cmake if(NOT IS_MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif() add_definitions("-DSIFTGPU_NO_DEVIL") set(SIFT_GPU_SOURCE_FILES FrameBufferObject.cpp FrameBufferObject.h GlobalUtil.cpp GlobalUtil.h GLTexImage.cpp GLTexImage.h ProgramGLSL.cpp ProgramGLSL.h ProgramGPU.h PyramidGL.cpp PyramidGL.h ShaderMan.cpp ShaderMan.h SiftGPU.cpp SiftGPU.h SiftMatch.cpp SiftMatch.h SiftPyramid.cpp SiftPyramid.h ) if(CUDA_ENABLED) add_definitions("-DCUDA_SIFTGPU_ENABLED") set(SIFT_GPU_SOURCE_FILES ${SIFT_GPU_SOURCE_FILES} CuTexImage.cpp CuTexImage.h ProgramCU.cu ProgramCU.h PyramidCU.cpp PyramidCU.h SiftMatchCU.cpp SiftMatchCU.h ) COLMAP_ADD_CUDA_LIBRARY(sift_gpu ${SIFT_GPU_SOURCE_FILES}) else() COLMAP_ADD_LIBRARY(sift_gpu ${SIFT_GPU_SOURCE_FILES}) endif() target_link_libraries(sift_gpu ${SIFT_GPU_LIBRARIES} ${GLEW_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ) ```