## 3 A Prototype System for Pedestrian Positioning
### Stereovision Camera  
#### 3.6.1 Introduction  
A stereovision camera [28] is comprised of two cameras which are shifted away along the \(X\) axis, _c.f._, Figure 9. The distance between the cameras is called the baseline of a stereo system and is denoted by \(B\). The baseline distance makes the same scene point \(P\) to be visible in the left and right camera at coordinates \(x_{L}\) and \(x_{R}\) respectively. The difference between the \(x_{L}\) and \(x_{R}\) values is called the disparity, and will be denoted by \(x_{d}\). The \(z\) coordinate of the observed object can be calculated from Equation (24), where \(f\) is the focal length. \[z=\frac{Bf}{x_{d}} \tag{24}\]  
For the legibility sake, the stereovision system can be treated as one camera, whose simplified coordinate system is shown in Figure 9. The \(Z\) axis coincides with the optical axis of the camera model. **Figure 9.** The local coordinate system of the stereovision camera. \(F\) is the focus of the camera, and \(f\) is the focal length, \((x,y,z)\) are the coordinates of a point in the camera coordinate system. This point has the coordinates \((x_{P},y_{P},0)\) on the projection plane \(P_{P}\) of the camera and \(\alpha\) denotes the angle from the \(Z\) axis at which point \((x,y,z)\) is visible by the camera. The coordinates of a point \((x,y,z)\) are projected onto the camera projection plane \(P_{P}\) according to the transformation (25). \[\left[ \begin{array}{c}x_{p}\\ y_{p}\end{array} \right]=\left[ \begin{array}{ccc}\frac{f}{z+f}&0&0\\ 0&\frac{f}{z+f}&0\end{array} \right]\left[ \begin{array}{c}x\\ y\\ z\end{array} \right] \tag{25}\]The depth of a point \((x,y,z)\), denoted by \(d_{p}(x,y,z)\), is understood as the distance from the point to the projection plane and equals Equation (26). \[d_{p}(x,y,z)=z \tag{26}\]  
The distance from the Y axis of the camera to a point with the \((x,y,z)\) coordinates is denoted by \(d_{Y}(x,y,z)\) and calculated from Equation (27). \[d_{Y}(x,y,z)=\sqrt{x^{2}+z^{2}} \tag{27}\]  
Let us define a function which returns the distance from the \(Y\) camera's axis to the nearest point visible at angle \(\alpha\) from the optical axis \(Z\), _c.f._ Figure 9. This function is defined by Equation (28). \[d_{\alpha}(\alpha)=\min(d_{Y}(x,y,z));\;\mathrm{where}\;\tan\alpha=\frac{x_{p} }{f}=\frac{x}{z} \tag{28}\]  
The data from the stereovision camera is digitized. The \((x_{p},y_{p})\) coordinates are quantized and converted to units called pixels. The transformed coordinates are denoted by \((x_{\mathrm{pix}},y_{\mathrm{pix}})\). The conversion follows through Equation (29). \[\left[ \begin{array}{c}x_{\mathrm{pix}}\\ y_{\mathrm{pix}}\end{array} \right]=\left[ \begin{array}{c}\mathrm{Round}( \frac{f_{\mathrm{pix}}}{f}x_{p})\\ \mathrm{Round}(\frac{f_{\mathrm{pix}}}{f}y_{p})\end{array} \right] \tag{29}\]  
where the Round() operator denotes rounding to a nearest integer number, \(f_{\mathrm{pix}}\) is the focal length of the camera expressed in pixels and is provided by the manufacturer in the technical specification. The difference between the maximal and minimal value of \(x_{\mathrm{pix}}\) is called the horizontal resolution of the camera and is denoted by \(x_{\mathrm{res}}\). The vertical resolution \(y_{\mathrm{res}}\) is defined by analogy. A depth map or a depth picture **L** is a two dimensional map defined by Equation (30). \[\textbf{L}(x_{\mathrm{pix}},y_{\mathrm{pix}})=\min(d_{p}(x,y,z));\;(x,y) \stackrel{{\eqref{eq:x_pix},\eqref{eq:y_pix}}}{{\rightarrow}}(x_ {\mathrm{pix}},y_{\mathrm{pix}}) \tag{30}\]  
The coordinates \((x,y)\) are related with \((x_{\mathrm{pix}},y_{\mathrm{pix}})\) through transformations (25) and (29). Equation (30) formally says that a stereo camera provides the depth to nearest points that are not occluded. This is so-called 2.5 dimension image. Usually, the depth for a given point \((x_{\mathrm{pix}},y_{\mathrm{pix}})\) is represented by a floating point-number. Using the identity (24), the disparity map **K** can be defined by Equation (31).