Skip to content

Commit a2115f6

Browse files
authored
Merge pull request #1845 from alicevision/dev/addAVNodes
[meshroom] Add AliceVision nodes and templates for Meshroom
2 parents 577fe6c + 9ab9801 commit a2115f6

File tree

116 files changed

+18780
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+18780
-12
lines changed

.github/workflows/continuous-integration.yml

+35-12
Original file line numberDiff line numberDiff line change
@@ -94,38 +94,39 @@ jobs:
9494
- name: Functional Tests - PanoramaFisheyeHdr Pipeline
9595
working-directory: ./functional_tests
9696
run: |
97-
# clone required repos
97+
# Clone required repos
9898
git clone --branch develop https://github.com/alicevision/Meshroom.git
9999
git clone --branch main https://github.com/alicevision/dataset_panoramaFisheyeHdr.git
100100
cd Meshroom/
101-
# select meshroom branch
102101
meshroom_avBranch=$(git ls-remote --heads https://github.com/alicevision/Meshroom.git $GITHUB_HEAD_REF | cut -f 1)
103102
if [ $meshroom_avBranch != "" ]; then git checkout $meshroom_avBranch; echo "Use Meshroom/$GITHUB_HEAD_REF"; fi
103+
104+
# Set environment variables specific to Meshroom
104105
export MESHROOM_INSTALL_DIR=$PWD
106+
export MESHROOM_NODES_PATH=${MESHROOM_NODES_PATH}:${ALICEVISION_ROOT}/share/meshroom
107+
export MESHROOM_PIPELINE_TEMPLATES_PATH=${MESHROOM_PIPELINE_TEMPLATES_PATH}:${ALICEVISION_ROOT}/share/meshroom
108+
109+
# Set environment variables to find executables and libraries
105110
export PYTHONPATH=$PWD:${ALICEVISION_ROOT}/bin:${PYTHONPATH}
106111
export PATH=$PATH:${ALICEVISION_ROOT}/bin
107112
export LD_LIBRARY_PATH=${ALICEVISION_ROOT}/lib:${ALICEVISION_ROOT}/lib64:${DEPS_INSTALL_DIR}/lib64:${DEPS_INSTALL_DIR}/lib:${LD_LIBRARY_PATH}
108-
mkdir ./outputData
109-
cd bin/
110-
python3 --version
111-
pip3 --version
113+
114+
# Run the test pipeline
112115
pip3 install psutil
113-
echo "ldd aliceVision_cameraInit"
114-
ldd ${ALICEVISION_ROOT}/bin/aliceVision_cameraInit
116+
cd bin/
117+
mkdir ./outputData
115118
python3 meshroom_batch -i $PWD/../../dataset_panoramaFisheyeHdr/RAW -p panoramaFisheyeHdr -o $PWD/../outputData
116119
117120
- name: Functional Tests - SfM Quality Evaluation
118121
working-directory: ./functional_tests
119122
run: |
120123
git clone --branch master https://github.com/alicevision/SfM_quality_evaluation.git
121124
cd SfM_quality_evaluation/
122-
# checkout a specific commit to ensure repeatability
125+
# Checkout a specific commit to ensure repeatability
123126
git checkout 36e3bf2d05c64d1726cb4a0e770923794f203f98
124127
export PYTHONPATH=${ALICEVISION_ROOT}/bin:${PYTHONPATH}
125128
export LD_LIBRARY_PATH=${ALICEVISION_ROOT}/lib:${ALICEVISION_ROOT}/lib64:${DEPS_INSTALL_DIR}/lib64:${DEPS_INSTALL_DIR}/lib:${LD_LIBRARY_PATH}
126-
echo "ldd aliceVision_cameraInit"
127-
ldd ${ALICEVISION_ROOT}/bin/aliceVision_cameraInit
128-
python3 --version
129+
129130
python3 EvaluationLauncher.py -s ${ALICEVISION_ROOT}/bin -i $PWD/Benchmarking_Camera_Calibration_2008/ -o $PWD/reconstructions/ -r $PWD/results.json -v
130131
131132
- name: Python Binding - Unit Tests
@@ -135,6 +136,27 @@ jobs:
135136
pip3 install pytest
136137
pytest ./pyTests
137138
139+
- name: Meshroom Plugin - Templates validity
140+
working-directory: ./functional_tests
141+
run: |
142+
git clone https://github.com/meshroomHub/mrSegmentation.git
143+
cd Meshroom/
144+
export MESHROOM_INSTALL_DIR=$PWD
145+
export MESHROOM_NODES_PATH=${MESHROOM_NODES_PATH}:${ALICEVISION_ROOT}/share/meshroom:$PWD/../mrSegmentation/meshroom/nodes
146+
export MESHROOM_PIPELINE_TEMPLATES_PATH=${MESHROOM_PIPELINE_TEMPLATES_PATH}:${ALICEVISION_ROOT}/share/meshroom
147+
export PYTHONPATH=$PWD:${ALICEVISION_ROOT}/bin:${PYTHONPATH}
148+
export PATH=$PATH:${ALICEVISION_ROOT}/bin
149+
export LD_LIBRARY_PATH=${ALICEVISION_ROOT}/lib:${ALICEVISION_ROOT}/lib64:${DEPS_INSTALL_DIR}/lib64:${DEPS_INSTALL_DIR}/lib:${LD_LIBRARY_PATH}
150+
151+
echo "
152+
import sys
153+
from meshroom.core import test
154+
if test.checkAllTemplatesVersions():
155+
sys.exit(0)
156+
sys.exit(1)
157+
" | tee test_templatesVersions.py
158+
python3 test_templatesVersions.py
159+
138160
build-windows:
139161
runs-on: windows-latest
140162
env:
@@ -229,6 +251,7 @@ jobs:
229251
-DALICEVISION_BUILD_PHOTOMETRICSTEREO=OFF
230252
-DALICEVISION_BUILD_SEGMENTATION=OFF
231253
-DALICEVISION_BUILD_SWIG_BINDING=ON
254+
-DALICEVISION_INSTALL_MESHROOM_PLUGIN=OFF
232255
-DBOOST_NO_CXX11=ON
233256

234257
cmakeBuildType: Release

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ option(ALICEVISION_BUILD_TESTS "Build AliceVision tests" OFF)
88
option(AV_USE_CUDA "Enable CUDA" ON)
99
option(AV_USE_OPENMP "Enable OpenMP" $<$<CXX_COMPILER_ID:"AppleClang">,OFF,ON>) # disable by default for AppleClang
1010
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
11+
option(ALICEVISION_INSTALL_MESHROOM_PLUGIN "Install AliceVision's plugin for Meshroom" ON)
1112

1213
if(NOT CMAKE_BUILD_TYPE)
1314
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type for AliceVision" FORCE)
@@ -85,6 +86,13 @@ install(
8586

8687
endif()
8788

89+
if (ALICEVISION_INSTALL_MESHROOM_PLUGIN)
90+
install(
91+
DIRECTORY meshroom
92+
DESTINATION ${CMAKE_INSTALL_DATADIR}
93+
)
94+
endif()
95+
8896
# Bundle target (see src/cmake/MakeBundle.cmake)
8997
# Note: require that the install rule has been executed
9098
# Include VCPKG installed dir for runtime dependencies lookup
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
__version__ = "1.0"
2+
3+
from meshroom.core import desc
4+
from meshroom.core.utils import VERBOSE_LEVEL
5+
6+
7+
class ApplyCalibration(desc.AVCommandLineNode):
8+
commandLine = "aliceVision_applyCalibration {allParams}"
9+
size = desc.DynamicNodeSize("input")
10+
11+
category = "Utils"
12+
documentation = """ Overwrite intrinsics with a calibrated intrinsic. """
13+
14+
inputs = [
15+
desc.File(
16+
name="input",
17+
label="SfMData",
18+
description="Input SfMData file.",
19+
value="",
20+
),
21+
desc.File(
22+
name="calibration",
23+
label="Calibration",
24+
description="Calibration file (SfmData or Lens calibration file).",
25+
value="",
26+
),
27+
desc.BoolParam(
28+
name="useJson",
29+
label="Use Lens Calibration File",
30+
description="Calibration is a Lens calibration file generated using 3Dequalizer instead of an sfmData.",
31+
value=False,
32+
),
33+
desc.ChoiceParam(
34+
name="verboseLevel",
35+
label="Verbose Level",
36+
description="Verbosity level (fatal, error, warning, info, debug, trace).",
37+
values=VERBOSE_LEVEL,
38+
value="info",
39+
),
40+
]
41+
42+
outputs = [
43+
desc.File(
44+
name="output",
45+
label="SMData",
46+
description="Path to the output SfMData file.",
47+
value="{nodeCacheFolder}/sfmData.sfm",
48+
),
49+
]
+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
__version__ = "1.0"
2+
3+
from meshroom.core import desc
4+
from meshroom.core.utils import VERBOSE_LEVEL
5+
6+
7+
class CameraCalibration(desc.AVCommandLineNode):
8+
commandLine = 'aliceVision_cameraCalibration {allParams}'
9+
10+
category = 'Utils'
11+
documentation = '''
12+
'''
13+
14+
inputs = [
15+
desc.File(
16+
name="input",
17+
label="Input",
18+
description="Input images in one of the following form:\n"
19+
" - folder containing images.\n"
20+
" - image sequence like \"/path/to/[email protected]\".\n"
21+
" - video file.",
22+
value="",
23+
),
24+
desc.ChoiceParam(
25+
name="pattern",
26+
label="Pattern",
27+
description="Type of pattern (CHESSBOARD, CIRCLES, ASYMMETRIC_CIRCLES, ASYMMETRIC_CCTAG).",
28+
value="CHESSBOARD",
29+
values=["CHESSBOARD", "CIRCLES", "ASYMMETRIC_CIRCLES", "ASYMMETRIC_CCTAG"],
30+
),
31+
desc.GroupAttribute(
32+
name="size",
33+
label="Size",
34+
description="Number of inner corners per one of board dimension like W H.",
35+
groupDesc=[
36+
desc.IntParam(
37+
name="width",
38+
label="Width",
39+
description="",
40+
value=7,
41+
range=(0, 10000, 1),
42+
),
43+
desc.IntParam(
44+
name="height",
45+
label="Height",
46+
description="",
47+
value=5,
48+
range=(0, 10000, 1),
49+
),
50+
],
51+
),
52+
desc.FloatParam(
53+
name="squareSize",
54+
label="Square Size",
55+
description="Size of the grid's square cells (mm).",
56+
value=1.0,
57+
range=(0.0, 100.0, 1.0),
58+
),
59+
desc.IntParam(
60+
name="nbDistortionCoef",
61+
label="Nb Distortion Coef",
62+
description="Number of distortion coefficients.",
63+
value=3,
64+
range=(0, 5, 1),
65+
),
66+
desc.IntParam(
67+
name="maxFrames",
68+
label="Max Frames",
69+
description="Maximum number of frames to extract from the video file.",
70+
value=0,
71+
range=(0, 5, 1),
72+
),
73+
desc.IntParam(
74+
name="maxCalibFrames",
75+
label="Max Calib Frames",
76+
description="Maximum number of frames to use to calibrate from the selected frames.",
77+
value=100,
78+
range=(0, 1000, 1),
79+
),
80+
desc.IntParam(
81+
name="calibGridSize",
82+
label="Calib Grid Size",
83+
description="Define the number of cells per edge.",
84+
value=10,
85+
range=(0, 50, 1),
86+
),
87+
desc.IntParam(
88+
name="minInputFrames",
89+
label="Min Input Frames",
90+
description="Minimum number of frames to limit the refinement loop.",
91+
value=10,
92+
range=(0, 100, 1),
93+
),
94+
desc.FloatParam(
95+
name="maxTotalAvgErr",
96+
label="Max Total Avg Err",
97+
description="Maximum total average error.",
98+
value=0.10000000000000001,
99+
range=(0.0, 1.0, 0.01),
100+
),
101+
desc.File(
102+
name="debugRejectedImgFolder",
103+
label="Debug Rejected Img Folder",
104+
description="Folder to export images that were deleted during the refinement loop.",
105+
value="",
106+
),
107+
desc.File(
108+
name="debugSelectedImgFolder",
109+
label="Debug Selected Img Folder",
110+
description="Folder to export debug images.",
111+
value="",
112+
),
113+
desc.ChoiceParam(
114+
name="verboseLevel",
115+
label="Verbose Level",
116+
description="Verbosity level (fatal, error, warning, info, debug, trace).",
117+
values=VERBOSE_LEVEL,
118+
value="info",
119+
),
120+
]
121+
122+
outputs = [
123+
desc.File(
124+
name="output",
125+
label="Output",
126+
description="Output filename for intrinsic [and extrinsic] parameters.",
127+
value="{nodeCacheFolder}/cameraCalibration.cal",
128+
),
129+
]

0 commit comments

Comments
 (0)