From 573d22b9612ca0fbfada74bc75b5f3a8e9f26505 Mon Sep 17 00:00:00 2001 From: Aryan Yadav <141573833+aryany3101@users.noreply.github.com> Date: Wed, 2 Dec 2026 15:17:24 +0530 Subject: [PATCH] Fix 3D axes creation in the camera extrinsics sample (#31175) Running camera_calibration_show_extrinsics.py with the bundled left_intrinsics.yml fails before plotting on Matplotlib 3.11.2. Figure.gca() rejects the projection keyword. Use Figure.add_subplot(111, projection='3d') to create the axes. Verified with Python 3.12, OpenCV 4.14.0 and the Agg backend. Both the default view and the --patternCentric view completed with samples/data/left_intrinsics.yml. --- samples/python/camera_calibration_show_extrinsics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/python/camera_calibration_show_extrinsics.py b/samples/python/camera_calibration_show_extrinsics.py index 0ee2a19b68..ba243711d5 100755 --- a/samples/python/camera_calibration_show_extrinsics.py +++ b/samples/python/camera_calibration_show_extrinsics.py @@ -200,7 +200,7 @@ def main(): from mpl_toolkits.mplot3d import Axes3D # pylint: disable=unused-variable fig = plt.figure() - ax = fig.gca(projection='3d') + ax = fig.add_subplot(1, 1, 1, projection='3d') ax.set_aspect("auto") cam_width = args.cam_width