Add chunk notion for parallelization and implement specific updateInternals in CameraInit node

* Add chunk notion for parallelization
* Allows Node desc to implement custom updateInternals
* CameraInit node implement a specific updateInternals to update the
input image list
* FeatureExtraction, FeatureMatching, DepthMap, DepthMapFilter:
implement parallelization
This commit is contained in:
Fabien Castan 2017-11-07 15:47:14 +01:00
parent 39f6ef3d64
commit 1e4f8f8a61
14 changed files with 614 additions and 271 deletions

View file

@ -4,41 +4,48 @@ import meshroom.multiview
def test_multiviewPipeline():
graph1 = meshroom.multiview.photogrammetryPipeline(inputFolder='/non/existing/folder')
graph1 = meshroom.multiview.photogrammetryPipeline(inputImages=['/non/existing/fileA'])
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}
{'image': '/non/existing/file1', 'intrinsicId': 50},
{'image': '/non/existing/file2', 'intrinsicId': 55}
])
graph4b = meshroom.multiview.photogrammetryPipeline(inputViewpoints=[
{'image': '/non/existing/file1', 'focal': 50},
{'image': '/non/existing/file2', 'focal': 55}
{'image': '/non/existing/file1', 'intrinsicId': 50},
{'image': '/non/existing/file2', 'intrinsicId': 55}
])
assert graph1.findNode('CameraInit').imageDirectory.value == '/non/existing/folder'
assert graph2.findNode('CameraInit').imageDirectory.value == ''
assert graph3.findNode('CameraInit').imageDirectory.value == ''
assert graph4.findNode('CameraInit').imageDirectory.value == ''
assert graph1.findNode('CameraInit').viewpoints[0].image.value == '/non/existing/fileA'
assert len(graph2.findNode('CameraInit').viewpoints) == 0
assert graph3.findNode('CameraInit').viewpoints[0].image.value == '/non/existing/file1'
assert graph4.findNode('CameraInit').viewpoints[0].image.value == '/non/existing/file1'
assert len(graph1.findNode('CameraInit').viewpoints) == 0
assert len(graph1.findNode('CameraInit').viewpoints) == 1
assert len(graph2.findNode('CameraInit').viewpoints) == 0
assert len(graph3.findNode('CameraInit').viewpoints) == 2
assert len(graph4.findNode('CameraInit').viewpoints) == 2
viewpoints = graph3.findNode('CameraInit').viewpoints
assert viewpoints[0].image.value == '/non/existing/file1'
assert viewpoints[0].focal.value == -1
assert viewpoints[0].intrinsicId.value == -1
assert viewpoints[1].image.value == '/non/existing/file2'
assert viewpoints[1].focal.value == -1
assert viewpoints[1].intrinsicId.value == -1
assert viewpoints[0].image.isDefault() == False
assert viewpoints[0].intrinsicId.isDefault() == True
assert viewpoints.getPrimitiveValue(exportDefault=False) == [
{"image": '/non/existing/file1'},
{"image": '/non/existing/file2'},
]
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[0].intrinsicId.value == 50
assert viewpoints[1].image.value == '/non/existing/file2'
assert viewpoints[1].focal.value == 55
assert viewpoints[1].intrinsicId.value == 55
# Ensure that all output UIDs are different as the input is different:
# graph1 != graph2 != graph3 != graph4