Skip to main content
. 2021 Aug 10;21(16):5401. doi: 10.3390/s21165401
Algorithm 2. Steel wire rope surface defect detection method based on segmentation template and spatiotemporal gray sample set.
Inputs: Sequence images, time-domain frames P
Output: Sequence Images D(x,y)s containing defects
1: get ROI mask with Formula (1) and Formula (2)
2: t=0
3: while sequence images are not empty
4:  get ROI of the real-time image with ROI mask
5:   get N(x,y) with RSCM (algorithm 1)
6:    t=t+1
7:   if tP
8:      use queues save Soff(x,y),Goff(x,y) ,Son(x,y),Gon(x,y)
9:   else
10:      get gray AVG of Soff(x,y) Goff(x,y)  or Son(x,y) Gon(x,y)
11:      if the gradient between AVG and the current pixel T0
12:       update Soff(x,y) Goff(x,y)  or Son(x,y) Gon(x,y) by rule of
        FIFO (first in first out)
13:     end if
14:     get Q(x,y) with Formula (12)
15:     if Q(x,y)T1 and Q(x,y)T2
16:      D(x,y)=255
17:    else
18:      D(x,y)=0
19:     end if
20:    open operation of the morphological method for D(x,y)
21:    analyse D(x,y) connected domain and remove small connected regions
22: end while
23: return D(x,y)s