mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
Merge pull request #413 from alicevision/dev_CLIoptions
[CLI] Added new options
This commit is contained in:
commit
1cb9935617
3 changed files with 34 additions and 5 deletions
|
@ -24,6 +24,9 @@ parser.add_argument('--pipeline', metavar='MESHROOM_FILE', type=str, required=Fa
|
||||||
'Requirements: the graph must contain one CameraInit node, '
|
'Requirements: the graph must contain one CameraInit node, '
|
||||||
'and one Publish node if --output is set.')
|
'and one Publish node if --output is set.')
|
||||||
|
|
||||||
|
parser.add_argument('--overrides', metavar='SETTINGS', type=str, default=None,
|
||||||
|
help='A JSON file containing the graph parameters override.')
|
||||||
|
|
||||||
parser.add_argument('--output', metavar='FOLDER', type=str, required=False,
|
parser.add_argument('--output', metavar='FOLDER', type=str, required=False,
|
||||||
help='Output folder where results should be copied to. '
|
help='Output folder where results should be copied to. '
|
||||||
'If not set, results will have to be retrieved directly from the cache folder.')
|
'If not set, results will have to be retrieved directly from the cache folder.')
|
||||||
|
@ -102,6 +105,15 @@ views, intrinsics = cameraInit.nodeDesc.buildIntrinsics(cameraInit, images)
|
||||||
cameraInit.viewpoints.value = views
|
cameraInit.viewpoints.value = views
|
||||||
cameraInit.intrinsics.value = intrinsics
|
cameraInit.intrinsics.value = intrinsics
|
||||||
|
|
||||||
|
if args.overrides:
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
with io.open(args.overrides, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
|
data = json.load(f)
|
||||||
|
for nodeName, overrides in data.items():
|
||||||
|
for attrName, value in overrides.items():
|
||||||
|
graph.findNode(nodeName).attribute(attrName).value = value
|
||||||
|
|
||||||
# setup DepthMap downscaling
|
# setup DepthMap downscaling
|
||||||
if args.scale > 0:
|
if args.scale > 0:
|
||||||
for node in graph.nodesByType('DepthMap'):
|
for node in graph.nodesByType('DepthMap'):
|
||||||
|
|
|
@ -73,5 +73,14 @@ class PrepareDenseScene(desc.CommandLineNode):
|
||||||
description='''Output folder.''',
|
description='''Output folder.''',
|
||||||
value=desc.Node.internalFolder,
|
value=desc.Node.internalFolder,
|
||||||
uid=[],
|
uid=[],
|
||||||
)
|
),
|
||||||
|
desc.File(
|
||||||
|
name='outputUndistorted',
|
||||||
|
label='Undistorted images',
|
||||||
|
description='List of undistorted images.',
|
||||||
|
value=desc.Node.internalFolder + '*.{outputFileTypeValue}',
|
||||||
|
uid=[],
|
||||||
|
group='',
|
||||||
|
advanced=True
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
from PySide2.QtCore import Qt, Slot, QJsonValue, Property, qInstallMessageHandler, QtMsgType
|
from PySide2.QtCore import Qt, QUrl, Slot, QJsonValue, Property, qInstallMessageHandler, QtMsgType
|
||||||
from PySide2.QtGui import QIcon
|
from PySide2.QtGui import QIcon
|
||||||
from PySide2.QtWidgets import QApplication
|
from PySide2.QtWidgets import QApplication
|
||||||
|
|
||||||
|
@ -53,8 +54,8 @@ class MessageHandler(object):
|
||||||
class MeshroomApp(QApplication):
|
class MeshroomApp(QApplication):
|
||||||
""" Meshroom UI Application. """
|
""" Meshroom UI Application. """
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
args = [args[0], '-style', 'fusion'] + args[1:] # force Fusion style by default
|
QtArgs = [args[0], '-style', 'fusion'] + args[1:] # force Fusion style by default
|
||||||
super(MeshroomApp, self).__init__(args)
|
super(MeshroomApp, self).__init__(QtArgs)
|
||||||
|
|
||||||
self.setOrganizationName('AliceVision')
|
self.setOrganizationName('AliceVision')
|
||||||
self.setApplicationName('Meshroom')
|
self.setApplicationName('Meshroom')
|
||||||
|
@ -95,6 +96,13 @@ class MeshroomApp(QApplication):
|
||||||
# Request any potential computation to stop on exit
|
# Request any potential computation to stop on exit
|
||||||
self.aboutToQuit.connect(r.stopExecution)
|
self.aboutToQuit.connect(r.stopExecution)
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(prog=args[0], description='Launch Meshroom UI.')
|
||||||
|
parser.add_argument('--project', metavar='MESHROOM_FILE', type=str, required=False,
|
||||||
|
help='Meshroom project file (e.g. myProject.mg).')
|
||||||
|
args = parser.parse_args(args[1:])
|
||||||
|
if args.pipeline:
|
||||||
|
r.loadUrl(QUrl.fromLocalFile(args.pipeline))
|
||||||
|
|
||||||
self.engine.load(os.path.normpath(url))
|
self.engine.load(os.path.normpath(url))
|
||||||
|
|
||||||
@Slot(str, result=str)
|
@Slot(str, result=str)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue