openMVG openMVS 3-D Reconstruction

OPENMVG

With surface win10 64 bit Visual Studio 2017

install

https://github.com/openMVG/openMVG/blob/master/BUILD.md
Install git
https://git-scm.com/downloads
All defaults
Installation with vcpkg
win+R opens cmd input

cd c:/
mkdir openMVG_MVS
cd openMVG_MVS
git clone https://github.com/Microsoft/vcpkg

It means to create a new folder under C disk called openMVG_MVS and then git clone vcpkg in this folder.

cd vcpkg
bootstrap-vcpkg.bat

This is the download and compilation of vcpkg

vcpkg install openmvg[core,openmp]//error code

It's going to take a long time. Then the report was wrong.
Error: Building package openblas:x86-windows failed with: BUILD_FAILED
It was found that the default x86 was installed, but the computer was 64-bit, so the error was corrected.

vcpkg install openmvg[core,openmp]:x64-windows

Total elapsed time: 1.662 h took so long
Then add cmake to the system environment variable path
That is to say, add C: openMVG_MVS vcpkg downloads tools cmake-3.14.0-windows cmake-3.14.0-win32-x86 bin to the path.
Otherwise, when you execute the fifth sentence below, you will make a mistake and cmake will not be found.

cd ../
git clone --recursive https://github.com/openMVG/openMVG.git
mkdir openMVG_Build
cd openMVG_Build
cmake -DCMAKE_TOOLCHAIN_FILE=C:\openMVG_MVS\vcpkg/scripts/buildsystems/vcpkg.cmake ../openMVG/src/
cmake --build C:\openMVG_MVS\openMVG_Build

The last step before is to open the sln file in openmvg_build and compile F5 in visua studio, then press F5 to report that the system can't find the specified file ALL_BUILD, which is actually normal (because it has been compiled).
Then you can use openmvg's function by typing code on the command line.

That's how openmvg is installed

SFM pipeline

https://openmvg.readthedocs.io/en/latest/software/SfM/SfM/

cd c:/openmvg_mvs
mkdir example
cd example
mkdir images
mkdir matches
mkdir outReconstruction

Because it says three folders are better in the document, we get three folders.
Then Download
https://github.com/openMVG/ImageDataset_SceauxCastle
This is the sample image. Copy all the sample images to the image folder above.

Then start sfm pipeline

cd C:\openMVG_MVS\openMVG_Build\Windows-AMD64-\Debug

1 openMVG_main_SfMInit_ImageListing

openMVG_main_SfMInit_ImageListing -i C:\openMVG_MVS\example\images -d C:\openMVG_MVS\openMVG\src\openMVG\exif\sensor_width_database\sensor_width_camera_database.txt -o C:\openMVG_MVS\example\matches

- Following i is the location of the folder for the picture.
- d is followed by a file with camera parameters or something.
- o is the output folder

2 openMVG_main_ComputeFeatures

openMVG_main_ComputeFeatures -i C:\openMVG_MVS\example\matches\sfm_data.json -o C:\openMVG_MVS\example\matches

- i is followed by the sfm_data.json generated in the previous step.
- o is the output folder

3 openMVG_main_ComputeMatches

openMVG_main_ComputeMatches -i C:\openMVG_MVS\example\matches\sfm_data.json -o C:\openMVG_MVS\example\matches

- i is followed by sfm_data.json
- o is the output folder
Well... 'neato'was not found:'neato' is not a necessary solution as follows: https://github.com/openMVG/openMVG/issues/576

4 openMVG_main_IncrementalSfM

openMVG_main_IncrementalSfM -i C:\openMVG_MVS\example\matches\sfm_data.json -m C:\openMVG_MVS\example\matches\ -o C:\openMVG_MVS\example\outReconstruction

- i is followed by sfm_data.json
- Behind m is the matchs folder where the previous geometric matching information is stored
- o is the output folder

5 openMVG_main_ComputeSfM_DataColor

openMVG_main_ComputeSfM_DataColor -i C:\openMVG_MVS\example\outReconstruction\sfm_data.bin -o C:\openMVG_MVS\example\outReconstruction\sfm_data_color.ply

- i is the sfm_data.bin file under the outReconstruction folder
- o is output

6 openMVG_main_ComputeStructureFromKnownPoses

openMVG_main_ComputeStructureFromKnownPoses -i C:\openMVG_MVS\example\outReconstruction\sfm_data.bin -o C:\openMVG_MVS\example\outReconstruction\robustFitting.json -m C:\openMVG_MVS\example\matches

- sfm_data.bin file under the i outReconstruction folder
- m matches folder
- o Output

7 Colorized robust triangulation

This step does not appear in the sfm specification document of openmvg, but after looking at the code generated by one key of openmvs_sample
https://github.com/cdcseacave/openMVS_sample/blob/master/MvgMvs_Pipeline.py
Find that there is such a step in it, so add this step.
Why not just use this key to generate code?
google found that it seemed that windows system could not be used to report errors, so it came one step at a time.

openMVG_main_ComputeSfM_DataColor -i C:\openMVG_MVS\example\outReconstruction\robustFitting.json -o C:\openMVG_MVS\example\outReconstruction\robust_colorized.ply
The above document on the installation of openmvg and sfm pipeline concludes with the output of undistorted image at the end of the sfm pipeline, but for the same reason, after looking at the key generation code of openmvs_sample in step 7 above, I found that this step was not used, so I skipped the next step and started working on OpenMVS.

OpenMvs

Hmm... Installation code in windows environment on this website
https://github.com/cdcseacave/openMVS/wiki/Usage
There's a sentence missing from cmake... Causing problems that VCG can't find all the time, so look directly at the home page of the project. build.md Installation in this should be correct
https://github.com/cdcseacave/openMVS/blob/master/BUILD.md
Next is the code entered in cmd

cd C:\openMVG_MVS
mkdir OpenMvs

Next, install a lot of packages with vcpkg. Because vcpkg defaults to x86, there are two ways to install win64
1 After each package, add: x64-windows, such as the code that appeared when OpenMvg was installed before.

Vcpkg install openmvg [core, openmp]: x64-windows (just the example is not really the code to enter)

2 Set the environment variable VCPKG_DEFAULT_TRIPLET to x64-windows

I chose the second method to add to the system variables
Variable name: VCPKG_DEFAULT_TRIPLET
Variable value: x64-windows
(If you use the first method, it should be vcpkg install zlib:x64-windows boost-iostreams:x64-windows... balahbalah adds: x64-windows after everything

Then execute the following code

cd C:\openMVG_MVS\vcpkg
vcpkg install zlib boost-iostreams boost-program-options boost-system boost-serialization eigen3 cgal[core] opencv glew glfw3

It's going to take a long time.
Total elapsed time: 38.66 min

Continue

cd C:\openMVG_MVS
git clone https://github.com/cdcseacave/VCG.git
cd OpenMVS
git clone https://github.com/cdcseacave/openMVS.git src
mkdir build
cd build
cmake . ..\src -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=C:\openMVG_MVS\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DVCG_ROOT="C:\openMVG_MVS\VCG"

Then you can open OpenMVS.sln in C: openMVG_MVS OpenMvs build to compile in visual studio or you can

cmake --build C:\openMVG_MVS\OpenMvs\build

Then OpenMVS is installed...

Next, we need to convert the image information generated by the sfm pipeline of OpenMVG into mvs file.

Before that, create a new folder

cd C:\openMVG_MVS\example
mkdir MVS

1 Convert scene from OpenMVG

cd C:\openMVG_MVS\openMVG_Build\Windows-AMD64-\Debug

openMVG_main_openMVG2openMVS -i C:\openMVG_MVS\example\outReconstruction\sfm_data.bin -o C:\openMVG_MVS\example\MVS\scene.mvs -d C:\openMVG_MVS\example\MVS

There is a problem with scene.mvs. There is no way to display the correct scene.mvs can be displayed properly in the viewer.

Tags: Windows cmake github git

Posted on Fri, 02 Aug 2019 01:24:10 -0700 by mwasif