mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-31 01:46:31 +02:00
[nodes] SfMChecking
: Rename node and minor process improvements
This commit is contained in:
parent
51cddc5af0
commit
9ec0a17cf6
1 changed files with 21 additions and 26 deletions
|
@ -2,17 +2,15 @@ __version__ = "1.0"
|
||||||
|
|
||||||
from meshroom.core import desc
|
from meshroom.core import desc
|
||||||
from meshroom.core.utils import VERBOSE_LEVEL
|
from meshroom.core.utils import VERBOSE_LEVEL
|
||||||
import os.path
|
|
||||||
|
|
||||||
|
|
||||||
|
class SfMChecking(desc.Node):
|
||||||
|
|
||||||
class SfmChecking(desc.Node):
|
category = "Utils"
|
||||||
|
documentation = """
|
||||||
category = 'Utils'
|
Check an input SfM for validity.
|
||||||
documentation = '''
|
Throw an error if the SfM does not satisfy constraints.
|
||||||
Check an input Sfm for validity.
|
"""
|
||||||
Throw an error if the sfm does not satisfy constraints
|
|
||||||
'''
|
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(
|
desc.File(
|
||||||
|
@ -22,8 +20,8 @@ class SfmChecking(desc.Node):
|
||||||
value="",
|
value="",
|
||||||
),
|
),
|
||||||
desc.FloatParam(
|
desc.FloatParam(
|
||||||
name="posecompletion",
|
name="poseCompletion",
|
||||||
label="Completion percentage",
|
label="Completion Percentage",
|
||||||
description="Minimal percent of the views reconstructed.",
|
description="Minimal percent of the views reconstructed.",
|
||||||
value=80.0,
|
value=80.0,
|
||||||
range=(0.0, 100.0, 1.0),
|
range=(0.0, 100.0, 1.0),
|
||||||
|
@ -50,10 +48,9 @@ class SfmChecking(desc.Node):
|
||||||
from pyalicevision import sfmData as avsfmdata
|
from pyalicevision import sfmData as avsfmdata
|
||||||
from pyalicevision import sfmDataIO as avsfmdataio
|
from pyalicevision import sfmDataIO as avsfmdataio
|
||||||
|
|
||||||
error = False
|
|
||||||
|
|
||||||
chunk.logManager.start(chunk.node.verboseLevel.value)
|
chunk.logManager.start(chunk.node.verboseLevel.value)
|
||||||
chunk.logger.error("open input")
|
chunk.logger.info("Open input file")
|
||||||
|
|
||||||
data = avsfmdata.SfMData()
|
data = avsfmdata.SfMData()
|
||||||
ret = avsfmdataio.load(data, chunk.node.input.value, avsfmdataio.ALL)
|
ret = avsfmdataio.load(data, chunk.node.input.value, avsfmdataio.ALL)
|
||||||
if not ret:
|
if not ret:
|
||||||
|
@ -63,20 +60,18 @@ class SfmChecking(desc.Node):
|
||||||
|
|
||||||
total = len(data.getViews())
|
total = len(data.getViews())
|
||||||
valid = len(data.getValidViews())
|
valid = len(data.getValidViews())
|
||||||
ratio = (100.0 * float(valid))/float(total)
|
ratio = (100.0 * float(valid)) / float(total)
|
||||||
|
|
||||||
chunk.logger.info(f"Total views : {total}")
|
chunk.logger.info(f"Total views: {total}")
|
||||||
chunk.logger.info(f"Reconstructed views : {valid}")
|
chunk.logger.info(f"Reconstructed views: {valid}")
|
||||||
chunk.logger.info(f"Percentage : {ratio}")
|
chunk.logger.info(f"Percentage of reconstructed views: {ratio}")
|
||||||
|
|
||||||
if ratio < chunk.node.posecompletion.value:
|
if ratio < chunk.node.poseCompletion.value:
|
||||||
chunk.logger.error("Percentage of reconstructed views is insufficient")
|
chunk.logger.error("Percentage of reconstructed views is insufficient.")
|
||||||
error = True
|
chunk.logger.error(f"Expected {chunk.node.poseCompletion.value}, got {ratio}.")
|
||||||
|
chunk.logManager.end()
|
||||||
avsfmdataio.save(data, chunk.node.output.value, avsfmdataio.ALL)
|
|
||||||
|
|
||||||
chunk.logManager.end()
|
|
||||||
|
|
||||||
if error:
|
|
||||||
raise RuntimeError()
|
raise RuntimeError()
|
||||||
|
|
||||||
|
avsfmdataio.save(data, chunk.node.output.value, avsfmdataio.ALL)
|
||||||
|
|
||||||
|
chunk.logManager.end()
|
Loading…
Add table
Add a link
Reference in a new issue