## 4 Calibration of the Camera Array
### Pairwise Calibration  
A pairwise calibration and rectification presented in this section is based on OpenCV calibration algorithms implementing the calibration method proposed by [PERSON] and the rectification method introduced by [PERSON] [41; 51; 63]. In order to obtain calibrated of images taken by EBCA using OpenCV based method raw images (marked with \(I_{R}\)) need to be processed in few stages. This process in visualized by Figure 4. The first part of image processing is using calibration data for rectifying images in order to reduce distortions. This calibration is based on taking images of a predefined pattern as described in Section 2.4. Raw images \(I_{R}\) were processed as if they were taken by a set of four stereo cameras sharing a common camera which was the central one. \(I_{R0}\), \(I_{R1}\), \(I_{R2}\), \(I_{R3}\) and \(I_{R4}\) will denote raw images from a central, right, up, left and down camera, respectively. A sample set of raw images used in experiments is presented in Figure 5.  
Results of the image calibration consist of four pairs of images. The entire set of these pairs is marked with \(I_{P}\). \(I_{Ck}\) will denote a reference image in pair \(k\) and \(I_{Sk}\) will be a side one in this pair. A sample set of pairs is presented in Figure 6.  
Pairs \(I_{P}\) are intended to be used as input data to stereo matching algorithms designed for processing images from stereo cameras. Every pair of images is derived from an image taken by a central camera and an image from one of side cameras. In EBCA locations of side cameras with regard to a reference, central camera is different. However, each  
Figure 4: The process of stereo matching using pairwise calibration. considered pair of cameras is regarded as a stereo camera consisting of a left and right camera. Therefore, images were rotated and flipped in order to adapt them to such a configuration. Equation (2) used for calibrating pairs of cameras takes the form  
\[sp=W_{k}A[R|t]P_{w} \tag{4}\]  
where \(W_{k}\) is a matrix converting every pair of a central image and a side one to a pair which can be perceived as two images taken from a reference camera and a side camera located on the right side of a reference camera. Index \(k\) corresponds to the position of a side camera in the camera array. The whole transformation \(W_{k}A[R|t]\) will be marked with \(E_{k}\) in this paper. Transformation \(W_{k}\) is the same for a central image and a side image within the same stereo pair. An image from a central camera has a function of a reference image in every pair of cameras considered in EBCA, therefore this image in transformed differently for the purpose of using it with different side images. Figure 6 presents pairs of rectified strawberry images. Images were converted to grayscale as most of stereo matching algorithms process images in this form. There are four cases:  
**right camera**: The right camera forms with the central camera a standard stereo camera, therefore neither a rotation or an flipping is needed. Thus, in this case \(W_{1}=I\). **up camera**: Images from a pair consisting of top and central camera were first rotated \(90^{\circ}\) counterclockwise and than flipped around y-axis. The matrix \(W_{2}\) defining the transformation for the pair created with the use of up camera is equal to the value presented in Equation (5). \[W_{2}= \begin{bmatrix}0&-1&2c_{y}\\ -1&0&2c_{x}\\ 0&0&1\end{bmatrix}  \tag{5}\]  
Figure 5: Images taken by EBCA used for creating data set of strawberry images: (**a**) central image, (**b**) right image, (**c**) up image, (**d**) left image and (**e**) bottom image. Figure 6: Pairs of images in strawberry data set \(ST_{1}\) after performing the calibration process. (**a**,**b**) The left pair, (**c**,**d**) The up pair. (**e**,**f**) The right pair. (**g**,**h**) The bottom pair. where \((c_{x},c_{y})\) is the center of an image. This value needs to be considered because point (0,0) is not located in the middle of the image, but it is in top left corner of an image affecting transformation matrices.