# Defect Detection in Striped Images Using a One-Dimensional Median Filter
## 3 Results and Discussion  
Due to the limited number of actual defect images, the algorithm was evaluated based on 20 actual images and 65 synthesized images. The synthesized images were constructed using the segmented defects from the actual images, and the defects were randomly rotated and placed at various locations  
Figure 16: (**a**) Segmented interval image; (**b**) Mask for the blocks. Figure 17: (**a**) Image with defects and noises; (**b**) Applying closing operation, binarization, and image complement to (**a**) to remove the noises and identify defects in the interval. Figure 15: Flow of defect detection in intervals. in defect-free images to synthesize the defect images. At most, two defects were included in each of the synthesized images. Figure 18 illustrates two examples of the results obtained using the proposed algorithm. The scratches and stains were all identified and marked in Figure 18a,b, respectively. The processing time for an image was approximately 6.9 s.  
[PERSON] and [PERSON] [16] used the false negative rate (_FNR_) and the false positive rate (_FPR_) to determine two thresholds. _FNR_ and _FPR_ are defined in Equation (1) and Equation (2) as follows:  
\[FNR=\frac{FN}{TP+FN}, \tag{1}\]  
\[FPR=\frac{FP}{FP+TN}, \tag{2}\]  
where False Negative (_FN_) is the number of instances in which there is a defect but the proposed algorithm fails to identify it; True Positive (_TP_) is the number of instances in which there is a defect and the proposed algorithm correctly finds it; False Positive (_FP_) is the number of instances in which there are no defects but the proposed algorithm incorrectly determines that there is one; and True Negative (_TN_) is the number of instances in which there are no defects and the proposed algorithm correctly determines that there are none. By fixing one threshold, [PERSON] and [PERSON] [16] tested in which case the other threshold could reach the lowest _FNR_ and _FPR_. This study used a similar process to determine two critical parameters: section width, \(m\), and block binarization threshold, \(T_{r}\). A total of 30 actual images, which were not from the 85 test images, were used to determine the two parameters, \(m\) and \(T_{r}\) so that _FNR_ and _FPR_ were as small as possible. Here, this study adopted the root sum square (_RSS_) of _FNR_ and _FPR_ as the objective to be minimized. First, this study set \(T_{r}\) to be 15 and found the _RSS_ of _FNR_ and _FPR_ for \(m\) ranging from 200 to 450, in increments of 50. The results are shown in Table 1. It can be seen that when \(m\) = 300, the _RSS_ had its minimum value of 0.281. Besides, the _RSS_ varied little when \(m\) was in the range. In other words, _FNR_ and _FPR_ are not sensitive to \(m\). Next, this study used \(m\) = 300 and found the _RSS_ of _FNR_ and _FPR_ for \(T_{r}\), ranging from 5 to 35, in increments of 5. As shown in Table 2, when \(T_{r}\) = 20, the _RSS_ was at its minimum, so \(T_{r}\) = 20 was used in the proposed algorithm. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \(m\) & **200** & **250** & **300** & **350** & **400** & **450** \\ \hline \hline _RSS_ of _FNR_ & 0.283 & 0.283 & 0.281 & 0.284 & 0.283 & 0.285 \\
**and** _FPR_ & 0.283 & 0.281 & 0.281 & 0.284 & 0.283 & 0.285 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Root sum square of false negative rate (_FNR_) and false positive rate (_FPR_) when \(m\) varied from 200 to 450 and \(T_{r}\) = 15. Figure 18: (**a**) Scratches and (**b**) stains were identified and marked by the proposed algorithm. Finally, the binarization threshold (\(T_{w}\)) was determined. When \(T_{w}\) ranged from 185 to 215 with an increment of 5, the \(RSS\) was at its minimum when \(T_{w}\) = 190, as shown in Table 3, so \(T_{w}\) was set to 190 in this research. After the three critical parameters were determined, the performance of the algorithm was evaluated with 20 actual images and 65 synthesized images based on \(TPR\), \(FPR\), and Accuracy (\(ACC\)).