Table 1. Color difference checking.

Data: Image Im, binary mask M, contours C, direction di, max distance kmax, color threshold Td = 20
1 Initialize track of background thickness TH for each point in C
2 for point p in C do
3 k = 2
4 while k ≤ kmax do
5   Find point q: distance p to q in direction di is k
6   if q not exist then
7    break
8   end
9   if M[q] == 1 then
10    d = | Im[p] – Im[q] |
11    if d > Td then
12     TH[p] = k
13     Break
14    end
15    k = k + 1
16   end
17 end
18 end