[reconstruction] retrieve and expose solved intrinsics

* [nodes] SfM: make more generic method to get SfM results and return solved intrinsics in addition to views and poses
* [reconstruction] store and expose solved intrinsics by viewpoints
This commit is contained in:
Yann Lanthony 2019-09-10 18:23:35 +02:00
parent bf912cd353
commit c7a55e56b7
No known key found for this signature in database
GPG key ID: 519FAE6DF7A70642
2 changed files with 27 additions and 11 deletions

View file

@ -267,19 +267,20 @@ class StructureFromMotion(desc.CommandLineNode):
]
@staticmethod
def getViewsAndPoses(node):
def getResults(node):
"""
Parse SfM result and return views and poses as two dict with viewId and poseId as keys.
Parse SfM result and return views, poses and intrinsics as three dicts with viewId, poseId and intrinsicId as keys.
"""
reportFile = node.outputViewsAndPoses.value
if not os.path.exists(reportFile):
return {}, {}
return {}, {}, {}
with open(reportFile) as jsonFile:
report = json.load(jsonFile)
views = dict()
poses = dict()
intrinsics = dict()
for view in report['views']:
views[view['viewId']] = view
@ -287,4 +288,7 @@ class StructureFromMotion(desc.CommandLineNode):
for pose in report['poses']:
poses[pose['poseId']] = pose['pose']
return views, poses
for intrinsic in report['intrinsics']:
intrinsics[intrinsic['intrinsicId']] = intrinsic
return views, poses, intrinsics