|
1 | | -[Under Development] |
| 1 | +# Voxel-Forge |
2 | 2 |
|
3 | | -[I welcome Contributors to work on this project! :)] |
| 3 | +## **---Under Development---** |
| 4 | + |
| 5 | +## **I welcome Contributors to work on this project! :)** |
| 6 | + |
| 7 | + |
| 8 | +## About |
| 9 | + |
| 10 | +Voxel-Forge is a Qt-based application designed to create 3D models from a series of input images using Structure-from-Motion (SfM) and Multi-View Stereo (MVS) techniques. It integrates the powerful [OpenMVG](https://github.com/openMVG/openMVG) and [OpenMVS](https://github.com/cdcseacave/openMVS) libraries to perform the photogrammetry reconstruction pipeline within a user-friendly Qt interface. |
| 11 | + |
| 12 | +This version utilizes **library-based integration** via the [vcpkg](https://vcpkg.io/) C++ package manager for improved performance and a more streamlined build process. For executable based integration visit `legacy-executable` branch of this repository. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Download the Software |
| 17 | + |
| 18 | +* For `Linux` [https://example.com] |
| 19 | +* For `Windows` (coming soon on demand) - ***open for your contribution to make a windows build!*** |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Development Setup (Main Branch) |
| 24 | + |
| 25 | +### Frameworks Used |
| 26 | + |
| 27 | +* [`CMake`](https://cmake.org/) (v3.18+) as the build system generator. |
| 28 | +* [`Qt5`](https://www.qt.io/) for the Graphical User Interface. |
| 29 | +* [`vcpkg`](https://vcpkg.io/) as the C++ package manager to handle dependencies. |
| 30 | +* [`OpenMVG`](https://github.com/openMVG/openMVG) library for Structure-from-Motion. |
| 31 | +* [`OpenMVS`](https://github.com/cdcseacave/openMVS) library for Multi-View Stereo reconstruction. |
| 32 | +* [`Docker`](https://www.docker.com/) - will be upgrading to docker soon! |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Contributing / Building from Source |
| 37 | + |
| 38 | +### Prerequisites |
| 39 | + |
| 40 | +1. **C++ Compiler:** A C++17 compliant compiler (GCC, Clang, MSVC). |
| 41 | +2. **CMake:** Latest `stable` Version or use Version 4.1.2 (used by me while developing) |
| 42 | +3. **Git:** Required for cloning the repository and for vcpkg. |
| 43 | +4. **vcpkg:** The C++ package manager. |
| 44 | + * Clone and bootstrap vcpkg if you haven't already. Follow their [official getting started guide](https://github.com/microsoft/vcpkg#getting-started). Install it to a central location (e.g., `/home/user/vcpkg` or `C:\vcpkg`). |
| 45 | +5. **vcpkg System Build Tools:** vcpkg requires certain system tools to build some libraries from source. Install the common ones for Debian/Ubuntu if not already installed: |
| 46 | + ```bash |
| 47 | + sudo apt update && sudo apt install \ |
| 48 | + pkg-config \ |
| 49 | + bison \ |
| 50 | + autoconf \ |
| 51 | + autoconf-archive \ |
| 52 | + automake \ |
| 53 | + libtool \ |
| 54 | + linux-libc-dev \ |
| 55 | + libxcb1-dev \ |
| 56 | + libxcb-glx0-dev \ |
| 57 | + libxcb-icccm4-dev \ |
| 58 | + libxcb-image0-dev \ |
| 59 | + libxcb-keysyms1-dev \ |
| 60 | + libxcb-randr0-dev \ |
| 61 | + libxcb-render-util0-dev \ |
| 62 | + libxcb-render0-dev \ |
| 63 | + libxcb-shape0-dev \ |
| 64 | + libxcb-sync-dev \ |
| 65 | + libxcb-util-dev \ |
| 66 | + libxcb-xfixes0-dev \ |
| 67 | + libxcb-xinerama0-dev \ |
| 68 | + libxcb-xkb-dev \ |
| 69 | + libxkbcommon-x11-dev \ |
| 70 | + libx11-xcb-dev \ |
| 71 | + libgl1-mesa-dev \ |
| 72 | + libxrender-dev \ |
| 73 | + libxi-dev \ |
| 74 | + libxkbcommon-dev \ |
| 75 | + xutils-dev \ |
| 76 | + gfortran |
| 77 | + ``` |
| 78 | + |
| 79 | +* *Note: If vcpkg fails while building a specific library and explicitly asks for another system tool (like `flex`, `perl`, `nasm`), install it using your system's package manager (`apt`, `dnf`, `pacman`, `brew`, etc.) and ensure it's in your PATH.* |
| 80 | + |
| 81 | +### Build Steps |
| 82 | + |
| 83 | +1. **Clone the Repository:** |
| 84 | + ```bash |
| 85 | + git clone <your-repo-url> |
| 86 | + cd Voxel-Forge |
| 87 | + # ensure you are on the main branch |
| 88 | + git checkout main |
| 89 | + ``` |
| 90 | + |
| 91 | +2. **Configure with CMake:** |
| 92 | + * Create a build directory and navigate into it. |
| 93 | + * Run CMake, pointing it to your vcpkg installation's toolchain file. Replace `<path/to/vcpkg>` with the correct path. |
| 94 | + * vcpkg will automatically read the `vcpkg.json` file in the project root, then download and build all required dependencies (Qt, OpenMVG, OpenMVS, and their dependencies like Ceres, Eigen, Boost, etc.). **This initial step can take a significant amount of time (30-60+ minutes)!** |
| 95 | + ```bash |
| 96 | + mkdir build |
| 97 | + cd build |
| 98 | + cmake .. -DCMAKE_TOOLCHAIN_FILE=<path/to/vcpkg>/scripts/buildsystems/vcpkg.cmake -DVCPKG_CLEAN_AFTER_BUILD=ON |
| 99 | + ``` |
| 100 | + * ***Optional - Low Disk Space:*** If you encounter disk space issues during the long vcpkg build, you can try adding `-DVCPKG_CLEAN_AFTER_BUILD=ON` to the `cmake` command. This will remove temporary build files for each library after it's installed, reducing peak disk usage but potentially slowing down future partial rebuilds. |
| 101 | + |
| 102 | +3. **Compile the Project:** |
| 103 | + * Once CMake configuration is complete, build the Voxel-Forge application. |
| 104 | + ```bash |
| 105 | + cmake --build . |
| 106 | + ``` |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## Running |
| 111 | + |
| 112 | +The executable `Voxel-Forge` will be located inside the `build` directory. |
| 113 | + |
| 114 | +```bash |
| 115 | +./Voxel-Forge |
| 116 | +``` |
| 117 | + |
| 118 | + |
| 119 | +## Troubleshooting |
| 120 | +### OpenMVS Floating-Point Assertions |
| 121 | +- **Symptom**: In rare cases, particularly on certain Linux/GCC configurations, the reconstruction pipeline might crash during the dense reconstruction phase (DensifyPointCloud step internally) due to floating-point assertions within the OpenMVS library failing. |
| 122 | + |
| 123 | +- **Cause**: These assertions check for perfect normalization of vectors (norm(vec) == 1.0f) which can sometimes fail due to minor, harmless floating-point inaccuracies (e.g., result is 0.9999999f). |
| 124 | + |
| 125 | +- **Workaround (Advanced)**: If you encounter this, the standard workaround is to patch the OpenMVS library source code to comment out these specific assertions. This requires creating a vcpkg overlay port for OpenMVS: |
| 126 | + |
| 127 | + **Step 1.** Copy the existing ports/openmvs directory from your main vcpkg installation to a custom overlay directory (e.g., `<project-root>/vcpkg-overlays/openmvs`). |
| 128 | + |
| 129 | + **Step 2.** In the overlay directory, modify the portfile.cmake to apply a patch file that comments out the problematic ASSERT lines in DepthMap.cpp and DepthMap.h |
| 130 | + |
| 131 | + ```cpp |
| 132 | + // openMVS/libs/MVS/DepthMap.cpp -> DepthEstimator::ProcessPixel() |
| 133 | + ASSERT(ISEQUAL(norm(normalMap0(nx)), 1.f)); |
| 134 | +
|
| 135 | + // openMVS/libs/MVS/DepthMap.h -> inline void CorrectNormal(Normal& normal) const |
| 136 | + ASSERT(ISEQUAL(norm(normal), 1.f)); |
| 137 | +
|
| 138 | + // openMVS/libs/MVS/DepthMap.h -> inline Normal RandomNormal(const Point3f& viewRay) |
| 139 | + ASSERT(ISEQUAL(norm(normal), 1.f)); |
| 140 | + ``` |
| 141 | + |
| 142 | + **Step 3.** Tell CMake about your overlay directory when configuring: |
| 143 | + |
| 144 | + ```bash |
| 145 | + cmake .. -DCMAKE_TOOLCHAIN_FILE=... -DVCPKG_OVERLAY_PORTS=<project-root>/vcpkg-overlays |
| 146 | + ``` |
| 147 | + |
| 148 | + **Step 4.** Clean your build directory (`rm -rf build`) and re-run the CMake configuration and build steps. vcpkg will rebuild OpenMVS using your patched version. |
| 149 | + |
| 150 | + #### **_Note_**: Only apply this patch if you are actually experiencing these specific crashes. It generally doesn't affect the quality of the reconstruction. |
0 commit comments