Skip to content

Commit

Permalink
Merge pull request #2243 from alicevision/dev/ps_sh
Browse files Browse the repository at this point in the history
[Photometric Stereo] MultiView fusion in Texturing
  • Loading branch information
fabiencastan authored Sep 6, 2024
2 parents 431e480 + 24a623a commit 4502e98
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 36 deletions.
24 changes: 20 additions & 4 deletions meshroom/nodes/aliceVision/LightingCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class LightingCalibration(desc.CommandLineNode):
commandLine = 'aliceVision_lightingCalibration {allParams}'
category = 'Photometry'
category = 'Photometric Stereo'
documentation = '''
Evaluate the lighting in a scene using spheres placed in the scene.
Can also be used to calibrate a lighting dome (RTI type).
Expand All @@ -21,7 +21,7 @@ class LightingCalibration(desc.CommandLineNode):
uid=[0],
),
desc.File(
name="inputJSON",
name="inputDetection",
label="Sphere Detection File",
description="Input JSON file containing sphere centers and radiuses.",
value="",
Expand All @@ -34,12 +34,20 @@ class LightingCalibration(desc.CommandLineNode):
value=False,
uid=[0],
),
desc.BoolParam(
name="ellipticEstimation",
label="Use elliptic estimation",
description="Consider the right projection of the sphere. Fit the circle tool on the small axe of the ellipse.",
value=False,
uid=[0],
),
desc.ChoiceParam(
name="method",
label="Calibration Method",
description="Method used for light calibration.\n"
"Use 'brightestPoint' for shiny spheres and 'whiteSphere' for white matte spheres.",
values=["brightestPoint", "whiteSphere"],
"Use 'brightestPoint' for shiny spheres and 'whiteSphere' for white matte spheres.\n"
"Spherical Harmonic lighting can be estimated using 'SH' method.",
values=["brightestPoint", "whiteSphere", "SH"],
value="brightestPoint",
exclusive=True,
uid=[0],
Expand All @@ -63,4 +71,12 @@ class LightingCalibration(desc.CommandLineNode):
value=desc.Node.internalFolder + "/lights.json",
uid=[],
),
desc.File(
name="lightingEstimationVisualization",
label="Estimated Lighting Visualization",
description="Estimated Lighting Visualization.",
semantic="image",
value=desc.Node.internalFolder + "/<FILESTEM>_{methodValue}.png",
uid=[],
),
]
16 changes: 9 additions & 7 deletions meshroom/nodes/aliceVision/NormalIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

class NormalIntegration(desc.CommandLineNode):
commandLine = 'aliceVision_normalIntegration {allParams}'
category = 'Photometry'
category = 'Photometric Stereo'
documentation = '''
TODO.
Evaluate a depth map from a normals map (currently in development)
'''

inputs = [
Expand Down Expand Up @@ -47,10 +47,12 @@ class NormalIntegration(desc.CommandLineNode):

outputs = [
desc.File(
name="outputPath",
label="Output Path",
description="Path to the output folder.",
value=desc.Node.internalFolder,
name="depthMap",
label="Depth Map Camera",
description="Generated depth in the camera coordinate system.",
semantic="image",
value=desc.Node.internalFolder + "<POSE_ID>_depthMap.exr",
uid=[],
),
group="", # do not export on the command line
)
]
38 changes: 24 additions & 14 deletions meshroom/nodes/aliceVision/PhotometricStereo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class PhotometricStereo(desc.CommandLineNode):
commandLine = 'aliceVision_photometricStereo {allParams}'
category = 'Photometry'
category = 'Photometric Stereo'
documentation = '''
Reconstruction using Photometric Stereo. A normal map is evaluated from several photographs taken from the same point of view, but under different lighting conditions.
The lighting conditions are assumed to be known.
Expand Down Expand Up @@ -39,7 +39,7 @@ class PhotometricStereo(desc.CommandLineNode):
label="Spherical Harmonics Order",
description="Order of the spherical harmonics:\n"
" - 0: directional.\n"
" - 1: directional + ambiant.\n"
" - 1: directional + ambient.\n"
" - 2: second order spherical harmonics.",
values=["0", "1", "2"],
value="0",
Expand All @@ -48,9 +48,9 @@ class PhotometricStereo(desc.CommandLineNode):
uid=[0],
),
desc.BoolParam(
name="removeAmbiant",
label="Remove Ambiant Light",
description="True if the ambiant light is to be removed on the PS images, false otherwise.",
name="removeAmbient",
label="Remove Ambient Light",
description="True if the ambient light is to be removed on the PS images, false otherwise.",
value=False,
advanced=True,
uid=[0],
Expand Down Expand Up @@ -91,14 +91,6 @@ class PhotometricStereo(desc.CommandLineNode):
value=desc.Node.internalFolder,
uid=[],
),
desc.File(
name="outputSfmData",
label="SfMData",
description="Output path for the SfMData file.",
value=desc.Node.internalFolder + "/sfmData.sfm",
uid=[],
group="", # remove from command line
),
desc.File(
name="outputSfmDataAlbedo",
label="SfMData Albedo",
Expand All @@ -115,6 +107,14 @@ class PhotometricStereo(desc.CommandLineNode):
uid=[],
group="", # remove from command line
),
desc.File(
name="outputSfmDataNormalPNG",
label="SfMData Normal PNG",
description="Output SfMData file containing the normal maps information.",
value=desc.Node.internalFolder + "/normalMapsPNG.sfm",
uid=[],
group="", # remove from command line
),
# these attributes are only here to describe more accurately the output of the node
# by specifying that it generates 2 sequences of images
# (see in Viewer2D.qml how these attributes can be used)
Expand All @@ -127,6 +127,15 @@ class PhotometricStereo(desc.CommandLineNode):
uid=[],
group="", # do not export on the command line
),
desc.File(
name="normalsPNG",
label="Normal Maps Camera (in false colors)",
description="Generated normal maps in the camera coordinate system (in false colors).",
semantic="image",
value=desc.Node.internalFolder + "<POSE_ID>_normals.png",
uid=[],
group="", # do not export on the command line
),
desc.File(
name="normalsWorld",
label="Normal Maps World",
Expand All @@ -136,12 +145,13 @@ class PhotometricStereo(desc.CommandLineNode):
uid=[],
group="", # do not export on the command line
),

desc.File(
name="albedo",
label="Albedo Maps",
description="Generated albedo maps.",
semantic="image",
value=desc.Node.internalFolder + "<POSE_ID>_albedo.exr",
value=desc.Node.internalFolder + "<POSE_ID>_albedo.png",
uid=[],
group="", # do not export on the command line
),
Expand Down
10 changes: 5 additions & 5 deletions meshroom/nodes/aliceVision/SphereDetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class SphereDetection(desc.CommandLineNode):
commandLine = 'aliceVision_sphereDetection {allParams}'
category = 'Photometry'
category = 'Photometric Stereo'
documentation = '''
Detect spheres in pictures. These spheres will be used for lighting calibration.
Spheres can be automatically detected or manually defined in the interface.
Expand Down Expand Up @@ -91,9 +91,9 @@ class SphereDetection(desc.CommandLineNode):
outputs = [
desc.File(
name="output",
label="Output Folder",
label="Output Path",
description="Sphere detection information will be written here.",
value=desc.Node.internalFolder,
uid=[],
),
value=desc.Node.internalFolder + "/detection.json",
uid=[]
)
]
7 changes: 7 additions & 0 deletions meshroom/nodes/aliceVision/Texturing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class Texturing(desc.AVCommandLineNode):
value="",
uid=[0],
),
desc.File(
name="normalsFolder",
label="Normals Folder",
description="Use normal maps from a specific folder to texture the mesh.\nFilename should be : uid_normalMap.",
value="",
uid=[0],
),
desc.File(
name="inputMesh",
label="Mesh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"inputs": {
"inputPath": "{SphereDetection_1.input}",
"inputJSON": "{SphereDetection_1.output}"
"inputDetection": "{SphereDetection_1.output}"
}
},
"PhotometricStereo_1": {
Expand All @@ -51,12 +51,15 @@
],
"inputs": {
"inputFiles": [
"{PhotometricStereo_1.outputSfmData}",
"{PhotometricStereo_1.outputSfmDataNormal}",
"{PhotometricStereo_1.normals}",
"{PhotometricStereo_1.normalsWorld}",
"{PhotometricStereo_1.albedo}",
"{PhotometricStereo_1.outputSfmDataAlbedo}"
"{PhotometricStereo_1.outputSfmDataAlbedo}",
"{PhotometricStereo_1.inputPath}",
"{PhotometricStereo_1.outputSfmDataNormalPNG}",
"{PhotometricStereo_1.normalsPNG}",
"{PhotometricStereo_1.pathToJSONLightFile}"
]
}
},
Expand All @@ -72,4 +75,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ FocusScope {
json = null
if (activeNode.attribute("autoDetect").value) {
// auto detection enabled
var jsonPath = activeNode.attribute("output").value + "/detection.json"
var jsonPath = activeNode.attribute("output").value
Request.get(Filepath.stringToUrl(jsonPath), function(xhr) {
if (xhr.readyState === XMLHttpRequest.DONE) {
try {
Expand Down
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export PYTHONPATH=$MESHROOM_ROOT:$PYTHONPATH
# using alicevision built source
#export PATH=$PATH:/foo/build/Linux-x86_64/

python "$MESHROOM_ROOT/meshroom/ui"
python3 "$MESHROOM_ROOT/meshroom/ui"

0 comments on commit 4502e98

Please sign in to comment.