Algorithm 1: Adaptive Joint Learning Semantic Segmentation Based on Prior Knowledge |
Input: Infrared grayscale image Img; Acquisition time t; Prior threshold |
Output: Segmentation results Binary_Img |
Step 1: Read the maximum and minimum temperatures corresponding to the pixel intensity extremes of Img. |
1: max (Img) -> T_max; min (Img) -> T_min |
Step 2: Convert Img to a temperature matrix TI based on T_max and T_min. |
2: TI = (Img − min (Img))/(max (Img) − min (Img)) × (T_max − T_min) |
Step 3: Calculate dam surface temperature threshold Tthreshold and bias Tbias based on t and the prior threshold. |
Step 4: Calculate the proportion of high-temperature anomalous pixels (Pixel_proportion) in TI exceeding Tthreshold + Tbias. |
3: for i = 0 to TI.shape [0] do |
4: for j = 0 to TI.shape [1] do |
5: if TI [i, j] > Tthreshold+ Tbias do sumTi = sumTi + 1 |
6: Pixel_proportion = sumTi/(TI.shape [0] × TI.shape [1]) |
Step 5: Determine anomaly type. |
7: if Pixel_proportion > 99%: global anomaly exists, Binary_Img[:,:] = 255 |
8: else if Pixel_proportion < 1%: anomaly-free, Binary_Img[:,:] = 0 |
9: else local anomaly exists, do Step 6 |
Step 6: Remove low-temperature pixel interference. |
10: if (Tthreshold − 2 × Tbias) > T_min: TI [TI < (Tthreshold − 2 × Tbias)] = Tthreshold − 2 × Tbias |
11: Img = (TI − T_min)/(T_max − T_min) × (max (Img) − min (Img)) |
Step 7: Perform Otsu’s thresholding for local hollowing segmentation. |
Gthreshold, Binary_Img = OTSU(Img) |
Step 8: Assign semantic labels to high-temperature anomaly pixels. |
Step 9: Apply morphological operations to refine segmentation. |
12: Binary_Img = morphologyEx (Binary_Img, cv2.MORPH_OPEN, (3 × 3)) |
13: Binary_Img = morphologyEx (Binary_Img, cv2.MORPH_CLOSE, (3 × 3)) |
End |