mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-02 16:28:51 +02:00
[nodes] CameraInit: Principal Point is now relative to the image center
The principal point is no more relative to the top-left corner of the image. Linked to the AliceVision sfmData IO change in file version 1.2.1.
This commit is contained in:
parent
5bdbeaf0d8
commit
61308eb211
1 changed files with 14 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
__version__ = "5.0"
|
||||
__version__ = "6.0"
|
||||
|
||||
import os
|
||||
import json
|
||||
|
@ -255,12 +255,22 @@ The metadata needed are:
|
|||
]
|
||||
|
||||
def upgradeAttributeValues(self, attrValues, fromVersion):
|
||||
if fromVersion <= Version(4, 0):
|
||||
# Starting with version 5, the focal length is now split on x and y
|
||||
if fromVersion < Version(5, 0):
|
||||
for intrinsic in attrValues['intrinsics']:
|
||||
# focal length is now split on x and y
|
||||
pxFocalLength = intrinsic['pxFocalLength']
|
||||
if not isinstance(pxFocalLength, dict):
|
||||
intrinsic['pxFocalLength'] = {"x": pxFocalLength, "y": pxFocalLength}
|
||||
|
||||
# Starting with version 6, the principal point is now relative to the image center
|
||||
if fromVersion < Version(6, 0):
|
||||
for intrinsic in attrValues['intrinsics']:
|
||||
principalPoint = intrinsic['principalPoint']
|
||||
intrinsic['principalPoint'] = {
|
||||
"x": int(principalPoint["x"] - 0.5 * intrinsic['width']),
|
||||
"y": int(principalPoint["y"] - 0.5 * intrinsic['height'])
|
||||
}
|
||||
|
||||
return attrValues
|
||||
|
||||
def readSfMData(self, sfmFile):
|
||||
|
@ -328,7 +338,7 @@ The metadata needed are:
|
|||
view['metadata'] = json.loads(view['metadata'])
|
||||
|
||||
sfmData = {
|
||||
"version": [1, 2, 0],
|
||||
"version": [1, 2, 1],
|
||||
"views": views + newViews,
|
||||
"intrinsics": intrinsics,
|
||||
"featureFolder": "",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue