mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-28 16:36:32 +02:00
[tests] tests UIDs on the multiview pipeline
* ensure that identical graphs have the same UIDs * ensure that multiview pipeline graphs with different input images have different UIDs on all output attributes
This commit is contained in:
parent
ffddc14acd
commit
041f98ae8a
1 changed files with 46 additions and 5 deletions
|
@ -6,11 +6,16 @@ import meshroom.multiview
|
|||
def test_multiviewPipeline():
|
||||
graph1 = meshroom.multiview.photogrammetryPipeline(inputFolder='/non/existing/folder')
|
||||
graph2 = meshroom.multiview.photogrammetryPipeline(inputImages=[])
|
||||
graph2b = meshroom.multiview.photogrammetryPipeline(inputImages=[])
|
||||
graph3 = meshroom.multiview.photogrammetryPipeline(inputImages=['/non/existing/file1', '/non/existing/file2'])
|
||||
graph4 = meshroom.multiview.photogrammetryPipeline(inputViewpoints=[
|
||||
{'image': '/non/existing/file1', 'focal': 50},
|
||||
{'image': '/non/existing/file2', 'focal': 55}
|
||||
])
|
||||
graph4b = meshroom.multiview.photogrammetryPipeline(inputViewpoints=[
|
||||
{'image': '/non/existing/file1', 'focal': 50},
|
||||
{'image': '/non/existing/file2', 'focal': 55}
|
||||
])
|
||||
|
||||
assert graph1.findNode('CameraInit').imageDirectory.value == '/non/existing/folder'
|
||||
assert graph2.findNode('CameraInit').imageDirectory.value == ''
|
||||
|
@ -28,8 +33,44 @@ def test_multiviewPipeline():
|
|||
assert viewpoints[1].image.value == '/non/existing/file2'
|
||||
assert viewpoints[1].focal.value == -1
|
||||
|
||||
viewpoints = graph4.findNode('CameraInit').viewpoints
|
||||
assert viewpoints[0].image.value == '/non/existing/file1'
|
||||
assert viewpoints[0].focal.value == 50
|
||||
assert viewpoints[1].image.value == '/non/existing/file2'
|
||||
assert viewpoints[1].focal.value == 55
|
||||
for graph in (graph4, graph4b):
|
||||
viewpoints = graph.findNode('CameraInit').viewpoints
|
||||
assert viewpoints[0].image.value == '/non/existing/file1'
|
||||
assert viewpoints[0].focal.value == 50
|
||||
assert viewpoints[1].image.value == '/non/existing/file2'
|
||||
assert viewpoints[1].focal.value == 55
|
||||
|
||||
# Ensure that all output UIDs are different as the input is different:
|
||||
# graph1 != graph2 != graph3 != graph4
|
||||
for otherGraph in (graph2, graph3, graph4):
|
||||
for node in graph1.nodes:
|
||||
otherNode = otherGraph.node(node.name)
|
||||
for key, attr in node.attributes.items():
|
||||
if attr.isOutput:
|
||||
otherAttr = otherNode.attribute(key)
|
||||
assert attr.uid(None) != otherAttr.uid(None)
|
||||
|
||||
# graph2 == graph2b
|
||||
nodes, edges = graph2.dfsOnFinish()
|
||||
for node in nodes:
|
||||
otherNode = graph2b.node(node.name)
|
||||
for key, attr in node.attributes.items():
|
||||
otherAttr = otherNode.attribute(key)
|
||||
if attr.isOutput:
|
||||
assert attr.uid(None) == otherAttr.uid(None)
|
||||
else:
|
||||
for uidIndex in attr.desc.uid:
|
||||
assert attr.uid(uidIndex) == otherAttr.uid(uidIndex)
|
||||
|
||||
# graph4 == graph4b
|
||||
nodes, edges = graph4.dfsOnFinish()
|
||||
for node in nodes:
|
||||
otherNode = graph4b.node(node.name)
|
||||
for key, attr in node.attributes.items():
|
||||
otherAttr = otherNode.attribute(key)
|
||||
if attr.isOutput:
|
||||
assert attr.uid(None) == otherAttr.uid(None)
|
||||
else:
|
||||
for uidIndex in attr.desc.uid:
|
||||
assert attr.uid(uidIndex) == otherAttr.uid(uidIndex)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue