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): class LightingCalibration(desc.CommandLineNode):
commandLine = 'aliceVision_lightingCalibration {allParams}' commandLine = 'aliceVision_lightingCalibration {allParams}'
category = 'Photometry' category = 'Photometric Stereo'
documentation = ''' documentation = '''
Evaluate the lighting in a scene using spheres placed in the scene. Evaluate the lighting in a scene using spheres placed in the scene.
Can also be used to calibrate a lighting dome (RTI type). 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], uid=[0],
), ),
desc.File( desc.File(
name="inputJSON", name="inputDetection",
label="Sphere Detection File", label="Sphere Detection File",
description="Input JSON file containing sphere centers and radiuses.", description="Input JSON file containing sphere centers and radiuses.",
value="", value="",
@ -34,12 +34,20 @@ Can also be used to calibrate a lighting dome (RTI type).
value=False, value=False,
uid=[0], 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( desc.ChoiceParam(
name="method", name="method",
label="Calibration Method", label="Calibration Method",
description="Method used for light calibration.\n" description="Method used for light calibration.\n"
"Use 'brightestPoint' for shiny spheres and 'whiteSphere' for white matte spheres.", "Use 'brightestPoint' for shiny spheres and 'whiteSphere' for white matte spheres.\n"
values=["brightestPoint", "whiteSphere"], "Spherical Harmonic lighting can be estimated using 'SH' method.",
values=["brightestPoint", "whiteSphere", "SH"],
value="brightestPoint", value="brightestPoint",
exclusive=True, exclusive=True,
uid=[0], uid=[0],
@ -63,4 +71,12 @@ Can also be used to calibrate a lighting dome (RTI type).
value=desc.Node.internalFolder + "/lights.json", value=desc.Node.internalFolder + "/lights.json",
uid=[], 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): class NormalIntegration(desc.CommandLineNode):
commandLine = 'aliceVision_normalIntegration {allParams}' commandLine = 'aliceVision_normalIntegration {allParams}'
category = 'Photometry' category = 'Photometric Stereo'
documentation = ''' documentation = '''
TODO. Evaluate a depth map from a normals map (currently in development)
''' '''
inputs = [ inputs = [
@ -47,10 +47,12 @@ TODO.
outputs = [ outputs = [
desc.File( desc.File(
name="outputPath", name="depthMap",
label="Output Path", label="Depth Map Camera",
description="Path to the output folder.", description="Generated depth in the camera coordinate system.",
value=desc.Node.internalFolder, semantic="image",
value=desc.Node.internalFolder + "<POSE_ID>_depthMap.exr",
uid=[], 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): class PhotometricStereo(desc.CommandLineNode):
commandLine = 'aliceVision_photometricStereo {allParams}' commandLine = 'aliceVision_photometricStereo {allParams}'
category = 'Photometry' category = 'Photometric Stereo'
documentation = ''' 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. 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. The lighting conditions are assumed to be known.
@ -39,7 +39,7 @@ The lighting conditions are assumed to be known.
label="Spherical Harmonics Order", label="Spherical Harmonics Order",
description="Order of the spherical harmonics:\n" description="Order of the spherical harmonics:\n"
" - 0: directional.\n" " - 0: directional.\n"
" - 1: directional + ambiant.\n" " - 1: directional + ambient.\n"
" - 2: second order spherical harmonics.", " - 2: second order spherical harmonics.",
values=["0", "1", "2"], values=["0", "1", "2"],
value="0", value="0",
@ -48,9 +48,9 @@ The lighting conditions are assumed to be known.
uid=[0], uid=[0],
), ),
desc.BoolParam( desc.BoolParam(
name="removeAmbiant", name="removeAmbient",
label="Remove Ambiant Light", label="Remove Ambient Light",
description="True if the ambiant light is to be removed on the PS images, false otherwise.", description="True if the ambient light is to be removed on the PS images, false otherwise.",
value=False, value=False,
advanced=True, advanced=True,
uid=[0], uid=[0],
@ -91,14 +91,6 @@ The lighting conditions are assumed to be known.
value=desc.Node.internalFolder, value=desc.Node.internalFolder,
uid=[], 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( desc.File(
name="outputSfmDataAlbedo", name="outputSfmDataAlbedo",
label="SfMData Albedo", label="SfMData Albedo",
@ -115,6 +107,14 @@ The lighting conditions are assumed to be known.
uid=[], uid=[],
group="", # remove from command line 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 # these attributes are only here to describe more accurately the output of the node
# by specifying that it generates 2 sequences of images # by specifying that it generates 2 sequences of images
# (see in Viewer2D.qml how these attributes can be used) # (see in Viewer2D.qml how these attributes can be used)
@ -127,6 +127,15 @@ The lighting conditions are assumed to be known.
uid=[], uid=[],
group="", # do not export on the command line 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( desc.File(
name="normalsWorld", name="normalsWorld",
label="Normal Maps World", label="Normal Maps World",
@ -136,12 +145,13 @@ The lighting conditions are assumed to be known.
uid=[], uid=[],
group="", # do not export on the command line group="", # do not export on the command line
), ),
desc.File( desc.File(
name="albedo", name="albedo",
label="Albedo Maps", label="Albedo Maps",
description="Generated albedo maps.", description="Generated albedo maps.",
semantic="image", semantic="image",
value=desc.Node.internalFolder + "<POSE_ID>_albedo.exr", value=desc.Node.internalFolder + "<POSE_ID>_albedo.png",
uid=[], uid=[],
group="", # do not export on the command line 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): class SphereDetection(desc.CommandLineNode):
commandLine = 'aliceVision_sphereDetection {allParams}' commandLine = 'aliceVision_sphereDetection {allParams}'
category = 'Photometry' category = 'Photometric Stereo'
documentation = ''' documentation = '''
Detect spheres in pictures. These spheres will be used for lighting calibration. Detect spheres in pictures. These spheres will be used for lighting calibration.
Spheres can be automatically detected or manually defined in the interface. 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 = [ outputs = [
desc.File( desc.File(
name="output", name="output",
label="Output Folder", label="Output Path",
description="Sphere detection information will be written here.", description="Sphere detection information will be written here.",
value=desc.Node.internalFolder, value=desc.Node.internalFolder + "/detection.json",
uid=[], uid=[]
), )
] ]

View file

@ -41,6 +41,13 @@ Many cameras are contributing to the low frequencies and only the best ones cont
value="", value="",
uid=[0], 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( desc.File(
name="inputMesh", name="inputMesh",
label="Mesh", label="Mesh",

View file

@ -29,7 +29,7 @@
], ],
"inputs": { "inputs": {
"inputPath": "{SphereDetection_1.input}", "inputPath": "{SphereDetection_1.input}",
"inputJSON": "{SphereDetection_1.output}" "inputDetection": "{SphereDetection_1.output}"
} }
}, },
"PhotometricStereo_1": { "PhotometricStereo_1": {
@ -51,12 +51,15 @@
], ],
"inputs": { "inputs": {
"inputFiles": [ "inputFiles": [
"{PhotometricStereo_1.outputSfmData}",
"{PhotometricStereo_1.outputSfmDataNormal}", "{PhotometricStereo_1.outputSfmDataNormal}",
"{PhotometricStereo_1.normals}", "{PhotometricStereo_1.normals}",
"{PhotometricStereo_1.normalsWorld}", "{PhotometricStereo_1.normalsWorld}",
"{PhotometricStereo_1.albedo}", "{PhotometricStereo_1.albedo}",
"{PhotometricStereo_1.outputSfmDataAlbedo}" "{PhotometricStereo_1.outputSfmDataAlbedo}",
"{PhotometricStereo_1.inputPath}",
"{PhotometricStereo_1.outputSfmDataNormalPNG}",
"{PhotometricStereo_1.normalsPNG}",
"{PhotometricStereo_1.pathToJSONLightFile}"
] ]
} }
}, },
@ -72,4 +75,4 @@
} }
} }
} }
} }

View file

@ -714,7 +714,7 @@ FocusScope {
json = null json = null
if (activeNode.attribute("autoDetect").value) { if (activeNode.attribute("autoDetect").value) {
// auto detection enabled // auto detection enabled
var jsonPath = activeNode.attribute("output").value + "/detection.json" var jsonPath = activeNode.attribute("output").value
Request.get(Filepath.stringToUrl(jsonPath), function(xhr) { Request.get(Filepath.stringToUrl(jsonPath), function(xhr) {
if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.readyState === XMLHttpRequest.DONE) {
try { try {

View file

@ -9,4 +9,4 @@ export PYTHONPATH=$MESHROOM_ROOT:$PYTHONPATH
# using alicevision built source # using alicevision built source
#export PATH=$PATH:/foo/build/Linux-x86_64/ #export PATH=$PATH:/foo/build/Linux-x86_64/
python "$MESHROOM_ROOT/meshroom/ui" python3 "$MESHROOM_ROOT/meshroom/ui"