### Stereo Calibration - what is optimised?

In the stereo camera calibration code, I'm a bit confused as to what parameters are optimised. If we ignore intrinsic parameters for now, is it:

(a) The left (or equivalently right) extrinsic (chessboard to camera) matrices and 6 parameters for the left-to-right transformation? If so, what are we taking the median ~~of?
~~of?

(b) The left and right extrinsic matrices, and then we take the median of the implied left-to-right transformation?

Any help would be much appreciated.

Thanks,

Matt