diff --git a/meshroom/nodes/aliceVision/LdrToHdrCalibration.py b/meshroom/nodes/aliceVision/LdrToHdrCalibration.py index 6655f817..19814089 100644 --- a/meshroom/nodes/aliceVision/LdrToHdrCalibration.py +++ b/meshroom/nodes/aliceVision/LdrToHdrCalibration.py @@ -60,6 +60,8 @@ Calibrate LDR to HDR response curve from samples. range=(0, 15, 1), uid=[], 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( name="nbBrackets", @@ -181,13 +183,24 @@ Calibrate LDR to HDR response curve from samples. if "userNbBrackets" not in node.getAttributes().keys(): # Old version of the node return - if node.userNbBrackets.value != 0: - node.nbBrackets.value = node.userNbBrackets.value - 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 not cameraInitOutput.node.hasAttribute("viewpoints"): if cameraInitOutput.node.hasAttribute("input"): cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True) diff --git a/meshroom/nodes/aliceVision/LdrToHdrMerge.py b/meshroom/nodes/aliceVision/LdrToHdrMerge.py index c6bb797e..99dfd580 100644 --- a/meshroom/nodes/aliceVision/LdrToHdrMerge.py +++ b/meshroom/nodes/aliceVision/LdrToHdrMerge.py @@ -59,6 +59,8 @@ Merge LDR images into HDR images. range=(0, 15, 1), uid=[], 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( name="nbBrackets", @@ -267,13 +269,24 @@ Merge LDR images into HDR images. if "userNbBrackets" not in node.getAttributes().keys(): # Old version of the node return - if node.userNbBrackets.value != 0: - node.nbBrackets.value = node.userNbBrackets.value - 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 not cameraInitOutput.node.hasAttribute("viewpoints"): if cameraInitOutput.node.hasAttribute("input"): cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True) diff --git a/meshroom/nodes/aliceVision/LdrToHdrSampling.py b/meshroom/nodes/aliceVision/LdrToHdrSampling.py index 7f0dccad..414d32da 100644 --- a/meshroom/nodes/aliceVision/LdrToHdrSampling.py +++ b/meshroom/nodes/aliceVision/LdrToHdrSampling.py @@ -74,6 +74,8 @@ Sample pixels from Low range images for HDR creation. range=(0, 15, 1), uid=[], 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( name="nbBrackets", @@ -207,13 +209,24 @@ Sample pixels from Low range images for HDR creation. # Old version of the node return node.outliersNb = 0 # Reset the number of detected outliers - if node.userNbBrackets.value != 0: - node.nbBrackets.value = node.userNbBrackets.value - 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 not cameraInitOutput.node.hasAttribute("viewpoints"): if cameraInitOutput.node.hasAttribute("input"): cameraInitOutput = cameraInitOutput.node.input.getLinkParam(recursive=True)