Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for powerpc* #848

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ for:
# remove outdated versions
- vcpkg remove --outdated --recurse
# install dependencies
- vcpkg install --recurse --triplet %VCPKG_ARCH% zlib boost-iostreams boost-program-options boost-system boost-serialization eigen3 cgal[core] opencv vcglib glew glfw3
- vcpkg install --recurse --triplet %VCPKG_ARCH% zlib boost-iostreams boost-program-options boost-system boost-serialization eigen3 cgal[core] opencv glew glfw3
- cd "%APPVEYOR_BUILD_FOLDER%"
# preserve contents of selected directories and files across project builds
cache:
- 'C:\tools\vcpkg\installed'
build_script:
- if "%platform%"=="Win32" set CMAKE_ARCH=-A"x86"
- if "%platform%"=="x64" set CMAKE_ARCH=-A"x64"
- git clone https://github.com/cdcseacave/VCG.git
- mkdir bin && cd bin
- cmake -G"Visual Studio 16 2019" %CMAKE_ARCH% -DCMAKE_BUILD_TYPE=%Configuration% -DCMAKE_TOOLCHAIN_FILE="C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake" ..
- cmake -G"Visual Studio 16 2019" %CMAKE_ARCH% -DCMAKE_BUILD_TYPE=%Configuration% -DCMAKE_TOOLCHAIN_FILE="C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCG_ROOT="$APPVEYOR_BUILD_FOLDER/VCG" ..
- cmake --build . --target ALL_BUILD --config %Configuration% -- /maxcpucount:4
-
#------------------
Expand Down
2 changes: 1 addition & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ make && sudo make install
Library usage
-------------------

In order to use *OpenMVS* as a third-party libray in your project, first compile it as described above or simply use `vcpgk`:
In order to use *OpenMVS* as a third-party library in your project, first compile it as described above or simply use `vcpgk`:
```
vcpkg install openmvs
```
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PROJECT(OpenMVS)

SET(OpenMVS_MAJOR_VERSION 2)
SET(OpenMVS_MINOR_VERSION 0)
SET(OpenMVS_PATCH_VERSION 0)
SET(OpenMVS_PATCH_VERSION 1)
SET(OpenMVS_VERSION ${OpenMVS_MAJOR_VERSION}.${OpenMVS_MINOR_VERSION}.${OpenMVS_PATCH_VERSION})

# List configuration options
Expand Down
62 changes: 43 additions & 19 deletions MvgMvsPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
17. Fuse disparity-maps DensifyPointCloud

positional arguments:
input_dir the directory wich contains the pictures set.
output_dir the directory wich will contain the resulting files.
input_dir the directory which contains the pictures set.
output_dir the directory which will contain the resulting files.

optional arguments:
-h, --help show this help message and exit
Expand All @@ -54,6 +54,14 @@
Passthrough:
Option to be passed to command lines (remove - in front of option names)
e.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures
For example, running the script
[MvgMvsPipeline.py input_dir output_dir --steps 0 1 2 3 4 5 11 12 13 15 --1 p HIGH n 8 --3 n HNSWL2]
[--steps 0 1 2 3 4 5 11 12 13 15] runs only the desired steps
[--1 p HIGH n 8] where --1 refer to openMVG_main_ComputeFeatures,
p refers to describerPreset option and set to HIGH, and n refers
to numThreads and set to 8. The second step (Compute matches),
[--3 n HNSWL2] where --3 refer to openMVG_main_ComputeMatches,
n refers to nearest_matching_method option and set to HNSWL2
"""

import os
Expand All @@ -65,8 +73,10 @@

if sys.platform.startswith('win'):
PATH_DELIM = ';'
FOLDER_DELIM = '\\'
else:
PATH_DELIM = ':'
FOLDER_DELIM = '/'

# add this script's directory to PATH
os.environ['PATH'] += PATH_DELIM + os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -188,37 +198,37 @@ def __init__(self):
["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]],
["Compute features", # 1
os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"),
["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]],
["-i", "%matches_dir%"+FOLDER_DELIM+"sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]],
["Compute pairs", # 2
os.path.join(OPENMVG_BIN, "openMVG_main_PairGenerator"),
["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%/pairs.bin"]],
["-i", "%matches_dir%"+FOLDER_DELIM+"sfm_data.json", "-o", "%matches_dir%"+FOLDER_DELIM+"pairs.bin"]],
["Compute matches", # 3
os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"),
["-i", "%matches_dir%/sfm_data.json", "-p", "%matches_dir%/pairs.bin", "-o", "%matches_dir%/matches.putative.bin", "-n", "AUTO"]],
["-i", "%matches_dir%"+FOLDER_DELIM+"sfm_data.json", "-p", "%matches_dir%"+FOLDER_DELIM+"pairs.bin", "-o", "%matches_dir%"+FOLDER_DELIM+"matches.putative.bin", "-n", "AUTO"]],
["Filter matches", # 4
os.path.join(OPENMVG_BIN, "openMVG_main_GeometricFilter"),
["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%/matches.putative.bin", "-o", "%matches_dir%/matches.f.bin"]],
["-i", "%matches_dir%"+FOLDER_DELIM+"sfm_data.json", "-m", "%matches_dir%"+FOLDER_DELIM+"matches.putative.bin", "-o", "%matches_dir%"+FOLDER_DELIM+"matches.f.bin"]],
["Incremental reconstruction", # 5
os.path.join(OPENMVG_BIN, "openMVG_main_SfM"),
["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%", "-s", "INCREMENTAL"]],
["-i", "%matches_dir%"+FOLDER_DELIM+"sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%", "-s", "INCREMENTAL"]],
["Global reconstruction", # 6
os.path.join(OPENMVG_BIN, "openMVG_main_SfM"),
["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%", "-s", "GLOBAL", "-M", "%matches_dir%/matches.e.bin"]],
["-i", "%matches_dir%"+FOLDER_DELIM+"sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%", "-s", "GLOBAL", "-M", "%matches_dir%"+FOLDER_DELIM+"matches.e.bin"]],
["Colorize Structure", # 7
os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"),
["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%reconstruction_dir%/colorized.ply"]],
["-i", "%reconstruction_dir%"+FOLDER_DELIM+"sfm_data.bin", "-o", "%reconstruction_dir%"+FOLDER_DELIM+"colorized.ply"]],
["Structure from Known Poses", # 8
os.path.join(OPENMVG_BIN, "openMVG_main_ComputeStructureFromKnownPoses"),
["-i", "%reconstruction_dir%/sfm_data.bin", "-m", "%matches_dir%", "-f", "%matches_dir%/matches.f.bin", "-o", "%reconstruction_dir%/robust.bin"]],
["-i", "%reconstruction_dir%"+FOLDER_DELIM+"sfm_data.bin", "-m", "%matches_dir%", "-f", "%matches_dir%"+FOLDER_DELIM+"matches.f.bin", "-o", "%reconstruction_dir%"+FOLDER_DELIM+"robust.bin"]],
["Colorized robust triangulation", # 9
os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"),
["-i", "%reconstruction_dir%/robust.bin", "-o", "%reconstruction_dir%/robust_colorized.ply"]],
["-i", "%reconstruction_dir%"+FOLDER_DELIM+"robust.bin", "-o", "%reconstruction_dir%"+FOLDER_DELIM+"robust_colorized.ply"]],
["Control Points Registration", # 10
os.path.join(OPENMVG_BIN, "ui_openMVG_control_points_registration"),
["-i", "%reconstruction_dir%/sfm_data.bin"]],
["-i", "%reconstruction_dir%"+FOLDER_DELIM+"sfm_data.bin"]],
["Export to openMVS", # 11
os.path.join(OPENMVG_BIN, "openMVG_main_openMVG2openMVS"),
["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "\"%mvs_dir%/scene.mvs\"", "-d", "\"%mvs_dir%/images\""]],
["-i", "%reconstruction_dir%"+FOLDER_DELIM+"sfm_data.bin", "-o", "%mvs_dir%"+FOLDER_DELIM+"scene.mvs", "-d", "%mvs_dir%"+FOLDER_DELIM+"images"]],
["Densify point cloud", # 12
os.path.join(OPENMVS_BIN, "DensifyPointCloud"),
["scene.mvs", "--dense-config-file", "Densify.ini", "--resolution-level", "1", "--number-views", "8", "-w", "\"%mvs_dir%\""]],
Expand Down Expand Up @@ -259,6 +269,15 @@ def apply_conf(self, conf):
o2.append(co)
s[2] = o2

def replace_opt(self, idx, str_exist, str_new):
""" replace each existing str_exist with str_new per opt value in step idx data """
s = self.steps_data[idx]
o2 = []
for o in s[2]:
co = o.replace(str_exist, str_new)
o2.append(co)
s[2] = o2


CONF = ConfContainer()
STEPS = StepsStore()
Expand All @@ -270,9 +289,9 @@ def apply_conf(self, conf):
"\r\n".join(("\t%i. %s\t %s" % (t, STEPS[t].info, STEPS[t].cmd) for t in range(STEPS.length())))
)
PARSER.add_argument('input_dir',
help="the directory wich contains the pictures set.")
help="the directory which contains the pictures set.")
PARSER.add_argument('output_dir',
help="the directory wich will contain the resulting files.")
help="the directory which will contain the resulting files.")
PARSER.add_argument('--steps',
type=int,
nargs="+",
Expand All @@ -282,7 +301,7 @@ def apply_conf(self, conf):
" \r\n".join([k + " = " + str(PRESET[k]) for k in PRESET]) +
" \r\ndefault : " + PRESET_DEFAULT)

GROUP = PARSER.add_argument_group('Passthrough', description="Option to be passed to command lines (remove - in front of option names)\r\ne.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures")
GROUP = PARSER.add_argument_group('Passthrough', description="Option to be passed to command lines (remove - in front of option names)\r\ne.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures\r\nFor example, running the script as follows,\r\nMvgMvsPipeline.py input_dir output_dir --1 p HIGH n 8 --3 n ANNL2\r\nwhere --1 refer to openMVG_main_ComputeFeatures, p refers to\r\ndescriberPreset option which HIGH was chosen, and n refers to\r\nnumThreads which 8 was used. --3 refer to second step (openMVG_main_ComputeMatches),\r\nn refers to nearest_matching_method option which ANNL2 was chosen")
for n in range(STEPS.length()):
GROUP.add_argument('--'+str(n), nargs='+')

Expand All @@ -297,7 +316,7 @@ def mkdir_ine(dirname):
os.mkdir(dirname)


# Absolute path for input and ouput dirs
# Absolute path for input and output dirs
CONF.input_dir = os.path.abspath(CONF.input_dir)
CONF.output_dir = os.path.abspath(CONF.output_dir)

Expand All @@ -324,7 +343,7 @@ def mkdir_ine(dirname):
try:
CONF.steps = PRESET[CONF.preset]
except KeyError:
sys.exit("Unkown preset %s, choose %s" % (CONF.preset, ' or '.join([s for s in PRESET])))
sys.exit("Unknown preset %s, choose %s" % (CONF.preset, ' or '.join([s for s in PRESET])))
elif not CONF.steps:
CONF.steps = PRESET[PRESET_DEFAULT]

Expand All @@ -336,9 +355,14 @@ def mkdir_ine(dirname):
if 4 in CONF.steps: # GeometricFilter
if 6 in CONF.steps: # GlobalReconstruction
# Set the geometric_model of ComputeMatches to Essential
STEPS[4].opt = STEPS[4].opt.replace("/matches.f.bin", "/matches.e.bin")
STEPS.replace_opt(4, FOLDER_DELIM+"matches.f.bin", FOLDER_DELIM+"matches.e.bin")
STEPS[4].opt.extend(["-g", "e"])

if 15 in CONF.steps: # TextureMesh
if 14 not in CONF.steps: # RefineMesh
# RefineMesh step is not run, use ReconstructMesh output
STEPS.replace_opt(15, "scene_dense_mesh_refine.mvs", "scene_dense_mesh.mvs")

for cstep in CONF.steps:
printout("#%i. %s" % (cstep, STEPS[cstep].info), effect=INVERSE)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OpenMVS: open Multi-View Stereo reconstruction library

[![Watch reconstruction](https://i.imgur.com/S4L0E6r.jpeg)](https://sketchfab.com/models/3aedcdd22c31447199c18dd9aec5d952/embed)

## Introduction

[OpenMVS (Multi-View Stereo)](http://cdcseacave.github.io/openMVS) is a library for computer-vision scientists and especially targeted to the Multi-View Stereo reconstruction community. While there are mature and complete open-source projects targeting Structure-from-Motion pipelines (like [OpenMVG](https://github.com/openMVG/openMVG)) which recover camera poses and a sparse 3D point-cloud from an input set of images, there are none addressing the last part of the photogrammetry chain-flow. *OpenMVS* aims at filling that gap by providing a complete set of algorithms to recover the full surface of the scene to be reconstructed. The input is a set of camera poses plus the sparse point-cloud and the output is a textured mesh. The main topics covered by this project are:
Expand Down
Loading