Merge pull request #2243 from alicevision/dev/ps_sh

[Photometric Stereo] MultiView fusion in Texturing
This commit is contained in:
Fabien Castan 2024-09-06 22:03:39 +02:00 committed by GitHub
commit 4502e98a4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 74 additions and 36 deletions

View file

@ -6,7 +6,7 @@ from meshroom.core.utils import VERBOSE_LEVEL
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).
@ -21,7 +21,7 @@ Can also be used to calibrate a lighting dome (RTI type).
uid=[0],
),
desc.File(
name="inputJSON",
name="inputDetection",
label="Sphere Detection File",
description="Input JSON file containing sphere centers and radiuses.",
value="",
@ -34,12 +34,20 @@ Can also be used to calibrate a lighting dome (RTI type).
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],
@ -63,4 +71,12 @@ Can also be used to calibrate a lighting dome (RTI type).
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=[],
),
]

View file

@ -5,9 +5,9 @@ from meshroom.core.utils import VERBOSE_LEVEL
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 = [
@ -47,10 +47,12 @@ TODO.
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
)
]

View file

@ -5,7 +5,7 @@ from meshroom.core.utils import VERBOSE_LEVEL
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.
@ -39,7 +39,7 @@ The lighting conditions are assumed to be known.
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",
@ -48,9 +48,9 @@ The lighting conditions are assumed to be known.
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],
@ -91,14 +91,6 @@ The lighting conditions are assumed to be known.
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",
@ -115,6 +107,14 @@ The lighting conditions are assumed to be known.
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)
@ -127,6 +127,15 @@ The lighting conditions are assumed to be known.
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",
@ -136,12 +145,13 @@ The lighting conditions are assumed to be known.
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
),

View file

@ -6,7 +6,7 @@ from meshroom.core.utils import VERBOSE_LEVEL
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.
@ -91,9 +91,9 @@ Spheres can be automatically detected or manually defined in the interface.
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=[]
)
]

View file

@ -41,6 +41,13 @@ Many cameras are contributing to the low frequencies and only the best ones cont
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",

View file

@ -29,7 +29,7 @@
],
"inputs": {
"inputPath": "{SphereDetection_1.input}",
"inputJSON": "{SphereDetection_1.output}"
"inputDetection": "{SphereDetection_1.output}"
}
},
"PhotometricStereo_1": {
@ -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}"
]
}
},

View file

@ -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 {

View file

@ -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"