Skip to content

Commit

Permalink
Merge pull request #1984 from alicevision/dev/depthMapMultiResolution
Browse files Browse the repository at this point in the history
[nodes] DepthMap: New option for multi-resolution similarity estimation and optimizations
  • Loading branch information
fabiencastan authored Jun 13, 2023
2 parents 7e6ce90 + 3d68e5e commit ca7fef3
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 4 deletions.
150 changes: 148 additions & 2 deletions meshroom/nodes/aliceVision/DepthMap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.0"
__version__ = "4.0"

from meshroom.core import desc

Expand Down Expand Up @@ -188,6 +188,24 @@ class DepthMap(desc.AVCommandLineNode):
uid=[0],
advanced=True,
),
desc.FloatParam(
name='sgmDepthThicknessInflate',
label='Thickness Inflate',
description='Inflate factor to add margins to the depth thickness.',
value=0.0,
range=(0.0, 2.0, 0.1),
uid=[0],
advanced=True,
),
desc.FloatParam(
name='sgmMaxSimilarity',
label='Max Similarity',
description='Maximum similarity threshold (between 0 and 1) used to filter out poorly supported depth values.',
value=1.0,
range=(0.0, 1.0, 0.01),
uid=[0],
advanced=True,
),
desc.FloatParam(
name='sgmGammaC',
label='GammaC',
Expand Down Expand Up @@ -249,6 +267,13 @@ class DepthMap(desc.AVCommandLineNode):
uid=[0],
advanced=True,
),
desc.BoolParam(
name='sgmUseConsistentScale',
label='Consistent Scale',
description='Compare patch with consistent scale for similarity volume computation.',
value=False,
uid=[0],
),
]),
desc.GroupAttribute(
name='refine',
Expand Down Expand Up @@ -353,6 +378,22 @@ class DepthMap(desc.AVCommandLineNode):
advanced=True,
enabled= lambda node: node.refine.refineEnabled.value,
),
desc.BoolParam(
name='refineInterpolateMiddleDepth',
label='Interpolate Middle Depth',
description='Enable middle depth bilinear interpolation.',
value=False,
uid=[0],
enabled= lambda node: node.refine.refineEnabled.value,
),
desc.BoolParam(
name='refineUseConsistentScale',
label='Consistent Scale',
description='Compare patch with consistent scale for similarity volume computation.',
value=False,
uid=[0],
enabled= lambda node: node.refine.refineEnabled.value,
),
]),
desc.GroupAttribute(
name="colorOptimization",
Expand All @@ -378,6 +419,95 @@ class DepthMap(desc.AVCommandLineNode):
enabled= lambda node: node.colorOptimization.colorOptimizationEnabled.value,
),
]),
desc.GroupAttribute(
name='customPatchPattern',
label='Custom Patch Pattern',
description='User custom patch pattern for similarity comparison.',
advanced=True,
group=None,
groupDesc=[
desc.BoolParam(
name='sgmUseCustomPatchPattern',
label='Enable for SGM',
description='Enable custom patch pattern for similarity volume computation at the SGM step .',
value=False,
uid=[0],
advanced=True,
),
desc.BoolParam(
name='refineUseCustomPatchPattern',
label='Enable for Refine',
description='Enable custom patch pattern for similarity volume computation at the Refine step .',
value=False,
uid=[0],
advanced=True,
),
desc.ListAttribute(
name="customPatchPatternSubparts",
label="Subparts",
description='User custom patch pattern subparts for similarity volume computation.',
advanced=True,
enabled= lambda node: (node.customPatchPattern.sgmUseCustomPatchPattern.value or node.customPatchPattern.refineUseCustomPatchPattern.value),
elementDesc=desc.GroupAttribute(
name='customPatchPatternSubpart',
label='Patch Pattern Subpart',
description='',
joinChar=":",
group=None,
groupDesc=[
desc.ChoiceParam(
name='customPatchPatternSubpartType',
label='Type',
description='Patch pattern subpart type.',
value='full',
values=['full', 'circle'],
exclusive=True,
uid=[0],
),
desc.FloatParam(
name='customPatchPatternSubpartRadius',
label='Radius / WSH',
description='Patch pattern subpart half-width or circle radius.',
value=2.5,
range=(0.5, 30.0, 0.1),
uid=[0],
),
desc.IntParam(
name='customPatchPatternSubpartNbCoords',
label='Coordinates',
description='Patch pattern subpart number of coordinates (for circle or ignore).',
value=12,
range=(3, 24, 1),
uid=[0],
),
desc.IntParam(
name='customPatchPatternSubpartLevel',
label='Level',
description='Patch pattern subpart image level.',
value=0,
range=(0, 2, 1),
uid=[0],
),
desc.FloatParam(
name='customPatchPatternSubpartWeight',
label='Weight',
description='Patch pattern subpart weight.',
value=1.0,
range=(0.0, 1.0, 0.1),
uid=[0],
),
]),
),
desc.BoolParam(
name='customPatchPatternGroupSubpartsPerLevel',
label='Group Subparts Per Level',
description='Group all subparts with the same image level.',
value=False,
uid=[0],
advanced=True,
enabled= lambda node: (node.customPatchPattern.sgmUseCustomPatchPattern.value or node.customPatchPattern.refineUseCustomPatchPattern.value),
),
]),
desc.GroupAttribute(
name='intermediateResults',
label='Intermediate Results',
Expand All @@ -394,6 +524,14 @@ class DepthMap(desc.AVCommandLineNode):
uid=[0],
advanced=True,
),
desc.BoolParam(
name='exportIntermediateNormalMaps',
label='Export Normal Maps',
description='Export intermediate normal maps from the SGM and Refine steps.',
value=False,
uid=[0],
advanced=True,
),
desc.BoolParam(
name='exportIntermediateVolumes',
label='Export Volumes',
Expand All @@ -410,6 +548,14 @@ class DepthMap(desc.AVCommandLineNode):
uid=[0],
advanced=True,
),
desc.BoolParam(
name='exportIntermediateTopographicCutVolumes',
label='Export Cut Volumes',
description='Export intermediate similarity topographic cut volumes from the SGM and Refine steps.',
value=False,
uid=[0],
advanced=True,
),
desc.BoolParam(
name='exportIntermediateVolume9pCsv',
label='Export 9 Points',
Expand Down Expand Up @@ -490,7 +636,7 @@ class DepthMap(desc.AVCommandLineNode):
label='Depth Maps SGM',
description='Debug: Depth maps SGM',
semantic='image',
value=desc.Node.internalFolder + '<VIEW_ID>_depthMap_scale2_sgm.exr',
value=desc.Node.internalFolder + '<VIEW_ID>_depthMap_sgm.exr',
uid=[],
group='', # do not export on the command line
enabled=lambda node: node.intermediateResults.exportIntermediateDepthSimMaps.value,
Expand Down
2 changes: 1 addition & 1 deletion meshroom/pipelines/cameraTracking.mg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"nodesVersions": {
"FeatureExtraction": "1.2",
"CameraInit": "9.0",
"DepthMap": "3.0",
"DepthMap": "4.0",
"SfMTriangulation": "1.0",
"ExportDistortion": "1.0",
"DepthMapFilter": "3.0",
Expand Down
2 changes: 1 addition & 1 deletion meshroom/pipelines/photogrammetry.mg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"MeshFiltering": "3.0",
"Texturing": "6.0",
"PrepareDenseScene": "3.0",
"DepthMap": "3.0",
"DepthMap": "4.0",
"StructureFromMotion": "3.0",
"CameraInit": "9.0",
"ImageMatching": "2.0",
Expand Down

0 comments on commit ca7fef3

Please sign in to comment.