raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.42k stars 4.69k forks source link

My solution to make the project work on Windows #816

Open tecniuf opened 5 years ago

tecniuf commented 5 years ago

I've published it here (https://github.com/Phylliida/orbslam-windows/issues/17), but I think it will be useful in this repository as well.

These are the steps I have followed to make the project work. I have translated my instructions from Spanish to English with the translator: https://www.deepl.com/translator

INSTRUCTIONS

1º Install Visual Studio 14 2015: https://visualstudio.microsoft.com/es/vs/older-downloads/

2º Install CMake and add it to the path in the installer: https://cmake.org/download/

3º Download the project: https://github.com/Phylliida/orbslam-windows

4º Download OpenCV 3.1 (it can be version 3.X, but not 4) and when you run it, unzip it in a folder. Do not put a path with spaces. I put it in "C:/", but it wouldn't be bad to put it in the project in "orbslam-windows\Thirdparty". https://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.1.0/

5º Make the build with CMake as in the link. (The General procedure part is enough). https://perso.uclouvain.be/allan.barrea/opencv/cmake_config.html

6º Open the project in "C:\opencv\build" with Visual Studio 2015. Change from debug to release and second click on "Solution 'OpenCV'" and build the project.

7º In the document "orbslam-windows\Thirdparty\DBoW2\CakeLists.txt" and also in "orbslam-windows\CMakeLists.txt" comment this line:

find_package(OpenCV 3.0 QUIET)

and put this other one (put your route, the type of bar is important): find_package(OpenCV 3.0 REQUIRED PATHS "C:/opencv/build")

8º Follow the instructions step by step (except build mono_euroc): https://github.com/Phylliida/orbslam-windows

9º Copy all the content from "C:\opencv\build\bin\Release" to "orbslam-windows\Examples\Monocular\Release". You should also copy the OpenNI2.dll library. It can be found on the PC itself, in my case it appeared in "C:\Program Files\OpenNI2\Tools" among others.

10º Download the dataset "Machine Hall 01" (EuRoC): https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets Unzip it in a new folder "orbslam-windowsExamples\Monocular\datasets".

11º Unzip "orbslam-windows\Vocabulary\ORBvoc.txt.tar" in the same folder where it is located.

12º When opening it by console, the project failed with the error "Usage: ./mono_tum path_to_vocabulary path_to_settings path_to_image_folder path_to_times_file". With that error and the information from 4. Monocular Examples (https://github.com/raulmur/ORB_SLAM2), in "orbslam-windows\Examples\Monocular\mono_euroc.cc" I changed this (line 38):

if (argc != 5)
{
    cerr << endl << "Usage: ./mono_tum path_to_vocabulary path_to_settings path_to_image_folder path_to_times_file" << endl;
    return 1;
}

for this:

if (argc != 5)
{
    //cerr << endl << "Usage: ./mono_tum path_to_vocabulary path_to_settings path_to_image_folder path_to_times_file" << endl;
    //return 1;

    argv[0] = "..\\mono_tum.cc";
    argv[1] = "..\\..\\..\\Vocabulary\\ORBvoc.txt";
    argv[2] = "..\\EuRoC.yaml";
    argv[3] = "..\\datasets\\mav0\\cam0\\data";
    argv[4] = "..\\EuRoC_TimeStamps\\MH01.txt";
}

13º Build the mono_euroc project with what was indicated here: https://github.com/Phylliida/orbslam-windows

14º Open the example in "orbslam-windows\Examples\Monocular\Release\mono_euroc.exe".

KyuhoBae commented 4 years ago

This was really helpful for me. Thanks a lot.