Ask Your Question

Revision history [back]

load yaml calibration file to undistort

I used the aruco_calibration_fromimages tool from aruco utils and I successfully get a resulting *.yaml file like this:

%YAML:1.0
image_width: 318
image_height: 198
camera_matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 2.6088477016556299e+03, 0., 2.0580445249470489e+02, 0.,
       6.5584333303970277e+02, 1.0436411882106108e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
   rows: 1
   cols: 5
   dt: d
   data: [ -2.2705754141856268e+01, 9.6466413037022971e+02,
       -2.1446765483140479e-01, 5.2980598312981608e-01,
       -2.5475401560626519e+03 ]

Then I read the following tutorial opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html and I now want to undistort the image from my camera... but I don't understand how to load the *.yaml file. I don't understand the purpose of the cv2.getOptimalNewCameraMatrix method, nor what are thoses *mtx parameters.

Well... I'm lost at the very begining...

load yaml calibration file to undistort

I used the aruco_calibration_fromimages tool from aruco utils and I successfully get a resulting *.yaml file like this:

%YAML:1.0
image_width: 318
image_height: 198
camera_matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 2.6088477016556299e+03, 0., 2.0580445249470489e+02, 0.,
       6.5584333303970277e+02, 1.0436411882106108e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
   rows: 1
   cols: 5
   dt: d
   data: [ -2.2705754141856268e+01, 9.6466413037022971e+02,
       -2.1446765483140479e-01, 5.2980598312981608e-01,
       -2.5475401560626519e+03 ]

Then I read the following tutorial opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html and I now want to undistort the image from my camera... but I don't understand how to load the *.yaml file. I don't understand the purpose of the cv2.getOptimalNewCameraMatrix method, nor what are thoses *mtx parameters.

Well... I'm lost at the very begining...