mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-29 17:06:35 +02:00
[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:
parent
bf912cd353
commit
c7a55e56b7
2 changed files with 27 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue