mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-20 20:46:28 +02:00
[nodes] HDR Fusion: Flag userNbBrackets
as invalid if it isn't a multiple of the number of inputs
Add an error message for `userNbBrackets` and set `validValue` to false if the set number of brackets is not a multiple of the number of input images.
This commit is contained in:
parent
1e14b2c5a0
commit
fdd9d088c5
3 changed files with 48 additions and 9 deletions
|
@ -60,6 +60,8 @@ Calibrate LDR to HDR response curve from samples.
|
||||||
range=(0, 15, 1),
|
range=(0, 15, 1),
|
||||||
uid=[],
|
uid=[],
|
||||||
group="user", # not used directly on the command line
|
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."
|
||||||
),
|
),
|
||||||
desc.IntParam(
|
desc.IntParam(
|
||||||
name="nbBrackets",
|
name="nbBrackets",
|
||||||
|
@ -181,13 +183,24 @@ Calibrate LDR to HDR response curve from samples.
|
||||||
if "userNbBrackets" not in node.getAttributes().keys():
|
if "userNbBrackets" not in node.getAttributes().keys():
|
||||||
# Old version of the node
|
# Old version of the node
|
||||||
return
|
return
|
||||||
if node.userNbBrackets.value != 0:
|
node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets"
|
||||||
node.nbBrackets.value = node.userNbBrackets.value
|
|
||||||
return
|
|
||||||
cameraInitOutput = node.input.getLinkParam(recursive=True)
|
cameraInitOutput = node.input.getLinkParam(recursive=True)
|
||||||
if not cameraInitOutput:
|
if not cameraInitOutput:
|
||||||
node.nbBrackets.value = 0
|
node.nbBrackets.value = 0
|
||||||
return
|
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 not cameraInitOutput.node.hasAttribute("viewpoints"):
|
if not cameraInitOutput.node.hasAttribute("viewpoints"):
|
||||||
if cameraInitOutput.node.hasAttribute("input"):
|
if cameraInitOutput.node.hasAttribute("input"):
|
||||||
cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)
|
cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)
|
||||||
|
|
|
@ -59,6 +59,8 @@ Merge LDR images into HDR images.
|
||||||
range=(0, 15, 1),
|
range=(0, 15, 1),
|
||||||
uid=[],
|
uid=[],
|
||||||
group="user", # not used directly on the command line
|
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."
|
||||||
),
|
),
|
||||||
desc.IntParam(
|
desc.IntParam(
|
||||||
name="nbBrackets",
|
name="nbBrackets",
|
||||||
|
@ -267,13 +269,24 @@ Merge LDR images into HDR images.
|
||||||
if "userNbBrackets" not in node.getAttributes().keys():
|
if "userNbBrackets" not in node.getAttributes().keys():
|
||||||
# Old version of the node
|
# Old version of the node
|
||||||
return
|
return
|
||||||
if node.userNbBrackets.value != 0:
|
node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets"
|
||||||
node.nbBrackets.value = node.userNbBrackets.value
|
|
||||||
return
|
|
||||||
cameraInitOutput = node.input.getLinkParam(recursive=True)
|
cameraInitOutput = node.input.getLinkParam(recursive=True)
|
||||||
if not cameraInitOutput:
|
if not cameraInitOutput:
|
||||||
node.nbBrackets.value = 0
|
node.nbBrackets.value = 0
|
||||||
return
|
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 not cameraInitOutput.node.hasAttribute("viewpoints"):
|
if not cameraInitOutput.node.hasAttribute("viewpoints"):
|
||||||
if cameraInitOutput.node.hasAttribute("input"):
|
if cameraInitOutput.node.hasAttribute("input"):
|
||||||
cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)
|
cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)
|
||||||
|
|
|
@ -74,6 +74,8 @@ Sample pixels from Low range images for HDR creation.
|
||||||
range=(0, 15, 1),
|
range=(0, 15, 1),
|
||||||
uid=[],
|
uid=[],
|
||||||
group="user", # not used directly on the command line
|
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."
|
||||||
),
|
),
|
||||||
desc.IntParam(
|
desc.IntParam(
|
||||||
name="nbBrackets",
|
name="nbBrackets",
|
||||||
|
@ -207,13 +209,24 @@ Sample pixels from Low range images for HDR creation.
|
||||||
# Old version of the node
|
# Old version of the node
|
||||||
return
|
return
|
||||||
node.outliersNb = 0 # Reset the number of detected outliers
|
node.outliersNb = 0 # Reset the number of detected outliers
|
||||||
if node.userNbBrackets.value != 0:
|
node.userNbBrackets.validValue = True # Reset the status of "userNbBrackets"
|
||||||
node.nbBrackets.value = node.userNbBrackets.value
|
|
||||||
return
|
|
||||||
cameraInitOutput = node.input.getLinkParam(recursive=True)
|
cameraInitOutput = node.input.getLinkParam(recursive=True)
|
||||||
if not cameraInitOutput:
|
if not cameraInitOutput:
|
||||||
node.nbBrackets.value = 0
|
node.nbBrackets.value = 0
|
||||||
return
|
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 not cameraInitOutput.node.hasAttribute("viewpoints"):
|
if not cameraInitOutput.node.hasAttribute("viewpoints"):
|
||||||
if cameraInitOutput.node.hasAttribute("input"):
|
if cameraInitOutput.node.hasAttribute("input"):
|
||||||
cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)
|
cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue