Skip to content

Commit

Permalink
Draft Reconstruction pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
remmel authored and fabiencastan committed Sep 13, 2021
1 parent 1a9692d commit d30571c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/meshroom_batch
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ parser.add_argument('-I', '--inputRecursive', metavar='FOLDERS/IMAGES', type=str
default=[],
help='Input folders containing all images recursively.')

parser.add_argument('-p', '--pipeline', metavar='photogrammetry/panoramaHdr/panoramaFisheyeHdr/MG_FILE', type=str, default='photogrammetry',
help='"photogrammetry", "panoramaHdr", "panoramaFisheyeHdr", "cameraTracking" pipeline or a Meshroom file containing a custom pipeline to run on input images. '
parser.add_argument('-p', '--pipeline', metavar='photogrammetry/panoramaHdr/panoramaFisheyeHdr/cameraTracking/photogrammetryDraft/MG_FILE', type=str, default='photogrammetry',
help='"photogrammetry", "panoramaHdr", "panoramaFisheyeHdr", "cameraTracking", "photogrammetryDraft" pipeline or a Meshroom file containing a custom pipeline to run on input images. '
'Requirements: the graph must contain one CameraInit node, '
'and one Publish node if --output is set.')

Expand Down
44 changes: 44 additions & 0 deletions meshroom/multiview.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,3 +557,47 @@ def photogrammetryAndCameraTracking(inputImages=list(), inputViewpoints=list(),

return graph


def photogrammetryDraft(inputImages=None, inputViewpoints=None, inputIntrinsics=None, output='', graph=None):
"""
Create a new Graph with a complete photogrammetry pipeline without requiring a NVIDIA CUDA video card. Something also named Draft Meshing.
More information on that pipeline https://github.com/alicevision/meshroom/wiki/Draft-Meshing
Args:
inputImages (list of str, optional): list of image file paths
inputViewpoints (list of Viewpoint, optional): list of Viewpoints
output (str, optional): the path to export reconstructed model to
Returns:
Graph: the created graph
"""
if not graph:
graph = Graph('PhotogrammetryDraft')
with GraphModification(graph):
sfmNodes = sfmPipeline(graph)
sfmNode = sfmNodes[-1]

meshing = graph.addNewNode('Meshing',
input=sfmNode.output)

meshFiltering = graph.addNewNode('MeshFiltering',
inputMesh=meshing.outputMesh)
texturing = graph.addNewNode('Texturing',
input=meshing.output,
inputMesh=meshFiltering.outputMesh)

cameraInit = sfmNodes[0]

if inputImages:
cameraInit.viewpoints.extend([{'path': image} for image in inputImages])
if inputViewpoints:
cameraInit.viewpoints.extend(inputViewpoints)
if inputIntrinsics:
cameraInit.intrinsics.extend(inputIntrinsics)

if output:
graph.addNewNode('Publish', output=output, inputFiles=[texturing.outputMesh,
texturing.outputMaterial,
texturing.outputTextures])

return graph
4 changes: 4 additions & 0 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ ApplicationWindow {
text: "Camera Tracking (experimental)"
onTriggered: ensureSaved(function() { _reconstruction.new("cameratracking") })
}
Action {
text: "Photogrammetry Draft (No CUDA)"
onTriggered: ensureSaved(function() { _reconstruction.new("photogrammetrydraft") })
}
}
Action {
id: openActionItem
Expand Down
3 changes: 3 additions & 0 deletions meshroom/ui/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ def new(self, pipeline=None):
elif p.lower() == "cameratracking":
# default camera tracking pipeline
self.setGraph(multiview.cameraTracking())
elif p.lower() == "photogrammetrydraft":
# photogrammetry pipeline in draft mode (no cuda)
self.setGraph(multiview.photogrammetryDraft())
else:
# use the user-provided default photogrammetry project file
self.load(p, setupProjectFile=False)
Expand Down

0 comments on commit d30571c

Please sign in to comment.