# Image Processing and QR Code Application Method for Construction Safety Management
## 3 Image Processing-Based Worker Location Estimation System
### Image Processing Learning Model
#### 3.2.1. Matching Coordinates between On-Site Video and Drawing  
When a region for management has been selected, a surveillance camera is installed. An ID is assigned to the surveillance camera, and the video from the camera is collected in real-time. Update the design drawing to see where the camera is located on the plane. Reference points are selected from the acquired image and the drawing, and the position reference coordinates are matched. After all coordinate matching is completed, check whether the recognized object is projected to the correct position on the plane (Figure 5).  
As shown in Figure 5a, the mapping process of the site topography can be targeted at 4 coordinate points in the video from the surveillance camera. After setting the coordinates, the observed object reads the person, worker, and QR code. In Figure 5b, the recognized object coordinates and rectangular reference coordinates are recognized as X, Y coordinates of the video. Record the offset X, Y length between the recognized object and 4 points based on the current state.  
Figure 4. Worker location estimation system algorithm.  
The rectangles and four points are shown in Figure 5b, and Figure 5c actually mean the same space and coordinates. Accordingly, it is necessary to search for a transducer of the four points and object's position. When Figure 5b coordinate points are expressed as input values (x, y), Figure 5c coordinate points can be expressed as result values (x', y'). (x', y') can be expressed as Equations (1)-(3).  
\[\left(\begin{array}{c}wx^{\prime}\\ wy^{\prime}\\ w\end{array}\right)=DR_{L}\left(\begin{array}{c}x\\ y\\ 1\end{array}\right)=\left[\begin{array}{ccc}p_{11}&p_{12}&p_{13}\\ p_{21}&p_{22}&p_{23}\\ p_{31}&p_{32}&p_{33}\end{array}\right]\left(\begin{array}{c}x\\ y\\ 1\end{array}\right) \tag{1}\]  
\[x^{\prime}=(p_{11}x+p_{12}y+p_{13})/(p_{31}x+p_{32}y+p_{33}) \tag{2}\]  
\[y^{\prime}=(p_{21}x+p_{22}y+p_{23})/(p_{31}x+p_{32}y+p_{33}) \tag{3}\]  
Figure 5: Conception of matching process between image and drawing: (**a**) setting 4 points to be used as the location standard from the on-site CCTV video; (**b**) estimating the relative position of the recognized object from the polygon created by the set 4 points; (**c**) setting the positions corresponding to the 4 points in the drawing and calculating the polygon’s distortion rate.; (**d**) estimating the position on the drawing of an object recognized by CCTV using the calculated results.  
Each Equation for x-coordinate and y-coordinate can be obtained from the movement relationship of a point. Therefore, a distortion rate factor (DRL) is obtained by sequentially analyzing eight equations from four input coordinates and output coordinates. Moreover, when the position coordinate point of the object recognized in Figure 5b is (m, n), the position coordinate of the object in Figure 5d is calculated as Equations (4) and (5) using \(DR_{L}\).  
\[\left(\begin{array}{c}a\\ b\\ c\end{array}\right)=DR_{L}\left(\begin{array}{c}m\\ n\\ 1\end{array}\right) \tag{4}\]  
\[\left(m^{\prime},\;n^{\prime}\right)=\left(a/c,\;b/c\right) \tag{5}\]