mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 17:57:16 +02:00
[bin] meshroom_photogrammetry: add hdri pipeline option
This commit is contained in:
parent
9b1962f963
commit
180a2565e1
1 changed files with 23 additions and 21 deletions
|
@ -10,7 +10,7 @@ meshroom.setupEnvironment()
|
|||
import meshroom.core.graph
|
||||
from meshroom import multiview
|
||||
|
||||
parser = argparse.ArgumentParser(description='Launch the full photogrammetry pipeline.')
|
||||
parser = argparse.ArgumentParser(description='Launch the full photogrammetry or HDRI pipeline.')
|
||||
parser.add_argument('-i', '--input', metavar='SFM/FOLDERS/IMAGES', type=str, nargs='*',
|
||||
default=[],
|
||||
help='Input folder containing images or folders of images or file (.sfm or .json) '
|
||||
|
@ -19,9 +19,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='MESHROOM_FILE', type=str, required=False,
|
||||
help='Meshroom file containing a pre-configured photogrammetry pipeline to run on input images. '
|
||||
'If not set, the default photogrammetry pipeline will be used. '
|
||||
parser.add_argument('-p', '--pipeline', metavar='photogrammetry/hdri/MG_FILE', type=str, default='photogrammetry',
|
||||
help='"photogrammetry" pipeline, "hdri" 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.')
|
||||
|
||||
|
@ -100,27 +99,30 @@ if hasSearchedForImages and not filesByType.images:
|
|||
exit(-1)
|
||||
|
||||
# initialize photogrammetry pipeline
|
||||
if args.pipeline:
|
||||
if args.pipeline.lower() == "photogrammetry":
|
||||
# default photogrammetry pipeline
|
||||
graph = multiview.photogrammetry(inputViewpoints=views, inputIntrinsics=intrinsics, output=args.output)
|
||||
elif args.pipeline.lower() == "hdri":
|
||||
# default hdri pipeline
|
||||
graph = multiview.hdri(inputViewpoints=views, inputIntrinsics=intrinsics, output=args.output)
|
||||
else:
|
||||
# custom pipeline
|
||||
graph = meshroom.core.graph.loadGraph(args.pipeline)
|
||||
cameraInit = getOnlyNodeOfType(graph, 'CameraInit')
|
||||
# reset graph inputs
|
||||
cameraInit.viewpoints.resetValue()
|
||||
cameraInit.intrinsics.resetValue()
|
||||
# add views and intrinsics (if any) read from args.input
|
||||
cameraInit.viewpoints.extend(views)
|
||||
cameraInit.intrinsics.extend(intrinsics)
|
||||
|
||||
if not graph.canComputeLeaves:
|
||||
raise RuntimeError("Graph cannot be computed. Check for compatibility issues.")
|
||||
cameraInit = getOnlyNodeOfType(graph, 'CameraInit')
|
||||
# reset graph inputs
|
||||
cameraInit.viewpoints.resetValue()
|
||||
cameraInit.intrinsics.resetValue()
|
||||
# add views and intrinsics (if any) read from args.input
|
||||
cameraInit.viewpoints.extend(views)
|
||||
cameraInit.intrinsics.extend(intrinsics)
|
||||
|
||||
if args.output:
|
||||
publish = getOnlyNodeOfType(graph, 'Publish')
|
||||
publish.output.value = args.output
|
||||
else:
|
||||
# default pipeline
|
||||
graph = multiview.photogrammetry(inputViewpoints=views, inputIntrinsics=intrinsics, output=args.output)
|
||||
cameraInit = getOnlyNodeOfType(graph, 'CameraInit')
|
||||
if not graph.canComputeLeaves:
|
||||
raise RuntimeError("Graph cannot be computed. Check for compatibility issues.")
|
||||
|
||||
if args.output:
|
||||
publish = getOnlyNodeOfType(graph, 'Publish')
|
||||
publish.output.value = args.output
|
||||
|
||||
if filesByType.images:
|
||||
views, intrinsics = cameraInit.nodeDesc.buildIntrinsics(cameraInit, filesByType.images)
|
||||
|
|
Loading…
Add table
Reference in a new issue