From a5a89d64ed7da662d81afd5a94337511c09a45df Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Thu, 5 Oct 2023 08:57:05 +0200 Subject: [PATCH 1/3] New nodes for panorama to sfm --- meshroom/nodes/aliceVision/SfMMerge.py | 49 ++++++++++++++++++++++++++ meshroom/nodes/aliceVision/SfMToRig.py | 42 ++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 meshroom/nodes/aliceVision/SfMMerge.py create mode 100644 meshroom/nodes/aliceVision/SfMToRig.py diff --git a/meshroom/nodes/aliceVision/SfMMerge.py b/meshroom/nodes/aliceVision/SfMMerge.py new file mode 100644 index 0000000000..df0fa3eb8c --- /dev/null +++ b/meshroom/nodes/aliceVision/SfMMerge.py @@ -0,0 +1,49 @@ +__version__ = "1.0" + +from meshroom.core import desc +import os.path + +class SfmMerge(desc.AVCommandLineNode): + commandLine = 'aliceVision_sfmMerge {allParams}' + size = desc.DynamicNodeSize('firstinput') + + category = 'Utils' + documentation = ''' +Merge two sfmData into a single one. Fails if some uid is shared among them +''' + + inputs = [ + desc.File( + name="firstinput", + label="SfMData", + description="First Input SfMData file.", + value="", + uid=[0], + ), + desc.File( + name="secondinput", + label="SfMData", + description="Second Input SfMData file.", + value="", + uid=[0], + ), + desc.ChoiceParam( + name="verboseLevel", + label="Verbose Level", + description="Verbosity level (fatal, error, warning, info, debug, trace).", + value="info", + values=["fatal", "error", "warning", "info", "debug", "trace"], + exclusive=True, + uid=[], + ) + ] + + outputs = [ + desc.File( + name="output", + label="SfMData", + description="Path to the output SfM file (in SfMData format).", + value=lambda attr: desc.Node.internalFolder + "sfmData.sfm", + uid=[], + ), + ] diff --git a/meshroom/nodes/aliceVision/SfMToRig.py b/meshroom/nodes/aliceVision/SfMToRig.py new file mode 100644 index 0000000000..817d730d6b --- /dev/null +++ b/meshroom/nodes/aliceVision/SfMToRig.py @@ -0,0 +1,42 @@ +__version__ = "1.0" + +from meshroom.core import desc +import os.path + +class SfmToRig(desc.AVCommandLineNode): + commandLine = 'aliceVision_sfmToRig {allParams}' + size = desc.DynamicNodeSize('input') + + category = 'Utils' + documentation = ''' +Assumes input sfm data describes a set of cameras capturing a scene at a common time. Transform the set of cameras into a rig of cameras. +''' + + inputs = [ + desc.File( + name="input", + label="SfMData", + description="Input SfMData file.", + value="", + uid=[0], + ), + desc.ChoiceParam( + name="verboseLevel", + label="Verbose Level", + description="Verbosity level (fatal, error, warning, info, debug, trace).", + value="info", + values=["fatal", "error", "warning", "info", "debug", "trace"], + exclusive=True, + uid=[], + ) + ] + + outputs = [ + desc.File( + name="output", + label="SfMData", + description="Path to the output SfM file (in SfMData format).", + value=lambda attr: desc.Node.internalFolder + "sfmData.sfm", + uid=[], + ), + ] From d18cadc5ec4afd2126e272002789b12c604f5b60 Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Thu, 5 Oct 2023 11:15:56 +0200 Subject: [PATCH 2/3] Update chunks with merge --- meshroom/nodes/aliceVision/SfMMerge.py | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/meshroom/nodes/aliceVision/SfMMerge.py b/meshroom/nodes/aliceVision/SfMMerge.py index df0fa3eb8c..2152c587a2 100644 --- a/meshroom/nodes/aliceVision/SfMMerge.py +++ b/meshroom/nodes/aliceVision/SfMMerge.py @@ -3,9 +3,35 @@ from meshroom.core import desc import os.path + +class MergeNodeSize(object): + """ + MergeNodeSize expresses a dependency to two input attributess to define + the size of a Node in terms of individual tasks for parallelization. + """ + def __init__(self, param1, param2): + self._param1 = param1 + self._param2 = param2 + + def computeSize(self, node): + + size1 = 0 + size2 = 0 + + param1 = node.attribute(self._param1) + if param1.isLink: + size1 = param1.getLinkParam().node.size + + param2 = node.attribute(self._param2) + if param2.isLink: + size2 = param2.getLinkParam().node.size + + return size1 + size2 + + class SfmMerge(desc.AVCommandLineNode): commandLine = 'aliceVision_sfmMerge {allParams}' - size = desc.DynamicNodeSize('firstinput') + size = MergeNodeSize('firstinput', 'secondinput') category = 'Utils' documentation = ''' From 801ba75fe5ab36eba57c39e7ace7246ba92b99c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Tue, 10 Oct 2023 11:15:45 +0200 Subject: [PATCH 3/3] [nodes] SfMMerge/SfMToRig: Update labels and descriptions --- meshroom/nodes/aliceVision/SfMMerge.py | 12 ++++++------ meshroom/nodes/aliceVision/SfMToRig.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meshroom/nodes/aliceVision/SfMMerge.py b/meshroom/nodes/aliceVision/SfMMerge.py index 2152c587a2..67c5d88edc 100644 --- a/meshroom/nodes/aliceVision/SfMMerge.py +++ b/meshroom/nodes/aliceVision/SfMMerge.py @@ -29,27 +29,27 @@ def computeSize(self, node): return size1 + size2 -class SfmMerge(desc.AVCommandLineNode): +class SfMMerge(desc.AVCommandLineNode): commandLine = 'aliceVision_sfmMerge {allParams}' size = MergeNodeSize('firstinput', 'secondinput') category = 'Utils' documentation = ''' -Merge two sfmData into a single one. Fails if some uid is shared among them +Merges two SfMData files into a single one. Fails if some UID is shared among them. ''' inputs = [ desc.File( name="firstinput", - label="SfMData", - description="First Input SfMData file.", + label="First SfMData", + description="First input SfMData file to merge.", value="", uid=[0], ), desc.File( name="secondinput", - label="SfMData", - description="Second Input SfMData file.", + label="Second SfMData", + description="Second input SfMData file to merge.", value="", uid=[0], ), diff --git a/meshroom/nodes/aliceVision/SfMToRig.py b/meshroom/nodes/aliceVision/SfMToRig.py index 817d730d6b..48def995ef 100644 --- a/meshroom/nodes/aliceVision/SfMToRig.py +++ b/meshroom/nodes/aliceVision/SfMToRig.py @@ -3,13 +3,13 @@ from meshroom.core import desc import os.path -class SfmToRig(desc.AVCommandLineNode): +class SfMToRig(desc.AVCommandLineNode): commandLine = 'aliceVision_sfmToRig {allParams}' size = desc.DynamicNodeSize('input') category = 'Utils' documentation = ''' -Assumes input sfm data describes a set of cameras capturing a scene at a common time. Transform the set of cameras into a rig of cameras. +Assumes the input SfMData describes a set of cameras capturing a scene at a common time. Transformd the set of cameras into a rig of cameras. ''' inputs = [