From aa368dfb46e462442966e46e63bf10991939bb04 Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Thu, 12 Sep 2024 15:16:13 +0200 Subject: [PATCH] Use pixel aspect ratio for 3d viewer --- meshroom/ui/qml/Viewer3D/Viewer3D.qml | 2 +- meshroom/ui/reconstruction.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/meshroom/ui/qml/Viewer3D/Viewer3D.qml b/meshroom/ui/qml/Viewer3D/Viewer3D.qml index 76ba1108b9..5a514e6ea8 100644 --- a/meshroom/ui/qml/Viewer3D/Viewer3D.qml +++ b/meshroom/ui/qml/Viewer3D/Viewer3D.qml @@ -269,7 +269,7 @@ FocusScope { sourceComponent: ImageOverlay { id: imageOverlay source: root.viewpoint.undistortedImageSource - imageRatio: root.viewpoint.orientedImageSize.width / root.viewpoint.orientedImageSize.height + imageRatio: root.viewpoint.orientedImageSize.width * root.viewpoint.pixelAspectRatio / root.viewpoint.orientedImageSize.height uvCenterOffset: root.viewpoint.uvCenterOffset showFrame: Viewer3DSettings.showViewpointImageFrame imageOpacity: Viewer3DSettings.viewpointImageOverlayOpacity diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index e1aaaa5f77..bdd43e26c7 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -367,6 +367,14 @@ def fieldOfView(self): else: sensorHeight = self.solvedIntrinsics["sensorHeight"] return 2.0 * math.atan(float(sensorHeight) / (2.0 * float(focalLength))) * 180.0 / math.pi + + @Property(type=float, notify=sfmParamsChanged) + def pixelAspectRatio(self): + """ Get camera pixel aspect ratio. """ + if not self.solvedIntrinsics: + return 1.0 + + return float(self.solvedIntrinsics["pixelRatio"]) @Property(type=QUrl, notify=undistortedImageParamsChanged) def undistortedImageSource(self):