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.
This commit is contained in:
Aryan Yadav
2026-12-02 15:17:24 +05:30
committed by GitHub
parent 8cd249d1b9
commit 573d22b961

View File

@@ -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