0

I need to perform a Stereo Calibration and the MATLAB tool is for sure more user friendly than OpenCV.

The problem is that in the script I have to use they call a file.npz with the calibration parameter. How can I convert the MATLAB output into such a file?

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
gaetano ma
  • 139
  • 12
  • So, you know how to make it work in matlab? Also I guess you are referring to this: https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.savez.html – Eypros May 07 '18 at 12:47
  • yes I can use the matlab tool and yes the file.npz would be written with savez – gaetano ma May 08 '18 at 07:12
  • You don't provide any information about how exactly is the MATLAB output or what have you tried so far. Maybe you can convert `npz` file to format you can work with. – Eypros May 08 '18 at 08:09

1 Answers1

0

I simply exported the MATLAB calibration matrices as a string using mat2str() and pasted them in numpy using np.matrix("string"). Maybe it would better two write a script for this, but for a few matrices it was all right.

Then you can simply export the numpy variables using np.savez_compressed("filename.npz", variable1=variable1, variable2=variable2,...) with names matching your subsequent scripts.

Note that MATLAB and OpenCV use different notations and therefore you may need to transpose the camera matrices, R and T!

F1iX
  • 823
  • 6
  • 12