Table of Contents
- Maximilian Pries — maxwell6q
- Bjørn Magnus Myrhaug — BjornMagnusM
- Nihal Suri — nihalsuri
This project requires OpenCV 4 (the CMake configuration expects the opencv4 layout). The project was developed and tested with OpenCV 4.x — we recommend OpenCV 4.5 or newer. It also depends on Eigen3 and requires CMake >= 3.10 and a C++20-capable compiler.
If you have a custom OpenCV installation, you can either set OpenCV_DIR when configuring CMake or enable the USE_LOCAL_OPENCV option in CMakeLists.txt and point OpenCV_DIR to your local OpenCV cmake folder.
Windows (recommended: vcpkg)
- Install vcpkg (if not installed):
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
- Install OpenCV and Eigen via vcpkg:
.\vcpkg\vcpkg.exe install opencv4:x64-windows eigen3:x64-windows
- Configure CMake to use the vcpkg toolchain (example from project root — adjust the path):
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build
Alternative (prebuilt OpenCV on Windows): download a prebuilt OpenCV package, extract it, and set OpenCV_DIR to the folder containing OpenCVConfig.cmake. Example:
cmake -S . -B build -DOpenCV_DIR="C:/path/to/opencv/build"
cmake --build build
Ubuntu / Debian
sudo apt update
sudo apt install -y libopencv-dev libeigen3-dev build-essential cmake
If you need a newer OpenCV than provided by your distribution, build OpenCV from source and set OpenCV_DIR to the build directory when running CMake.
Notes
- The top-level
CMakeLists.txtprovides an optionUSE_LOCAL_OPENCVfor pointing to a custom OpenCV installation. - The project uses C++20; ensure your compiler supports it.
# Create the build directory in the root of the project
mkdir build
cd build
# Configure the project using CMake
cmake ..
# Compile the project
make
# Run the executable
./VisualOdometry_Final
The above instructions will create a /results directory.
All contributors swear to follow these points with the utmost care:
- No usage of GLOBAL VARIABLES!
- Final project musn't have binary files included
- Usage of a single CMakeLists.txt with more add_executable commands
- Compile the code, and make sure it runs bug free before pushing
- Include guards to be added in Header file
- A header file musn't contain function definitions, only declerations!
- Never
#includea .cpp file - Never add absolute paths in code
- Always check command-line arguments, before processing them, use
std::cerrfor debugging purposes - Define GUI names as
constvariables - Don't mix more than one activity in a single function, for example
maxfiltershould only apply the filter, not visualize it as well - Pass by reference or pointer to be used in functions, for example
const cv::Mat& src - For the sake of clarity:
- No usage of namespaces
- Only camelCase to be used, fyi case guide
- When it comes to comments, follow only the the google c++ style guide