Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions meshroom/aliceVision/KeyframeSelection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__version__ = "5.0"

from meshroom.core import desc
from meshroom.core.desc.validators import success, error
from meshroom.core.utils import EXR_STORAGE_DATA_TYPE, VERBOSE_LEVEL

# List of supported video extensions (provided by OpenImageIO)
Expand Down Expand Up @@ -283,8 +284,9 @@ class KeyframeSelection(desc.AVCommandLineNode):
"For input videos, 'none' should not be used since the written keyframes are used to generate the output SfMData file.",
value="none",
values=["none", "exr", "jpg", "png"],
validValue=lambda node: not (any(ext in input.value.lower() for ext in videoExts for input in node.inputPaths.value) and node.outputExtension.value == "none"),
errorMessage="A video input has been provided. The output extension should be different from 'none'.",
validators=[
lambda node, _ : success() if not (any(ext in input.value.lower() for ext in videoExts for input in node.inputPaths.value) and node.outputExtension.value == "none") else error("A video input has been provided. The output extension should be different from 'none'.")
],
),
desc.ChoiceParam(
name="storageDataType",
Expand Down
20 changes: 6 additions & 14 deletions meshroom/aliceVision/LdrToHdrCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from meshroom.core import desc
from meshroom.core.utils import COLORSPACES, VERBOSE_LEVEL
from . ldrToHdrCommon import NbOfBracketsShouldBeAMultipleOfNbOfImages

def findMetadata(d, keys, defaultValue):
v = None
Expand Down Expand Up @@ -55,9 +56,8 @@ class LdrToHdrCalibration(desc.AVCommandLineNode):
value=0,
range=(0, 15, 1),
invalidate=False,
group="user", # not used directly on the command line
errorMessage="The set number of brackets is not a multiple of the number of input images.\n"
"Errors will occur during the computation.",
group="user", # not used directly on the command line,
validators=[NbOfBracketsShouldBeAMultipleOfNbOfImages()],
exposed=True,
),
desc.IntParam(
Expand Down Expand Up @@ -176,23 +176,15 @@ def update(cls, node):
if "userNbBrackets" not in node.getAttributes().keys():
# Old version of the node
return
node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets"

cameraInitOutput = node.input.getLinkParam(recursive=True)
if not cameraInitOutput:
node.nbBrackets.value = 0
return
if node.userNbBrackets.value != 0:
# The number of brackets has been manually forced: check whether it is valid or not
if cameraInitOutput and cameraInitOutput.node and cameraInitOutput.node.hasAttribute("viewpoints"):
viewpoints = cameraInitOutput.node.viewpoints.value
# The number of brackets should be a multiple of the number of input images
if (len(viewpoints) % node.userNbBrackets.value != 0):
node.userNbBrackets.validValue = False
else:
node.userNbBrackets.validValue = True
node.nbBrackets.value = node.userNbBrackets.value
return
if len(node.userNbBrackets.getErrorMessages()) > 0:
node.nbBrackets.value = node.userNbBrackets.value
return

if not cameraInitOutput.node.hasAttribute("viewpoints"):
if cameraInitOutput.node.hasAttribute("input"):
Expand Down
18 changes: 5 additions & 13 deletions meshroom/aliceVision/LdrToHdrMerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from meshroom.core import desc
from meshroom.core.utils import COLORSPACES, EXR_STORAGE_DATA_TYPE, VERBOSE_LEVEL
from . ldrToHdrCommon import NbOfBracketsShouldBeAMultipleOfNbOfImages

def findMetadata(d, keys, defaultValue):
v = None
Expand Down Expand Up @@ -55,8 +56,7 @@ class LdrToHdrMerge(desc.AVCommandLineNode):
range=(0, 15, 1),
invalidate=False,
group="user", # not used directly on the command line
errorMessage="The set number of brackets is not a multiple of the number of input images.\n"
"Errors will occur during the computation.",
validators=[NbOfBracketsShouldBeAMultipleOfNbOfImages()],
exposed=True,
),
desc.IntParam(
Expand Down Expand Up @@ -249,23 +249,15 @@ def update(cls, node):
if "userNbBrackets" not in node.getAttributes().keys():
# Old version of the node
return
node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets"

cameraInitOutput = node.input.getLinkParam(recursive=True)
if not cameraInitOutput:
node.nbBrackets.value = 0
return
if node.userNbBrackets.value != 0:
# The number of brackets has been manually forced: check whether it is valid or not
if cameraInitOutput and cameraInitOutput.node and cameraInitOutput.node.hasAttribute("viewpoints"):
viewpoints = cameraInitOutput.node.viewpoints.value
# The number of brackets should be a multiple of the number of input images
if (len(viewpoints) % node.userNbBrackets.value != 0):
node.userNbBrackets.validValue = False
else:
node.userNbBrackets.validValue = True
node.nbBrackets.value = node.userNbBrackets.value
return
if len(node.userNbBrackets.getErrorMessages()) > 0:
node.nbBrackets.value = node.userNbBrackets.value
return

if not cameraInitOutput.node.hasAttribute("viewpoints"):
if cameraInitOutput.node.hasAttribute("input"):
Expand Down
21 changes: 8 additions & 13 deletions meshroom/aliceVision/LdrToHdrSampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from meshroom.core import desc
from meshroom.core.utils import COLORSPACES, VERBOSE_LEVEL
from . ldrToHdrCommon import NbOfBracketsShouldBeAMultipleOfNbOfImages


def findMetadata(d, keys, defaultValue):
Expand Down Expand Up @@ -71,8 +72,9 @@ class LdrToHdrSampling(desc.AVCommandLineNode):
range=(0, 15, 1),
invalidate=False,
group="user", # not used directly on the command line
errorMessage="The set number of brackets is not a multiple of the number of input images.\n"
"Errors will occur during the computation.",
validators=[
NbOfBracketsShouldBeAMultipleOfNbOfImages()
],
exposed=True,
),
desc.IntParam(
Expand Down Expand Up @@ -202,23 +204,16 @@ def update(cls, node):
# Old version of the node
return
node.outliersNb = 0 # Reset the number of detected outliers
node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets"

cameraInitOutput = node.input.getLinkParam(recursive=True)
if not cameraInitOutput:
node.nbBrackets.value = 0
return
if node.userNbBrackets.value != 0:
# The number of brackets has been manually forced: check whether it is valid or not
if cameraInitOutput and cameraInitOutput.node and cameraInitOutput.node.hasAttribute("viewpoints"):
viewpoints = cameraInitOutput.node.viewpoints.value
# The number of brackets should be a multiple of the number of input images
if (len(viewpoints) % node.userNbBrackets.value != 0):
node.userNbBrackets.validValue = False
else:
node.userNbBrackets.validValue = True
node.nbBrackets.value = node.userNbBrackets.value
return

if len(node.userNbBrackets.getErrorMessages()) > 0:
node.nbBrackets.value = node.userNbBrackets.value
return

if not cameraInitOutput.node.hasAttribute("viewpoints"):
if cameraInitOutput.node.hasAttribute("input"):
Expand Down
27 changes: 27 additions & 0 deletions meshroom/aliceVision/ldrToHdrCommon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from meshroom.core.attribute import Attribute
from meshroom.core.node import Node
from meshroom.core.desc.validators import AttributeValidator, success, error


class NbOfBracketsShouldBeAMultipleOfNbOfImages(AttributeValidator):

def __call__(self, node: Node, attribute: Attribute):

if node.userNbBrackets.value == 0:
return success()

cameraInitOutput = node.input.getLinkParam(recursive=True)

# The number of brackets has been manually forced: check whether it is valid or not
if cameraInitOutput and cameraInitOutput.node and cameraInitOutput.node.hasAttribute("viewpoints"):
viewpoints = cameraInitOutput.node.viewpoints.value
# The number of brackets should be a multiple of the number of input images
if (len(viewpoints) % node.userNbBrackets.value != 0):
return error(
"The set number of brackets is not a multiple of the number of input images.",
"Errors will occur during the computation."
)
else:
return success()

return success()
Loading