Skip to content

Commit

Permalink
Merge pull request #2513 from alicevision/dev/scenePreview
Browse files Browse the repository at this point in the history
[nodes] Use principal point in scenePreview
  • Loading branch information
cbentejac authored Aug 28, 2024
2 parents f48785f + d46707a commit b5a77ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions meshroom/nodes/blender/scripts/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ def setupCamera(intrinsic, pose):
camData.sensor_width = float(intrinsic['sensorWidth'])
camData.lens = float(intrinsic['focalLength'])

#shift is normalized with the largest resolution
fwidth = float(intrinsic['width'])
fheight = float(intrinsic['height'])
maxSize = max(fwidth, fheight)
camData.shift_x = - float(intrinsic['principalPoint'][0]) / maxSize
camData.shift_y = float(intrinsic['principalPoint'][1]) / maxSize

tr = pose['pose']['transform']
matPose = mathutils.Matrix.Identity(4)
matPose[0][0] = float(tr['rotation'][0])
Expand Down Expand Up @@ -301,6 +308,7 @@ def setupPointCloudShading(obj, color, size):


def main():

argv = sys.argv

if "--" not in argv:
Expand Down

0 comments on commit b5a77ce

Please sign in to comment.