Meshroom/meshroom/nodes/aliceVision/ImageMasking.py
Candice Bentéjac 3146dcface [nodes] I-L: Harmonize and improve labels and descriptions
Use CamelCase for all labels, always end descriptions with periods, and
replace the mixed use of single and double quotes with double quotes
only.
2023-06-16 10:31:18 +02:00

152 lines
5.3 KiB
Python

__version__ = "3.0"
from meshroom.core import desc
class ImageMasking(desc.AVCommandLineNode):
commandLine = 'aliceVision_imageMasking {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=40)
commandLineRange = '--rangeStart {rangeStart} --rangeSize {rangeBlockSize}'
documentaiton = '''
'''
inputs = [
desc.File(
name="input",
label="SfMData",
description="Input SfMData file.",
value="",
uid=[0],
),
desc.ChoiceParam(
name="algorithm",
label="Algorithm",
description="",
value="HSV",
values=["HSV", "AutoGrayscaleThreshold"],
exclusive=True,
uid=[0],
),
desc.GroupAttribute(
name="hsv",
label="HSV Parameters",
description="Values to select:\n"
" - Green: default values\n"
" - White: Tolerance = 1, minSaturation = 0, maxSaturation = 0.1, minValue = 0.8, maxValue = 1\n"
" - Black: Tolerance = 1, minSaturation = 0, maxSaturation = 0.1, minValue = 0, maxValue = 0.2",
group=None,
enabled=lambda node: node.algorithm.value == "HSV",
groupDesc=[
desc.FloatParam(
name="hsvHue",
label="Hue",
description="Hue value to isolate in [0,1] range.\n"
"0 = red, 0.33 = green, 0.66 = blue, 1 = red.",
semantic="color/hue",
value=0.33,
range=(0.0, 1.0, 0.01),
uid=[0]
),
desc.FloatParam(
name="hsvHueRange",
label="Tolerance",
description="Tolerance around the hue value to isolate.",
value=0.1,
range=(0.0, 1.0, 0.01),
uid=[0]
),
desc.FloatParam(
name="hsvMinSaturation",
label="Min Saturation",
description="Hue is meaningless if saturation is low. Do not mask pixels below this threshold.",
value=0.3,
range=(0.0, 1.0, 0.01),
uid=[0]
),
desc.FloatParam(
name="hsvMaxSaturation",
label="Max Saturation",
description="Do not mask pixels above this threshold. It might be useful to mask white/black pixels.",
value=1.0,
range=(0.0, 1.0, 0.01),
uid=[0]
),
desc.FloatParam(
name="hsvMinValue",
label="Min Value",
description="Hue is meaningless if the value is low. Do not mask pixels below this threshold.",
value=0.3,
range=(0.0, 1.0, 0.01),
uid=[0]
),
desc.FloatParam(
name="hsvMaxValue",
label="Max Value",
description="Do not mask pixels above this threshold. It might be useful to mask white/black pixels.",
value=1.0,
range=(0.0, 1.0, 0.01),
uid=[0]
),
]
),
desc.BoolParam(
name="invert",
label="Invert",
description="If selected, the selected area is ignored.\n"
"If not, only the selected area is considered.",
value=True,
uid=[0]
),
desc.IntParam(
name="growRadius",
label="Grow Radius",
description="Grow the selected area.\n"
"It might be used to fill the holes: then use shrinkRadius to restore the initial coutours.",
value=0,
range=(0, 50, 1),
uid=[0]
),
desc.IntParam(
name="shrinkRadius",
label="Shrink Radius",
description="Shrink the selected area.",
value=0,
range=(0, 50, 1),
uid=[0]
),
desc.File(
name="depthMapFolder",
label="Depth Mask Folder",
description="Depth mask folder.",
value="",
uid=[0],
),
desc.StringParam(
name="depthMapExp",
label="Depth Mask Expression",
description="Depth mask expression, like '{inputFolder}/{stem}-depth.{ext}'.",
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="Output",
description="Output folder.",
value=desc.Node.internalFolder,
uid=[],
),
]