## 4 Calibration of the Camera Array
### Self-Calibrating Baselines  
A typical stereo camera self-calibration is focused on retrieving extrinsic parameters of a camera pair. The aim is to calibrate cameras so that a point \(p_{r}\) from the reference image is correctly matched with a point \(p_{s}\) from a side image and as a result a correct disparity \(d\) is identified. In case of the EBCA array, there are more tasks. Lets consider points \(p_{sk}\) from \(I_{\text{C}k}\), \(k\in 1,2,3,4\), corresponding to the same point \(p_{r1}\) in raw image \(I_{R0}\). Points \(p_{sk}\) needs to be correctly matched with points in every side image \(I_{\text{S}k}\). As a result, disparities \(d_{k}\) are obtained. However, in case of EBCA, it is expected that \(d_{1}=d_{2}=d_{3}=d_{4}\). Even if correct values of \(d_{k}\) are obtained for every considered camera pair these values may not be equal to each other, because inaccuracies in the construction of EBCA. Theoretically, baselines of all considered stereo cameras are the same, but in real devices there are always some minor differences in baseline lengths. Baselines of considered stereo cameras \(C_{k}\) may differ to such an extent that there are differences of at least few pixels between values of \(d_{k}\). This deteriorates the quality of resulting disparity map because when data is merged from all four \(C_{k}\) under the assumption that baselines of these cameras are the same. Nevertheless, due to the self-calibration process described in this section images can be rectified in order to reduce differences between disparities \(d_{k}\). The rectifying transformation defined in the self-calibrating process will be denoted by \(M_{k}\), where \(k\) corresponds to a camera pair \(C_{k}\). Let us first consider merging disparitiesfor a single point \(p_{r1}\). Let us assume that a stereo matching algorithm correctly acquired disparities \(d_{k}\) for this point. Thus, there are  
\[ \begin{split} d_{1}&=d(p_{r1},I_{S1})\\ d_{2}&=d(p_{r1},I_{S2})\\ d_{3}&=d(p_{r1},I_{S3})\\ d_{4}&=d(p_{r1},I_{S4})\end{split}  \tag{8}\]  
where \(I_{S1}\) is a side image after transformations as described in Section 4.1. We are willing to obtain disparities \(d_{2}^{\prime}\), \(d_{3}^{\prime}\) and \(d_{4}^{\prime}\) presented in Equation (9) such that \(d_{1}=d_{2}^{\prime}=d_{3}^{\prime}=d_{4}^{\prime}\). \[ \begin{split} d_{1}&=d(p_{r1},I_{S1})\\ d_{2}^{\prime}&=d(p_{r1},M_{2}I_{S2})\\ d_{3}^{\prime}&=d(p_{r1},M_{3}I_{S3})\\ d_{4}^{\prime}&=d(p_{r1},M_{4}I_{S4})\end{split}  \tag{9}\]  
Values of \(d^{\prime}\) will be equal to each other if transformations \(M_{k}\) cause that points of images \(I_{Sk}\) are shifted in the X dimension for numbers of pixels equal to \(m_{k}\) such that, \(m_{k}=d_{k}-d_{k}^{\prime}\) for \(k\in 2,3,4\). For different points of image \(I_{Sk}\) desired values of \(m_{k}\) may be different as there can be different values of \(d_{k}-d_{k}^{\prime}\) for different points of \(I_{Sk}\). Therefore, translation matrices \(M_{k}\) needs to be obtained with regard to the entire image \(I_{R0}\). This paper introduces estimating the shift \(m_{k}\) of images \(I_{sk}\) on the basis of keypoints acquired by the SURF algorithm [55]. Keypoints in the reference image and corresponding keypoints in side images are identified in image pairs \(I_{P}\) obtained after transformations \(E_{k}\) described in Section 4.1. Let \(O_{k}\) denote a set of matching keypoints in a pair consisting of a reference image \(I_{Ck}\) and side image \(I_{Sk}\). For different \(k\) there will be different keypoints in images \(I_{Ck}\) and \(I_{Sk}\). However, there will also be such keypoints \(o_{Ck}\) in images \(I_{Ck}\) which are derived from the same point \(o_{0}\) of the raw image \(I_{R0}\) transformed to different coordinates because of calibrating transformation \(E_{k}\). Such keypoints are those for which condition presented in Equation (10) is fulfilled.