Skip to main content
. 2022 May 26;22(11):4040. doi: 10.3390/s22114040
Algorithm 1 False Reduction.

Input:

     matrix[N,M]L

Output:

     L

1: for i0,1,,N do

2:    for j0,1,,M2 do

        ▹ Excepting the last two clips

3:        if matrix[i, j] ≠ matrix[i, j+1] then

4:           if count(matrix[i, j] in matrix[i, j+2 to j+4]) > 1 then

5:               matrix[i, j+1] ← not matrix[i, j+1]

6:           end if

7:        end if

8:    end for

        ▹ Recheck the first two clips

9:    if matrix[i, 0 to 2] is not identical then

10:        if matrix[i, 1] is not in matrix[i, 2 to 4] then

11:           matrix[i, 1] ← not matrix[i, 1]

12:        end if

13:        if matrix[i, 0] not in matrix[i, 1 to 3] then

14:           matrix[i, 0] ← not matrix[i, 0]

15:        end if

16:    end if

          ▹ For the last two clips

17:    if matrix[i, M1] ≠ matrix[i, M2] then

18:        if matrix[i, M1] ≠ matrix[i, M3] then

19:           matrix[i, M1] ← not matrix[i, M1]

20:        end if

21:    end if

22:    if matrix[i, M1] ≠ matrix[i, M2] then

23:        if matrix[i, M1] = matrix[i, M3] then

24:           matrix[i, M2] ← not matrix[i, M2]

25:        end if

26:    end if

27:    if matrix[i, M1] = matrix[i, M2] then

28:        if matrix[i, M1] not in matrix[i, M5 to M3] then

29:           matrix[i, M1] ← not matrix[i, M1]

30:           matrix[i, M2] ← not matrix[i, M2]

31:        end if

32:    end if

33: end for

34: Lmatrix