Merge pull request #413 from alicevision/dev_CLIoptions

[CLI] Added new options
This commit is contained in:
Yann Lanthony 2019-03-26 15:52:54 +01:00 committed by GitHub
commit 1cb9935617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 5 deletions

View file

@ -20,10 +20,13 @@ parser.add_argument('--inputImages', metavar='IMAGES', type=str, nargs='*',
parser.add_argument('--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. '
'If not set, the default photogrammetry pipeline will be used. '
'Requirements: the graph must contain one CameraInit node, '
'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,
help='Output folder where results should be copied to. '
'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.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
if args.scale > 0:
for node in graph.nodesByType('DepthMap'):

View file

@ -73,5 +73,14 @@ class PrepareDenseScene(desc.CommandLineNode):
description='''Output folder.''',
value=desc.Node.internalFolder,
uid=[],
)
),
desc.File(
name='outputUndistorted',
label='Undistorted images',
description='List of undistorted images.',
value=desc.Node.internalFolder + '*.{outputFileTypeValue}',
uid=[],
group='',
advanced=True
),
]

View file

@ -1,7 +1,8 @@
import logging
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.QtWidgets import QApplication
@ -53,8 +54,8 @@ class MessageHandler(object):
class MeshroomApp(QApplication):
""" Meshroom UI Application. """
def __init__(self, args):
args = [args[0], '-style', 'fusion'] + args[1:] # force Fusion style by default
super(MeshroomApp, self).__init__(args)
QtArgs = [args[0], '-style', 'fusion'] + args[1:] # force Fusion style by default
super(MeshroomApp, self).__init__(QtArgs)
self.setOrganizationName('AliceVision')
self.setApplicationName('Meshroom')
@ -95,6 +96,13 @@ class MeshroomApp(QApplication):
# Request any potential computation to stop on exit
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))
@Slot(str, result=str)