# Algorithm for Fatigue Crack Initiation Assessment Based on Industrial Photogrammetry
## 2 Materials and Methods
### Algorithm for Automatic Fatigue Crack Initiation Assessment  
The algorithm starts with a preprocessing step that includes cropping the images to the region of interest of the constant value, followed by radiometric equalization of the images and histogram matching according to the tonal value of the reference image (Figure 3). Histogram matching is performed using the ScitKit Image function; it manipulates the pixels of an input image so that its histogram matches the histogram of the reference image. The next step is the detection of key points on the reference image and the training images using the ORB method [18]. The ORB algorithm for image matching is generally divided into three steps: landmark extraction, landmark descriptor generation, and landmark matching. All detected key points are spatially filtered and divided into two regions of interest: (a) the upper and (b) the lower third of the image (see Figure 5). Figure 2: Industrial photogrammetry setup and data acquisition in the testing machine during the fatigue test: (**a**) a Zwick/Roell Amsler HB250 hydraulic testing machine, (**b**) photographing the crack at the weld toe and the number of current cycles, (**c**) failure of the test specimen. The third step of the algorithm begins with sorting the points that fall into the region of interest (ROI). In this study, the ROI is divided into the upper third of imagery and the bottom third of imagery. Since the welds of the specimen are located in the center of the image and stress is applied from the top and bottom, the largest structural movements are expected at the welds, which are the subject of this study. As can be seen in Figure 2, the camera is in an orthogonal position in relation to the specimen throughout the test, so we can assume that the image plane coincides with the specimen plane. The coordinate system of the image can be used to determine the 2D position of the test specimen. The image coordinate system can be considered unchanged across all collected images due to the fixed camera position during tests. Using the calculated and sorted key points from the ORB method and selecting 5 of the best matching points from each third of the image, the ORB method has a match evaluation function and can filter out the key points. The coordinate differences (Y-axis and X-axis differences) with key points from the upper third in combination with all key points from the lower third are calculated. The coordinate differences obtained by the algorithm on the reference (\(Y_{R}\) and \(X_{R}\)) and training images (\(Y_{T}\) and \(X_{T}\)) are used to calculate the coordinate differences (\(\Delta Y_{diff}\) and \(\Delta X_{diff}\)) that represent test specimen displacements (1) and (2). The displacements of the test specimen were calculated for each training image. A standard deviation (s) is calculated from the differences calculated using the Formulas (3)-(6), and the statistical 3-sigma test is used to supervise the calculated data. If the standard deviation exceeds the values of the statistical 3-sigma test, the imagery is removed from the specified calculation algorithm. The final result of this step of the algorithm indicates the size of the deviation of the trained imagery concerning the reference imagery. \[\Delta Y_{diff}=Y_{T}-Y_{R} \tag{1}\]  
\[\Delta X_{diff}=X_{T}-X_{R} \tag{2}\]  
Mean \(\Delta Y\) represents the arithmetic mean of all \(\Delta Y_{diff}\) values from Table 1 for each individual imagery calculated according to the following formula:  
\[mean\Delta Y=\frac{\Delta Y_{diff1}+\ldots+\Delta Y_{diffn}}{count(\Delta Y_{ diff})} \tag{3}\]  
Mean \(\Delta X\) represents the arithmetic mean of all \(\Delta X_{diff}\) values from Table 1 for each individual imagery calculated according to the following formula:  
\[mean\Delta X=\frac{\Delta X_{diff1}+\ldots+\Delta X_{diffn}}{count(\Delta X_{ diff})} \tag{4}\]  
Figure 3: Algorithm workflow.