# Three-Dimensional Reconstruction-Based Vibration Measurement of Bridge Model Using UAVs
## 2 Methods
### Three-Dimensional Reconstruction Method
#### 2.3.1 Camera Calibration  
Let \([X_{w},Y_{w},Z_{w}]^{T}\) be the coordinates of a point in the 3D world coordinate system and \([u,v]^{T}\) the 2D projection of the point on the image. The relationship between the 3D world coordinates and 2D pixel coordinates can be written as [38]:  
\[s\left[\begin{array}{c}u\\ v\\ 1\end{array}\right]=\mathbf{A}\left[\begin{array}{cc}\mathbf{R}&\mathbf{t} \end{array}\right]\left[\begin{array}{c}X_{w}\\ Y_{w}\\ Z_{w}\\ 1\end{array}\right] \tag{5}\]  
where \(s\) is an arbitrary scale factor; \(\mathbf{R}=\left[\begin{array}{cc}\mathbf{r}_{1}&\mathbf{r}_{2}&\mathbf{r }_{3}\end{array}\right]\) is the rotation matrix and \(\mathbf{t}=\left[\begin{array}{cc}t_{1}&t_{2}&t_{3}\end{array}\right]^{T}\) is the translation vector, \(\left[\begin{array}{cc}\mathbf{R}&\mathbf{t}\end{array}\right]\) represents the extrinsic matrix that converts the world coordinate system to the camera coordinate system; and \(\mathbf{A}\) is the intrinsic matrix which is given by:  
\[\mathbf{A}=\left[\begin{array}{ccc}f_{x}&\gamma&u_{0}\\ 0&f_{y}&v_{0}\\ 0&0&1\end{array}\right] \tag{6}\]  
where \(f_{x}\) and \(f_{y}\) are the scale factors in the \(x\) and \(y\) axes of the image plane, respectively; \(u_{0}\), \(v_{0}\) are the pixel coordinates of the image center; \(\gamma\) is the skewness parameter.  
According to [PERSON]'s calibration method [38], the solution of the camera projection matrix (camera calibration) consists of three parts: (a) Intrinsic parameter calibration; (b) Extrinsic parameter calibration; and (c) Minimizing the reprojection error.  
By taking more than three pictures of the chessboard with different views, the intrinsic matrix \(\mathbf{A}\) can be solved by [PERSON]'s method. The intrinsic parameters of the UAV camera are invariable, and the calibration algorithms are available in the Camera Calibrator app of MATLAB.  
The extrinsic matrix represents the position and orientation of the UAV camera for different moments. As shown in Figure 4, the upper left corner of the fixed object plane can be set as the origin of the world coordinate system, the horizontal direction is the \(X_{w}\) axis, and the vertical direction is the \(Y_{w}\) axis. Once \(\mathbf{A}\) is known, the UAV extrinsic matrix can be computed by at least four sets of world coordinates and their corresponding image pixel coordinates.  
Figure 4: Extrinsic parameters of each frame.  
During calibration, the extrinsic parameters are estimated numerically by minimizing the reprojection errors for all calibration images, which is:  
\[\sum_{i=1}^{n}\sum_{j=1}^{m}\parallel\mathbf{m}_{ij}-\widehat{\mathbf{m}}( \mathbf{A,R}_{i}\mathbf{r}_{i}\mathbf{r}_{j})\parallel^{2} \tag{7}\]  
where \(n\) is the number of frames. \(m\) is the number of points. \(\mathbf{m}_{ij}\) represents the \(j^{th}\) detected point in frame \(i\); \(\widehat{\mathbf{m}}(\mathbf{A,R}_{i}\mathbf{r}_{i}P_{j})\) is the projection of world point \(P_{j}\) in frame \(i\), using the estimated \(\mathbf{R}_{i}\) and \(\mathbf{t}_{i}\).  
The solution of the extrinsic matrix is completed by applying the extrinsic function in the Computer Vision Toolbox of MATLAB. Once the matrices \(\mathbf{R}_{i}\) and \(\mathbf{t}_{i}\)\((i=1,2,3\dots,n)\) for each UAV frame have been calculated, the projection matrices can be estimated by combining the intrinsic matrix \(\mathbf{A}\). The details of 3D reconstruction using a projection matrix will be introduced in the next section.