Skip to content

Commit

Permalink
Merge pull request #2165 from alicevision/dev/useSegmentationMasks
Browse files Browse the repository at this point in the history
[nodes] Masking: Handle file extensions for masks and mask inversion for `ImageSegmentation`
  • Loading branch information
mugulmd authored Aug 25, 2023
2 parents 6af1607 + be50145 commit 4890c05
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 70 deletions.
10 changes: 7 additions & 3 deletions meshroom/nodes/aliceVision/ImageSegmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ class ImageSegmentation(desc.AVCommandLineNode):
value="",
uid=[0],
),

desc.File(
name="modelPath",
label="Segmentation Model",
description="Weights file for the internal model.",
value="${ALICEVISION_SEMANTIC_SEGMENTATION_MODEL}",
uid=[0]
),

desc.ChoiceParam(
name="validClasses",
label="Classes",
Expand All @@ -52,7 +50,13 @@ class ImageSegmentation(desc.AVCommandLineNode):
exclusive=False,
uid=[0],
),

desc.BoolParam(
name="maskInvert",
label="Invert Masks",
description="Invert mask values. If selected, the pixels corresponding to the mask will be set to 0 instead of 255.",
value=False,
uid=[0],
),
desc.ChoiceParam(
name="verboseLevel",
label="Verbose Level",
Expand Down
11 changes: 10 additions & 1 deletion meshroom/nodes/aliceVision/MeshMasking.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.0"
__version__ = "1.1"

from meshroom.core import desc

Expand Down Expand Up @@ -47,6 +47,15 @@ class MeshMasking(desc.AVCommandLineNode):
label="Masks Folders",
description="Use masks from specific folder(s). Filename should be the same or the image UID.",
),
desc.ChoiceParam(
name="maskExtension",
label="Mask Extension",
description="File extension for the masks to use.",
value="png",
values=["exr", "jpg", "png"],
exclusive=True,
uid=[0]
),
desc.IntParam(
name="threshold",
label="Threshold",
Expand Down
11 changes: 10 additions & 1 deletion meshroom/nodes/aliceVision/PrepareDenseScene.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.0"
__version__ = "3.1"

from meshroom.core import desc

Expand Down Expand Up @@ -46,6 +46,15 @@ class PrepareDenseScene(desc.AVCommandLineNode):
label="Masks Folders",
description="Use masks from specific folder(s). Filename should be the same or the image UID.",
),
desc.ChoiceParam(
name="maskExtension",
label="Mask Extension",
description="File extension for the masks to use.",
value="png",
values=["exr", "jpg", "png"],
exclusive=True,
uid=[0]
),
desc.ChoiceParam(
name="outputFileType",
label="Output File Type",
Expand Down
72 changes: 38 additions & 34 deletions meshroom/pipelines/cameraTracking.mg
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
"fileVersion": "1.1",
"template": true,
"nodesVersions": {
"MeshDecimate": "1.0",
"Texturing": "6.0",
"ExportDistortion": "1.0",
"CameraInit": "9.0",
"ImageMatchingMultiSfM": "1.0",
"DepthMap": "4.0",
"SfMTriangulation": "1.0",
"StructureFromMotion": "3.1",
"FeatureExtraction": "1.3",
"ApplyCalibration": "1.0",
"SfMTriangulation": "1.0",
"Publish": "1.3",
"DepthMap": "4.0",
"DistortionCalibration": "3.0",
"DepthMapFilter": "3.0",
"ImageSegmentation": "1.0",
"CheckerboardDetection": "1.0",
"Texturing": "6.0",
"PrepareDenseScene": "3.1",
"KeyframeSelection": "4.1",
"ScenePreview": "1.0",
"DepthMapFilter": "3.0",
"MeshDecimate": "1.0",
"MeshFiltering": "3.0",
"SfMTransfer": "2.1",
"Publish": "1.3",
"ImageMatchingMultiSfM": "1.0",
"FeatureMatching": "2.0",
"Meshing": "7.0",
"PrepareDenseScene": "3.0",
"CameraInit": "9.0",
"ImageMatching": "2.0",
"KeyframeSelection": "4.1",
"CheckerboardDetection": "1.0",
"ConvertSfMFormat": "2.0",
"ExportAnimatedCamera": "2.0",
"FeatureMatching": "2.0",
"SfMTransfer": "2.1",
"MeshFiltering": "3.0"
"DistortionCalibration": "3.0",
"ExportDistortion": "1.0",
"FeatureExtraction": "1.3",
"ImageSegmentation": "1.0"
}
},
"graph": {
Expand Down Expand Up @@ -81,8 +81,7 @@
"inputs": {
"input": "{ApplyCalibration_1.output}",
"masksFolder": "{ImageSegmentation_1.output}",
"maskExtension": "exr",
"maskInvert": true
"maskExtension": "exr"
},
"internalInputs": {
"color": "#575963"
Expand Down Expand Up @@ -193,7 +192,11 @@
0
],
"inputs": {
"input": "{SfMTriangulation_1.output}"
"input": "{SfMTriangulation_1.output}",
"masksFolders": [
"{ImageSegmentation_1.output}"
],
"maskExtension": "exr"
},
"internalInputs": {
"color": "#3f3138"
Expand Down Expand Up @@ -407,6 +410,20 @@
"color": "#80766f"
}
},
"ImageSegmentation_1": {
"nodeType": "ImageSegmentation",
"position": [
0,
200
],
"inputs": {
"input": "{CameraInit_1.output}",
"maskInvert": true
},
"internalInputs": {
"color": "#575963"
}
},
"StructureFromMotion_2": {
"nodeType": "StructureFromMotion",
"position": [
Expand Down Expand Up @@ -489,19 +506,6 @@
"label": "FeatureMatchingFramesToKeyframes",
"color": "#80766f"
}
},
"ImageSegmentation_1": {
"nodeType": "ImageSegmentation",
"position": [
0,
200
],
"inputs": {
"input": "{CameraInit_1.output}"
},
"internalInputs": {
"color": "#575963"
}
}
}
}
62 changes: 31 additions & 31 deletions meshroom/pipelines/photogrammetryAndCameraTracking.mg
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
"fileVersion": "1.1",
"template": true,
"nodesVersions": {
"MeshDecimate": "1.0",
"Texturing": "6.0",
"ExportDistortion": "1.0",
"CameraInit": "9.0",
"ImageMatchingMultiSfM": "1.0",
"DepthMap": "4.0",
"StructureFromMotion": "3.1",
"FeatureExtraction": "1.3",
"ApplyCalibration": "1.0",
"Publish": "1.3",
"DepthMap": "4.0",
"DistortionCalibration": "3.0",
"DepthMapFilter": "3.0",
"ImageSegmentation": "1.0",
"CheckerboardDetection": "1.0",
"Texturing": "6.0",
"PrepareDenseScene": "3.1",
"KeyframeSelection": "4.1",
"ScenePreview": "1.0",
"DepthMapFilter": "3.0",
"MeshDecimate": "1.0",
"MeshFiltering": "3.0",
"Publish": "1.3",
"ImageMatchingMultiSfM": "1.0",
"FeatureMatching": "2.0",
"Meshing": "7.0",
"PrepareDenseScene": "3.0",
"CameraInit": "9.0",
"ImageMatching": "2.0",
"KeyframeSelection": "4.1",
"CheckerboardDetection": "1.0",
"ConvertSfMFormat": "2.0",
"ExportAnimatedCamera": "2.0",
"FeatureMatching": "2.0",
"MeshFiltering": "3.0"
"DistortionCalibration": "3.0",
"ExportDistortion": "1.0",
"FeatureExtraction": "1.3",
"ImageSegmentation": "1.0"
}
},
"graph": {
Expand All @@ -52,8 +52,7 @@
"inputs": {
"input": "{ApplyCalibration_1.output}",
"masksFolder": "{ImageSegmentation_1.output}",
"maskExtension": "exr",
"maskInvert": true
"maskExtension": "exr"
},
"internalInputs": {
"color": "#575963"
Expand Down Expand Up @@ -288,6 +287,20 @@
"color": "#80766f"
}
},
"ImageSegmentation_1": {
"nodeType": "ImageSegmentation",
"position": [
0,
200
],
"inputs": {
"input": "{CameraInit_1.output}",
"maskInvert": true
},
"internalInputs": {
"color": "#575963"
}
},
"StructureFromMotion_2": {
"nodeType": "StructureFromMotion",
"position": [
Expand Down Expand Up @@ -565,19 +578,6 @@
"internalInputs": {
"color": "#575963"
}
},
"ImageSegmentation_1": {
"nodeType": "ImageSegmentation",
"position": [
0,
200
],
"inputs": {
"input": "{CameraInit_1.output}"
},
"internalInputs": {
"color": "#575963"
}
}
}
}

0 comments on commit 4890c05

Please sign in to comment.