From 88078a6d67d740ac1ded9a766429acdc7517fc12 Mon Sep 17 00:00:00 2001 From: mh0g Date: Thu, 8 Dec 2022 15:37:01 +0100 Subject: [PATCH 1/6] started node triangulate based on sfm node --- meshroom/nodes/aliceVision/Triangulate.py | 325 ++++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 meshroom/nodes/aliceVision/Triangulate.py diff --git a/meshroom/nodes/aliceVision/Triangulate.py b/meshroom/nodes/aliceVision/Triangulate.py new file mode 100644 index 0000000000..f8f7d5ff9d --- /dev/null +++ b/meshroom/nodes/aliceVision/Triangulate.py @@ -0,0 +1,325 @@ +__version__ = "2.0" + +from meshroom.core import desc + + +class Triangulate(desc.AVCommandLineNode): + commandLine = 'aliceVision_triangulate {allParams}' + size = desc.DynamicNodeSize('input') + + category = 'Sparse Reconstruction' + documentation = ''' +''' + + inputs = [ + desc.File( + name='input', + label='SfMData', + description='SfMData file.', + value='', + uid=[0], + ), + desc.ListAttribute( + elementDesc=desc.File( + name="featuresFolder", + label="Features Folder", + description="", + value="", + uid=[0], + ), + name="featuresFolders", + label="Features Folders", + description="Folder(s) containing the extracted features and descriptors." + ), + desc.ListAttribute( + elementDesc=desc.File( + name="matchesFolder", + label="Matches Folder", + description="", + value="", + uid=[0], + ), + name="matchesFolders", + label="Matches Folders", + description="Folder(s) in which computed matches are stored." + ), + desc.ChoiceParam( + name='describerTypes', + label='Describer Types', + description='Describer types used to describe an image.', + value=['dspsift'], + values=['sift', 'sift_float', 'sift_upright', 'dspsift', 'akaze', 'akaze_liop', 'akaze_mldb', 'cctag3', 'cctag4', 'sift_ocv', 'akaze_ocv', 'tag16h5'], + exclusive=False, + uid=[0], + joinChar=',', + ), + desc.ChoiceParam( + name='localizerEstimator', + label='Localizer Estimator', + description='Estimator type used to localize cameras (acransac, ransac, lsmeds, loransac, maxconsensus).', + value='acransac', + values=['acransac', 'ransac', 'lsmeds', 'loransac', 'maxconsensus'], + exclusive=True, + uid=[0], + advanced=True, + ), + desc.ChoiceParam( + name='observationConstraint', + label='Observation Constraint', + description='Observation constraint mode used in the optimization:\n' + ' * Basic: Use standard reprojection error in pixel coordinates\n' + ' * Scale: Use reprojection error in pixel coordinates but relative to the feature scale', + value='Scale', + values=['Basic', 'Scale'], + exclusive=True, + uid=[0], + advanced=True, + ), + desc.IntParam( + name='localizerEstimatorMaxIterations', + label='Localizer Max Ransac Iterations', + description='Maximum number of iterations allowed in ransac step.', + value=4096, + range=(1, 20000, 1), + uid=[0], + advanced=True, + ), + desc.FloatParam( + name='localizerEstimatorError', + label='Localizer Max Ransac Error', + description='Maximum error (in pixels) allowed for camera localization (resectioning).\n' + 'If set to 0, it will select a threshold according to the localizer estimator used\n' + '(if ACRansac, it will analyze the input data to select the optimal value).', + value=0.0, + range=(0.0, 100.0, 0.1), + uid=[0], + advanced=True, + ), + desc.BoolParam( + name='lockScenePreviouslyReconstructed', + label='Lock Scene Previously Reconstructed', + description='This option is useful for SfM augmentation. Lock previously reconstructed poses and intrinsics.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='useLocalBA', + label='Local Bundle Adjustment', + description='It reduces the reconstruction time, especially for large datasets (500+ images),\n' + 'by avoiding computation of the Bundle Adjustment on areas that are not changing.', + value=True, + uid=[0], + ), + desc.IntParam( + name='localBAGraphDistance', + label='LocalBA Graph Distance', + description='Graph-distance limit to define the Active region in the Local Bundle Adjustment strategy.', + value=1, + range=(2, 10, 1), + uid=[0], + advanced=True, + ), + desc.IntParam( + name='maxNumberOfMatches', + label='Maximum Number of Matches', + description='Maximum number of matches per image pair (and per feature type). \n' + 'This can be useful to have a quick reconstruction overview. \n' + '0 means no limit.', + value=0, + range=(0, 50000, 1), + uid=[0], + ), + desc.IntParam( + name='minNumberOfMatches', + label='Minimum Number of Matches', + description='Minimum number of matches per image pair (and per feature type). \n' + 'This can be useful to have a meaningful reconstruction with accurate keypoints. 0 means no limit.', + value=0, + range=(0, 50000, 1), + uid=[0], + ), + desc.IntParam( + name='minInputTrackLength', + label='Min Input Track Length', + description='Minimum track length in input of SfM', + value=2, + range=(2, 10, 1), + uid=[0], + ), + desc.IntParam( + name='minNumberOfObservationsForTriangulation', + label='Min Observation For Triangulation', + description='Minimum number of observations to triangulate a point.\n' + 'Set it to 3 (or more) reduces drastically the noise in the point cloud,\n' + 'but the number of final poses is a little bit reduced\n' + '(from 1.5% to 11% on the tested datasets).', + value=2, + range=(2, 10, 1), + uid=[0], + advanced=True, + ), + desc.FloatParam( + name='minAngleForTriangulation', + label='Min Angle For Triangulation', + description='Minimum angle for triangulation.', + value=3.0, + range=(0.1, 10.0, 0.1), + uid=[0], + advanced=True, + ), + desc.FloatParam( + name='minAngleForLandmark', + label='Min Angle For Landmark', + description='Minimum angle for landmark.', + value=2.0, + range=(0.1, 10.0, 0.1), + uid=[0], + advanced=True, + ), + desc.FloatParam( + name='maxReprojectionError', + label='Max Reprojection Error', + description='Maximum reprojection error.', + value=4.0, + range=(0.1, 10.0, 0.1), + uid=[0], + advanced=True, + ), + desc.FloatParam( + name='minAngleInitialPair', + label='Min Angle Initial Pair', + description='Minimum angle for the initial pair.', + value=5.0, + range=(0.1, 10.0, 0.1), + uid=[0], + advanced=True, + ), + desc.FloatParam( + name='maxAngleInitialPair', + label='Max Angle Initial Pair', + description='Maximum angle for the initial pair.', + value=40.0, + range=(0.1, 60.0, 0.1), + uid=[0], + advanced=True, + ), + desc.BoolParam( + name='useOnlyMatchesFromInputFolder', + label='Use Only Matches From Input Folder', + description='Use only matches from the input matchesFolder parameter.\n' + 'Matches folders previously added to the SfMData file will be ignored.', + value=False, + uid=[], + advanced=True, + ), + desc.BoolParam( + name='useRigConstraint', + label='Use Rig Constraint', + description='Enable/Disable rig constraint.', + value=True, + uid=[0], + advanced=True, + ), + desc.IntParam( + name='rigMinNbCamerasForCalibration', + label='Min Nb Cameras For Rig Calibration', + description='Minimal number of cameras to start the calibration of the rig', + value=20, + range=(1, 50, 1), + uid=[0], + advanced=True, + ), + desc.BoolParam( + name='lockAllIntrinsics', + label='Force Lock of All Intrinsic Camera Parameters', + description='Force to keep constant all the intrinsics parameters of the cameras (focal length, \n' + 'principal point, distortion if any) during the reconstruction.\n' + 'This may be helpful if the input cameras are already fully calibrated.', + value=False, + uid=[0], + ), + desc.IntParam( + name='minNbCamerasToRefinePrincipalPoint', + label='Min Nb Cameras To Refine Principal Point', + description='Minimal number of cameras to refine the principal point of the cameras (one of the intrinsic parameters of the camera). ' + 'If we do not have enough cameras, the principal point in consider is considered in the center of the image. ' + 'If minNbCamerasToRefinePrincipalPoint<=0, the principal point is never refined. ' + 'If minNbCamerasToRefinePrincipalPoint==1, the principal point is always refined.', + value=3, + range=(0, 20, 1), + uid=[0], + advanced=True, + ), + desc.BoolParam( + name='filterTrackForks', + label='Filter Track Forks', + description='Enable/Disable the track forks removal. A track contains a fork when incoherent matches \n' + 'lead to multiple features in the same image for a single track. \n', + value=False, + uid=[0], + ), + desc.BoolParam( + name='computeStructureColor', + label='Compute Structure Color', + description='Enable/Disable color computation of each 3D point.', + value=True, + uid=[0], + ), + desc.File( + name='initialPairA', + label='Initial Pair A', + description='Filename of the first image (without path).', + value='', + uid=[0], + ), + desc.File( + name='initialPairB', + label='Initial Pair B', + description='Filename of the second image (without path).', + value='', + uid=[0], + ), + desc.ChoiceParam( + name='interFileExtension', + label='Inter File Extension', + description='Extension of the intermediate file export.', + value='.abc', + values=('.abc', '.ply'), + exclusive=True, + uid=[], + advanced=True, + ), + 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='SfMData', + description='Path to the output sfmdata file', + value=desc.Node.internalFolder + 'sfm.abc', + uid=[], + ), + desc.File( + name='outputViewsAndPoses', + label='Views and Poses', + description='''Path to the output sfmdata file with cameras (views and poses).''', + value=desc.Node.internalFolder + 'cameras.sfm', + uid=[], + ), + desc.File( + name='extraInfoFolder', + label='Folder', + description='Folder for intermediate reconstruction files and additional reconstruction information files.', + value=desc.Node.internalFolder, + uid=[], + ), + ] From 8911413afb79cf383aed12b34014e9253a40e738 Mon Sep 17 00:00:00 2001 From: mh0g Date: Tue, 13 Dec 2022 10:59:25 +0100 Subject: [PATCH 2/6] added doc line --- meshroom/nodes/aliceVision/Triangulate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meshroom/nodes/aliceVision/Triangulate.py b/meshroom/nodes/aliceVision/Triangulate.py index f8f7d5ff9d..ecaa1dd16a 100644 --- a/meshroom/nodes/aliceVision/Triangulate.py +++ b/meshroom/nodes/aliceVision/Triangulate.py @@ -8,8 +8,7 @@ class Triangulate(desc.AVCommandLineNode): size = desc.DynamicNodeSize('input') category = 'Sparse Reconstruction' - documentation = ''' -''' + documentation = '''Perfom keypoint triangulation (similarly to what is done in the SfM)''' inputs = [ desc.File( From 57b78f8ddf11a9cdd03c19b5a6c10130247510c3 Mon Sep 17 00:00:00 2001 From: mh0g Date: Mon, 19 Dec 2022 15:17:01 +0100 Subject: [PATCH 3/6] started cleanup of sfm arguments --- meshroom/nodes/aliceVision/Triangulate.py | 162 +--------------------- 1 file changed, 1 insertion(+), 161 deletions(-) diff --git a/meshroom/nodes/aliceVision/Triangulate.py b/meshroom/nodes/aliceVision/Triangulate.py index ecaa1dd16a..334f73fb2d 100644 --- a/meshroom/nodes/aliceVision/Triangulate.py +++ b/meshroom/nodes/aliceVision/Triangulate.py @@ -8,7 +8,7 @@ class Triangulate(desc.AVCommandLineNode): size = desc.DynamicNodeSize('input') category = 'Sparse Reconstruction' - documentation = '''Perfom keypoint triangulation (similarly to what is done in the SfM)''' + documentation = '''Perfom keypoint triangulation (as it is done in the SfM)''' inputs = [ desc.File( @@ -52,72 +52,6 @@ class Triangulate(desc.AVCommandLineNode): uid=[0], joinChar=',', ), - desc.ChoiceParam( - name='localizerEstimator', - label='Localizer Estimator', - description='Estimator type used to localize cameras (acransac, ransac, lsmeds, loransac, maxconsensus).', - value='acransac', - values=['acransac', 'ransac', 'lsmeds', 'loransac', 'maxconsensus'], - exclusive=True, - uid=[0], - advanced=True, - ), - desc.ChoiceParam( - name='observationConstraint', - label='Observation Constraint', - description='Observation constraint mode used in the optimization:\n' - ' * Basic: Use standard reprojection error in pixel coordinates\n' - ' * Scale: Use reprojection error in pixel coordinates but relative to the feature scale', - value='Scale', - values=['Basic', 'Scale'], - exclusive=True, - uid=[0], - advanced=True, - ), - desc.IntParam( - name='localizerEstimatorMaxIterations', - label='Localizer Max Ransac Iterations', - description='Maximum number of iterations allowed in ransac step.', - value=4096, - range=(1, 20000, 1), - uid=[0], - advanced=True, - ), - desc.FloatParam( - name='localizerEstimatorError', - label='Localizer Max Ransac Error', - description='Maximum error (in pixels) allowed for camera localization (resectioning).\n' - 'If set to 0, it will select a threshold according to the localizer estimator used\n' - '(if ACRansac, it will analyze the input data to select the optimal value).', - value=0.0, - range=(0.0, 100.0, 0.1), - uid=[0], - advanced=True, - ), - desc.BoolParam( - name='lockScenePreviouslyReconstructed', - label='Lock Scene Previously Reconstructed', - description='This option is useful for SfM augmentation. Lock previously reconstructed poses and intrinsics.', - value=False, - uid=[0], - ), - desc.BoolParam( - name='useLocalBA', - label='Local Bundle Adjustment', - description='It reduces the reconstruction time, especially for large datasets (500+ images),\n' - 'by avoiding computation of the Bundle Adjustment on areas that are not changing.', - value=True, - uid=[0], - ), - desc.IntParam( - name='localBAGraphDistance', - label='LocalBA Graph Distance', - description='Graph-distance limit to define the Active region in the Local Bundle Adjustment strategy.', - value=1, - range=(2, 10, 1), - uid=[0], - advanced=True, - ), desc.IntParam( name='maxNumberOfMatches', label='Maximum Number of Matches', @@ -137,14 +71,6 @@ class Triangulate(desc.AVCommandLineNode): range=(0, 50000, 1), uid=[0], ), - desc.IntParam( - name='minInputTrackLength', - label='Min Input Track Length', - description='Minimum track length in input of SfM', - value=2, - range=(2, 10, 1), - uid=[0], - ), desc.IntParam( name='minNumberOfObservationsForTriangulation', label='Min Observation For Triangulation', @@ -175,42 +101,6 @@ class Triangulate(desc.AVCommandLineNode): uid=[0], advanced=True, ), - desc.FloatParam( - name='maxReprojectionError', - label='Max Reprojection Error', - description='Maximum reprojection error.', - value=4.0, - range=(0.1, 10.0, 0.1), - uid=[0], - advanced=True, - ), - desc.FloatParam( - name='minAngleInitialPair', - label='Min Angle Initial Pair', - description='Minimum angle for the initial pair.', - value=5.0, - range=(0.1, 10.0, 0.1), - uid=[0], - advanced=True, - ), - desc.FloatParam( - name='maxAngleInitialPair', - label='Max Angle Initial Pair', - description='Maximum angle for the initial pair.', - value=40.0, - range=(0.1, 60.0, 0.1), - uid=[0], - advanced=True, - ), - desc.BoolParam( - name='useOnlyMatchesFromInputFolder', - label='Use Only Matches From Input Folder', - description='Use only matches from the input matchesFolder parameter.\n' - 'Matches folders previously added to the SfMData file will be ignored.', - value=False, - uid=[], - advanced=True, - ), desc.BoolParam( name='useRigConstraint', label='Use Rig Constraint', @@ -228,35 +118,6 @@ class Triangulate(desc.AVCommandLineNode): uid=[0], advanced=True, ), - desc.BoolParam( - name='lockAllIntrinsics', - label='Force Lock of All Intrinsic Camera Parameters', - description='Force to keep constant all the intrinsics parameters of the cameras (focal length, \n' - 'principal point, distortion if any) during the reconstruction.\n' - 'This may be helpful if the input cameras are already fully calibrated.', - value=False, - uid=[0], - ), - desc.IntParam( - name='minNbCamerasToRefinePrincipalPoint', - label='Min Nb Cameras To Refine Principal Point', - description='Minimal number of cameras to refine the principal point of the cameras (one of the intrinsic parameters of the camera). ' - 'If we do not have enough cameras, the principal point in consider is considered in the center of the image. ' - 'If minNbCamerasToRefinePrincipalPoint<=0, the principal point is never refined. ' - 'If minNbCamerasToRefinePrincipalPoint==1, the principal point is always refined.', - value=3, - range=(0, 20, 1), - uid=[0], - advanced=True, - ), - desc.BoolParam( - name='filterTrackForks', - label='Filter Track Forks', - description='Enable/Disable the track forks removal. A track contains a fork when incoherent matches \n' - 'lead to multiple features in the same image for a single track. \n', - value=False, - uid=[0], - ), desc.BoolParam( name='computeStructureColor', label='Compute Structure Color', @@ -264,20 +125,6 @@ class Triangulate(desc.AVCommandLineNode): value=True, uid=[0], ), - desc.File( - name='initialPairA', - label='Initial Pair A', - description='Filename of the first image (without path).', - value='', - uid=[0], - ), - desc.File( - name='initialPairB', - label='Initial Pair B', - description='Filename of the second image (without path).', - value='', - uid=[0], - ), desc.ChoiceParam( name='interFileExtension', label='Inter File Extension', @@ -307,13 +154,6 @@ class Triangulate(desc.AVCommandLineNode): value=desc.Node.internalFolder + 'sfm.abc', uid=[], ), - desc.File( - name='outputViewsAndPoses', - label='Views and Poses', - description='''Path to the output sfmdata file with cameras (views and poses).''', - value=desc.Node.internalFolder + 'cameras.sfm', - uid=[], - ), desc.File( name='extraInfoFolder', label='Folder', From 0abd8f6289690131146eacb3807d2c186cc9a5d0 Mon Sep 17 00:00:00 2001 From: mh0g Date: Wed, 21 Dec 2022 14:48:57 +0100 Subject: [PATCH 4/6] [Nodes] cosmetic changes --- meshroom/nodes/aliceVision/Triangulate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/nodes/aliceVision/Triangulate.py b/meshroom/nodes/aliceVision/Triangulate.py index 334f73fb2d..222b95ff51 100644 --- a/meshroom/nodes/aliceVision/Triangulate.py +++ b/meshroom/nodes/aliceVision/Triangulate.py @@ -1,4 +1,4 @@ -__version__ = "2.0" +__version__ = "1.0" from meshroom.core import desc @@ -14,7 +14,7 @@ class Triangulate(desc.AVCommandLineNode): desc.File( name='input', label='SfMData', - description='SfMData file.', + description='SfMData file. Must contain the camera calibration.', value='', uid=[0], ), From fe967f0ff68edc27972cca3c5a01430db6e8d8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Wed, 4 Jan 2023 11:55:14 +0100 Subject: [PATCH 5/6] [nodes] renamed Triangulate to SfMTriangulation --- .../aliceVision/{Triangulate.py => SfMTriangulation.py} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename meshroom/nodes/aliceVision/{Triangulate.py => SfMTriangulation.py} (95%) diff --git a/meshroom/nodes/aliceVision/Triangulate.py b/meshroom/nodes/aliceVision/SfMTriangulation.py similarity index 95% rename from meshroom/nodes/aliceVision/Triangulate.py rename to meshroom/nodes/aliceVision/SfMTriangulation.py index 222b95ff51..851a20075c 100644 --- a/meshroom/nodes/aliceVision/Triangulate.py +++ b/meshroom/nodes/aliceVision/SfMTriangulation.py @@ -3,12 +3,15 @@ from meshroom.core import desc -class Triangulate(desc.AVCommandLineNode): +class SfMTriangulation(desc.AVCommandLineNode): commandLine = 'aliceVision_triangulate {allParams}' size = desc.DynamicNodeSize('input') category = 'Sparse Reconstruction' - documentation = '''Perfom keypoint triangulation (as it is done in the SfM)''' + documentation = ''' +This node perfoms keypoint triangulation on its input data. +Contrary to the StructureFromMotion node, this node does not infer the camera poses, therefore they must be given in the SfMData input. +''' inputs = [ desc.File( From 24bd035a532db1b5494bc9575f525da9efb07e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Mon, 9 Jan 2023 09:42:25 +0100 Subject: [PATCH 6/6] [nodes] update cmd line aliceVision_triangulate to aliceVision_sfmTriangulation --- meshroom/nodes/aliceVision/SfMTriangulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/nodes/aliceVision/SfMTriangulation.py b/meshroom/nodes/aliceVision/SfMTriangulation.py index 851a20075c..aad874bc82 100644 --- a/meshroom/nodes/aliceVision/SfMTriangulation.py +++ b/meshroom/nodes/aliceVision/SfMTriangulation.py @@ -4,7 +4,7 @@ class SfMTriangulation(desc.AVCommandLineNode): - commandLine = 'aliceVision_triangulate {allParams}' + commandLine = 'aliceVision_sfmTriangulation {allParams}' size = desc.DynamicNodeSize('input') category = 'Sparse Reconstruction'