Skip to content

Commit 9ec0a17

Browse files
committed
[nodes] SfMChecking: Rename node and minor process improvements
1 parent 51cddc5 commit 9ec0a17

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

meshroom/nodes/aliceVision/SfmChecking.py renamed to meshroom/nodes/aliceVision/SfMChecking.py

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
from meshroom.core import desc
44
from meshroom.core.utils import VERBOSE_LEVEL
5-
import os.path
65

76

7+
class SfMChecking(desc.Node):
88

9-
class SfmChecking(desc.Node):
10-
11-
category = 'Utils'
12-
documentation = '''
13-
Check an input Sfm for validity.
14-
Throw an error if the sfm does not satisfy constraints
15-
'''
9+
category = "Utils"
10+
documentation = """
11+
Check an input SfM for validity.
12+
Throw an error if the SfM does not satisfy constraints.
13+
"""
1614

1715
inputs = [
1816
desc.File(
@@ -22,8 +20,8 @@ class SfmChecking(desc.Node):
2220
value="",
2321
),
2422
desc.FloatParam(
25-
name="posecompletion",
26-
label="Completion percentage",
23+
name="poseCompletion",
24+
label="Completion Percentage",
2725
description="Minimal percent of the views reconstructed.",
2826
value=80.0,
2927
range=(0.0, 100.0, 1.0),
@@ -50,10 +48,9 @@ def processChunk(self, chunk):
5048
from pyalicevision import sfmData as avsfmdata
5149
from pyalicevision import sfmDataIO as avsfmdataio
5250

53-
error = False
54-
5551
chunk.logManager.start(chunk.node.verboseLevel.value)
56-
chunk.logger.error("open input")
52+
chunk.logger.info("Open input file")
53+
5754
data = avsfmdata.SfMData()
5855
ret = avsfmdataio.load(data, chunk.node.input.value, avsfmdataio.ALL)
5956
if not ret:
@@ -63,20 +60,18 @@ def processChunk(self, chunk):
6360

6461
total = len(data.getViews())
6562
valid = len(data.getValidViews())
66-
ratio = (100.0 * float(valid))/float(total)
63+
ratio = (100.0 * float(valid)) / float(total)
6764

68-
chunk.logger.info(f"Total views : {total}")
69-
chunk.logger.info(f"Reconstructed views : {valid}")
70-
chunk.logger.info(f"Percentage : {ratio}")
65+
chunk.logger.info(f"Total views: {total}")
66+
chunk.logger.info(f"Reconstructed views: {valid}")
67+
chunk.logger.info(f"Percentage of reconstructed views: {ratio}")
7168

72-
if ratio < chunk.node.posecompletion.value:
73-
chunk.logger.error("Percentage of reconstructed views is insufficient")
74-
error = True
69+
if ratio < chunk.node.poseCompletion.value:
70+
chunk.logger.error("Percentage of reconstructed views is insufficient.")
71+
chunk.logger.error(f"Expected {chunk.node.poseCompletion.value}, got {ratio}.")
72+
chunk.logManager.end()
73+
raise RuntimeError()
7574

7675
avsfmdataio.save(data, chunk.node.output.value, avsfmdataio.ALL)
77-
78-
chunk.logManager.end()
79-
80-
if error:
81-
raise RuntimeError()
8276

77+
chunk.logManager.end()

0 commit comments

Comments
 (0)